115 lines
3.9 KiB
EmacsLisp
115 lines
3.9 KiB
EmacsLisp
;; Remove useless features
|
|
(menu-bar-mode nil)
|
|
;(tool-bar-mode nil)
|
|
;(scroll-bar-mode nil)
|
|
(setq inhibit-startup-message t)
|
|
|
|
;;Save backup files into a specific directory, not in the working directry
|
|
(defun make-backup-file-name (file)
|
|
(concat "~/.emacs.d/backup/" (file-name-nondirectory file) "~"))
|
|
|
|
;; Enable some minor mode changing mode line
|
|
(column-number-mode t) ; Show column number
|
|
(line-number-mode t) ; Show line number
|
|
(display-time-mode t) ; A clock in the mode line
|
|
|
|
;; Show matching parentheses
|
|
(show-paren-mode t)
|
|
(defadvice show-paren-function
|
|
(after show-matching-paren-offscreen activate)
|
|
"If the matching paren is offscreen, show the matching line in the
|
|
echo area. Has no effect if the character before point is not of
|
|
the syntax class ')'."
|
|
(interactive)
|
|
(if (not (minibuffer-prompt))
|
|
(let ((matching-text nil))
|
|
;; Only call `blink-matching-open' if the character before point
|
|
;; is a close parentheses type character. Otherwise, there's not
|
|
;; really any point, and `blink-matching-open' would just echo
|
|
;; "Mismatched parentheses", which gets really annoying.
|
|
(if (char-equal (char-syntax (char-before (point))) ?\))
|
|
(setq matching-text (blink-matching-open)))
|
|
(if (not (null matching-text))
|
|
(message matching-text)))))
|
|
|
|
;; Enable usefull modes
|
|
(global-font-lock-mode t) ; syntax highlighting
|
|
(setq font-lock-maximum-decoration t) ; max decoration for all modes
|
|
(auto-compression-mode t) ; Auto decompress compressed files.
|
|
(setq set-mark-command-repeat-pop t)
|
|
(autoload 'nuke-trailing-whitespace "whitespace" nil t)
|
|
(setq delete-old-versions t) ; delete oldversion file
|
|
(setq default-major-mode 'text-mode) ; change default major mode to text
|
|
(global-auto-revert-mode t) ; auto revert modified files
|
|
(dynamic-completion-mode) ; dynamic completion
|
|
|
|
;; setting for auto-close brackets for electric-pair-mode regardless of current major mode syntax table
|
|
(electric-pair-mode t)
|
|
(setq electric-pair-pairs '(
|
|
(?\" . ?\")
|
|
(?\{ . ?\})
|
|
) )
|
|
|
|
;; In linux, make copy/paste work with other apps
|
|
(setq x-select-enable-clipboard t)
|
|
|
|
;; Compilation window
|
|
(setq compilation-window-height 14)
|
|
(setq compilation-scroll-output t)
|
|
|
|
(require 'uniquify)
|
|
(setq uniquify-buffer-name-style 'post-forward-angle-brackets)
|
|
|
|
(setq-default ispell-program-name "aspell")
|
|
|
|
;; GDB use all existing window
|
|
(setq-default gdb-many-windows t)
|
|
|
|
;; Recognize test suite output
|
|
(require 'compile)
|
|
(add-to-list 'compilation-error-regexp-alist '("^\\(PASS\\|SKIP\\|XFAIL\\|TFAIL\\): \\(.*\\)$" 2 () () 0 2))
|
|
(add-to-list 'compilation-error-regexp-alist '("^\\(FAIL\\|XPASS\\): \\(.*\\)$" 2 () () 2 2))
|
|
|
|
(require 'flymake)
|
|
(add-hook 'find-file-hooks 'flymake-find-file-hook)
|
|
|
|
;;IswitchBuffer configuration
|
|
(iswitchb-mode t)
|
|
(setq iswitchb-buffer-ignore '("^\\*"))
|
|
(defun iswitchb-local-keys ()
|
|
(mapc (lambda (K)
|
|
(let* ((key (car K)) (fun (cdr K)))
|
|
(define-key iswitchb-mode-map (edmacro-parse-keys key) fun)))
|
|
'(("<right>" . iswitchb-next-match)
|
|
("<left>" . iswitchb-prev-match)
|
|
("<up>" . ignore )
|
|
("<down>" . ignore ))))
|
|
(add-hook 'iswitchb-define-mode-map-hook 'iswitchb-local-keys)
|
|
|
|
;; Save and restore window layout
|
|
(defvar winconf-ring ())
|
|
|
|
(defun push-winconf ()
|
|
(interactive)
|
|
(window-configuration-to-register ?%)
|
|
(push (get-register ?%) winconf-ring))
|
|
|
|
(defun pop-winconf ()
|
|
(interactive)
|
|
(set-register ?% (pop winconf-ring))
|
|
(jump-to-register ?%))
|
|
|
|
(defun restore-winconf ()
|
|
(interactive)
|
|
(set-register ?% (car winconf-ring))
|
|
(jump-to-register ?%))
|
|
|
|
;; highlight when > 80 cols
|
|
(defun eightycols nil
|
|
(defface line-overflow
|
|
'((t (:background "red" :foreground "black")))
|
|
"Face to use for `hl-line-face'.")
|
|
(highlight-regexp "^.\\{80,\\}$" 'line-overflow)
|
|
)
|
|
;(add-hook 'find-file-hook 'eightycols)
|