Skip to content

Commit

Permalink
trailing whitespace config added
Browse files Browse the repository at this point in the history
  • Loading branch information
sjbalaji committed Jun 9, 2014
1 parent cc616a6 commit 404b57a
Showing 1 changed file with 64 additions and 262 deletions.
326 changes: 64 additions & 262 deletions emacs
Expand Up @@ -53,7 +53,7 @@
;; setup auto completion mode
(setq auto-completion-mode 0)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; enable parenthesis matching globally
;; enable parenthesis matching globally
(show-paren-mode 1)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; line number mode
Expand Down Expand Up @@ -119,8 +119,8 @@
(add-hook 'org-mode-hook
(lambda ()
(define-key org-mode-map [f1] 'org-insert-todo-heading)
(define-key org-mode-map [f2] "\C-c\C-c")))
;; (define-key org-mode-map [f7] 'org-insert-subheading)))
(define-key org-mode-map [f2] "\C-c\C-c")
(define-key org-mode-map [f7] 'org-insert-subheading)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun my-semantic-speedbar-analysis ()
(interactive)
Expand Down Expand Up @@ -246,130 +246,19 @@
(delq (current-buffer)
(remove-if-not 'buffer-file-name (buffer-list)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; (load-file "~/.emacs.d/cedet-1.0/common/cedet.el")
;; ;; This plain hack probably will not work with versions other than speedbar v 1.0
;; (defun speedbar-timer-fn ()
;; "Run whenever Emacs is idle to update the speedbar item."
;; (if (or (not (speedbar-current-frame))
;; (not (frame-live-p (speedbar-current-frame))))
;; (speedbar-set-timer nil)
;; ;; Save all the match data so that we don't mess up executing fns
;; (save-match-data
;; ;; Only do stuff if the frame is visible, not an icon, and if
;; ;; it is currently flagged to do something.
;; (if (and speedbar-update-flag
;; (speedbar-current-frame)
;; (frame-visible-p (speedbar-current-frame))
;; (not (eq (frame-visible-p (speedbar-current-frame)) 'icon)))
;; (let ((af (selected-frame)))
;; (dframe-select-attached-frame speedbar-frame)
;; ;; make sure we at least choose a window to
;; ;; get a good directory from
;; (if (window-minibuffer-p (selected-window))
;; nil
;; ;; Check for special modes
;; (speedbar-maybe-add-localized-support (current-buffer))
;; ;; Update for special mode all the time!
;; (if (and speedbar-mode-specific-contents-flag
;; (consp speedbar-special-mode-expansion-list)
;; (local-variable-p
;; 'speedbar-special-mode-expansion-list
;; (current-buffer)))
;; ;;(eq (get major-mode 'mode-class 'special)))
;; (progn
;; (if (<= 2 speedbar-verbosity-level)
;; (speedbar-message
;; "Updating speedbar to special mode: %s..."
;; major-mode))
;; (speedbar-update-special-contents)
;; (if (<= 2 speedbar-verbosity-level)
;; (progn
;; (speedbar-message
;; "Updating speedbar to special mode: %s...done"
;; major-mode)
;; (speedbar-message nil))))

;; ;; Update all the contents if directories change!
;; (unless (and (or (member major-mode speedbar-ignored-modes)
;; (string-equal "*SPEEDBAR*" (buffer-name))
;; (not (buffer-file-name)))
;; ;; Always update for GUD.
;; (not (string-equal "GUD"
;; speedbar-initial-expansion-list-name)))
;; (speedbar-update-localized-contents)))
;; (select-frame af))
;; ;; Now run stealthy updates of time-consuming items
;; (speedbar-stealthy-updates)))))
;; (run-hooks 'speedbar-timer-hook))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; (add-to-list 'auto-mode-alist
;; '("/usr/include/Qt" . c++-mode))

;; (semantic-add-system-include
;; "/usr/include/Qt" 'c++-mode)
;; (add-to-list 'semantic-lex-c-preprocessor-symbol-file
;; "/usr/include/Qt/qconfig.h")
;; (add-to-list 'semantic-lex-c-preprocessor-symbol-file
;; "/usr/include/Qt/qconfig-dist.h")
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; (global-ede-mode 1) ; Enable the Project management system
;; (semantic-load-enable-code-helpers) ; Enable prototype help and smart completion
;; (global-srecode-minor-mode 1) ; Enable template insertion menu
;; ;; control + space
;; (global-set-key [?\C- ] 'semantic-complete-analyze-inline)

;; (load-library "completion")
;; (global-set-key (kbd "C-.") 'complete)

;; (defun my-semantic-hook ()
;; (imenu-add-to-menubar "TAGS"))
;; (add-hook 'semantic-init-hooks 'my-semantic-hook)
;; (semantic-load-enable-gaudy-code-helpers)
;; (require 'semantic-load)
;; (require 'semantic-gcc)
;; (require 'semantic-ia)
;; (require 'ede)
;; (require 'ede-locate)
;; (semantic-gcc-setup)
;; (setq semantic-load-turn-everything-on t)
;; (semantic-load-enable-excessive-code-helpers)
;; (global-ede-mode 1)
;; (global-semantic-idle-completions-mode nil)
;; (global-set-key "\C-\M-x" 'semantic-analyze-proto-impl-toggle)
;; (global-set-key [(control <)] 'semantic-goto-definition)
;; (global-set-key [(control >)] 'semantic-pop-tag-mark)
;; (defun my-cedet-hook ()
;; (local-set-key [(control return)] 'semantic-ia-complete-symbol)
;; (local-set-key "\C-c?" 'semantic-ia-complete-symbol-menu)
;; (local-set-key "\t" 'semantic-complete-analyze-inline)
;; (local-set-key "\C-cp" 'semantic-analyze-proto-impl-toggle))
;; (add-hook 'c-mode-common-hook 'my-cedet-hook)
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; (load-file "~/.emacs.d/sr-speedbar.el")
;; (require 'sr-speedbar)
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; custom key bindings programming mode
;; (defun my-programming-mode ()
;; (local-set-key [f11] "\C-u\M-.") ;; Next tag declaration
;; (local-set-key [f10] "\M-*") ;; Previous tag position
;; (local-set-key [f7] 'find-tag) ;; Search for a tag
;; (local-set-key [f5] 'semantic-speedbar-analysis)) ;; speedbar
;; ;; (local-set-key [f5] 'my-semantic-speedbar-analysis)) ;; speedbar
;; (add-hook 'c-mode-common-hook 'my-programming-mode)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; (add-to-list 'load-path "~/.emacs.d/el-get/el-get")

;; (unless (require 'el-get nil 'noerror)
;; (with-current-buffer
;; (url-retrieve-synchronously
;; "https://raw.github.com/dimitri/el-get/master/el-get-install.el")
;; (let (el-get-master-branch)
;; (goto-char (point-max))
;; (eval-print-last-sexp))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; custom key bindings programming mode
(defun my-programming-mode ()
(local-set-key [f11] "\C-u\M-.") ;; Next tag declaration
(local-set-key [f10] "\M-*") ;; Previous tag position
(local-set-key [f7] 'find-tag) ;; Search for a tag
;;(local-set-key [f5] 'semantic-speedbar-analysis)

;; (el-get 'sync)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
) ;; speedbar
;; (local-set-key [f5] 'my-semantic-speedbar-analysis)) ;; speedbar
(add-hook 'c-mode-common-hook 'my-programming-mode)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Cuda syntax highlighting
(add-to-list 'auto-mode-alist '("\\.cu$" . c++-mode))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Expand All @@ -389,119 +278,38 @@
;; (add-to-list 'load-path "~/.emacs.d/gnuplot-mode")
;; (require 'gnuplot)
;; (setq gnuplot-program "/usr/bin/gnulpot")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; If idle for more than 100 seconds then change it to read-only mode
;; (run-at-time 100 1000 (lambda ()(toggle-read-only 1)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; To customize the theme based on the window system
;; The one below is for the X-window system
;;(;; dd-to-list 'load-path "~/.emacs.d/color-theme-cobalt-0.0.2/")
;; (load-file "~/.emacs.d/color-theme-cobalt-0.0.2/color-theme-cobalt.el")
;; (if window-system
;; (color-theme-cobalt))
1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Autopair the paranthesis :P
;; (load-file "~/.emacs.d/autopair.el")
;; (defun autopair-close-block (arg)
;; (interactive "P")
;; (cond
;; (mark-active
;; (autopair-close arg))
;; ((not (looking-back "^[[:space:]]*"))
;; (newline-and-indent)
;; (autopair-close arg))
;; (t
;; (autopair-close arg))))
;; (add-hook 'c-mode-common-hook
;; '(lambda ()
;; (local-set-key "(" 'autopair-insert)
;; (local-set-key ")" 'autopair-insert)
;; (local-set-key "{" 'autopair-insert)
;; (local-set-key "}" 'autopair-close-block)))
;; (require 'autopair)

;; (setq skeleton-pair t)
;; (setq skeleton-pair-alist
;; '((?\( _ ?\))
;; (?[ _ ?])
;; (?{ _ ?})
;; (?\" _ ?\")))

;; (defun autopair-insert (arg)
;; (interactive "P")
;; (let (pair)
;; (cond
;; ((assq last-command-char skeleton-pair-alist)
;; (autopair-open arg))
;; (t
;; (autopair-close arg)))))

;; (defun autopair-open (arg)
;; (interactive "P")
;; (let ((pair (assq last-command-char
;; skeleton-pair-alist)))
;; (cond
;; ((and (not mark-active)
;; (eq (car pair) (car (last pair)))
;; (eq (car pair) (char-after)))
;; (autopair-close arg))
;; (t
;; (skeleton-pair-insert-maybe arg)))))

;; (defun autopair-close (arg)
;; (interactive "P")
;; (cond
;; (mark-active
;; (let (pair open)
;; (dolist (pair skeleton-pair-alist)
;; (when (eq last-command-char (car (last pair)))
;; (setq open (car pair))))
;; (setq last-command-char open)
;; (skeleton-pair-insert-maybe arg)))
;; ((looking-at
;; (concat "[ \t\n]*"
;; (regexp-quote (string last-command-char))))
;; (replace-match (string last-command-char))
;; (indent-according-to-mode))
;; (t
;; (self-insert-command (prefix-numeric-value arg))
;; (indent-according-to-mode))))

;; (defadvice delete-backward-char (before autopair activate)
;; (when (and (char-after)
;; (eq this-command 'delete-backward-char)
;; (eq (char-after)
;; (car (last (assq (char-before) skeleton-pair-alist)))))
;; (delete-char 1)))

;; (global-set-key "(" 'autopair-insert)
;; (global-set-key ")" 'autopair-insert)
;; (global-set-key "[" 'autopair-insert)
;; (global-set-key "]" 'autopair-insert)
;; (global-set-key "{" 'autopair-insert)
;; (global-set-key "}" 'autopair-insert)
;; (global-set-key "\"" 'autopair-insert)

;; (add-to-list 'skeleton-pair-alist '(?< _ ?>))

;; (defun autopairs-ret (arg)
;; (interactive "P")
;; (let (pair)
;; (dolist (pair skeleton-pair-alist)
;; (when (eq (char-after) (car (last pair)))
;; (save-excursion (newline-and-indent))))
;; (newline arg)
;; (indent-according-to-mode)))

;; (global-set-key (kbd "RET") 'autopairs-ret)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(default ((t (:background nil)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; If idle for more than 100 seconds then change it to read-only mode
(run-at-time 100 1000 (lambda ()(toggle-read-only 1)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Enable mouse in nw
(xterm-mouse-mode t)
(mouse-wheel-mode t)
(setq x-select-enable-clipboard t)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Auto load TAGS from the closest parent directory
(defun find-file-upwards (file-to-find)
"Recursively searches each parent directory starting from the default-directory.
looking for a file with name file-to-find. Returns the path to it
or nil if not found."
(labels
((find-file-r (path)
(let* ((parent (file-name-directory path))
(possible-file (concat parent file-to-find)))
(cond
((file-exists-p possible-file) possible-file) ; Found
;; The parent of ~ is nil and the parent of / is itself.
;; Thus the terminating condition for not finding the file
;; accounts for both.
((or (null parent) (equal parent (directory-file-name parent))) nil) ; Not found
(t (find-file-r (directory-file-name parent))))))) ; Continue
(find-file-r default-directory)))
(let ((my-tags-file (find-file-upwards "TAGS")))
(when my-tags-file
(message "Loading tags file: %s" my-tags-file)
(visit-tags-table my-tags-file)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; elpa package repository for emacs 24+
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")
Expand Down Expand Up @@ -558,7 +366,8 @@
'(TeX-source-correlate-start-server t)
'(TeX-source-specials-view-editor-flags "-editor \"%cS\" %d && wmctrl -a $(echo %d | sed -e 's/.dvi//g') #")
'(TeX-view-program-list (quote (("Okular" "okular --unique %o#src:%n%b"))))
'(TeX-view-program-selection (quote ((output-pdf "Okular") ((output-dvi style-pstricks) "dvips and gv") (output-dvi "Okular") (output-pdf "Evince") (output-html "xdg-open")))))
'(TeX-view-program-selection (quote ((output-pdf "Okular") ((output-dvi style-pstricks) "dvips and gv") (output-dvi "Okular") (output-pdf "Evince") (output-html "xdg-open"))))
'(send-mail-function (quote mailclient-send-it)))

(add-to-list 'load-path "~/.emacs.d/elpa/auctex-11.87.4/")
(load "auctex.el" nil t t)
Expand Down Expand Up @@ -592,26 +401,19 @@ enabled and the `synctex' binary is available."
(if (string-match "Page:\\([0-9]+\\)" synctex-output)
(match-string 1 synctex-output)
"1")))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Whitespace config
;; display only tails of lines longer than 80 columns, tabs and
;; trailing whitespaces
;; face for long lines' tails
(setq whitespace-line-column 8000)
(setq whitespace-line-column 8000
whitespace-style '(tabs trailing lines-tail))
(setq whitespace-line-column 8000
whitespace-style '(face tabs trailing lines-tail))

;; (setq tex-dvi-view-command "xdvi -editor 'emacsclient -a emacs --no-wait +%l %f'")
;; (eval-after-load "tex"
;; '(progn
;; ;;update the dvi file after each successful compilation
;; (add-to-list 'TeX-output-view-style
;; '("^dvi$" "."
;; "%(o?)xdvi -watchfile 1 %dS %d"))
;; (setq TeX-source-correlate-start-server t
;; TeX-auto-save t
;; TeX-parse-self t
;; reftex-plug-into-AUCTeX t
;; ;; Activate TeX-source-correlate-mode
;; TeX-source-specials-mode t
;; ;; Inverse DVI Search
;; TeX-source-correlate-method 'source-specials)
;; (setq-default TeX-master nil)
;; (add-hook 'LaTeX-mode-hook
;; (lambda
;; (visual-line-mode)
;; (flyspell-mode)
;; (LaTeX-math-mode)
;; (turn-on-reftex)))))
(custom-set-faces
'(whitespace-line ((t (:bold t :background "blue" :foreground "yellow"))))
'(whitespace-tab ((t (:bold t :background "blue" :foreground "yellow"))))
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

0 comments on commit 404b57a

Please sign in to comment.