2012-10-12 22:02:52 +02:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;; MAIN
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
2014-03-08 11:48:35 +01:00
|
|
|
|
;; Minimal UI. Load early to hide as soon as possible.
|
|
|
|
|
(setq inhibit-startup-screen t)
|
|
|
|
|
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
|
|
|
|
|
(menu-bar-mode -1)
|
|
|
|
|
(when (fboundp 'set-scroll-bar-mode)
|
|
|
|
|
(set-scroll-bar-mode 'left)
|
|
|
|
|
(scroll-bar-mode -1)
|
|
|
|
|
(define-key my-keys-minor-mode-map (kbd "C-<f6>") 'toggle-scroll-bar))
|
|
|
|
|
|
2013-06-18 17:14:31 +02:00
|
|
|
|
;; Remember last cursor position.
|
2013-05-31 19:01:32 +02:00
|
|
|
|
(require 'saveplace)
|
|
|
|
|
(setq save-place-file (concat emacs-cache-folder "saveplace"))
|
|
|
|
|
(setq-default save-place t)
|
2014-03-03 21:05:09 +01:00
|
|
|
|
;; When the daemon is killed abruptly, places are not saved. Adding this hook
|
|
|
|
|
;; allows to save places at a strategic moment.
|
|
|
|
|
(add-hook 'before-save-hook 'save-place-kill-emacs-hook)
|
2013-05-31 19:01:32 +02:00
|
|
|
|
|
2014-02-21 20:14:50 +01:00
|
|
|
|
;; Bookmark file to cache folder.
|
|
|
|
|
(setq bookmark-default-file (concat emacs-cache-folder "emacs.bmk"))
|
|
|
|
|
|
2013-06-18 17:14:31 +02:00
|
|
|
|
;; Disable autosave features.
|
2013-05-31 19:01:32 +02:00
|
|
|
|
(setq auto-save-default nil)
|
2013-06-04 20:51:04 +02:00
|
|
|
|
(setq auto-save-list-file-prefix nil)
|
2013-05-31 19:01:32 +02:00
|
|
|
|
|
2013-06-18 17:14:31 +02:00
|
|
|
|
;; Place backup files in specific directory.
|
2013-05-31 19:01:32 +02:00
|
|
|
|
(setq backup-directory-alist
|
2013-07-09 11:25:15 +02:00
|
|
|
|
`((".*" . ,(concat emacs-cache-folder "backups/"))))
|
2013-06-05 22:21:40 +02:00
|
|
|
|
|
2013-06-12 22:56:30 +02:00
|
|
|
|
;; Other backup options.
|
2013-06-05 22:21:40 +02:00
|
|
|
|
; (setq backup-inhibited t) ;; Disable backup files.
|
|
|
|
|
; (setq make-backup-files t) ;; Enable backup files.
|
|
|
|
|
; (setq version-control t) ;; Enable numbered versioning.
|
2013-05-31 19:01:32 +02:00
|
|
|
|
|
2013-02-28 22:09:31 +01:00
|
|
|
|
;; Default mode
|
|
|
|
|
(setq default-major-mode 'text-mode)
|
|
|
|
|
|
2013-06-18 17:14:31 +02:00
|
|
|
|
;; Disable suspend key since it is useless on Emacs server.
|
2013-06-12 17:05:10 +02:00
|
|
|
|
(global-unset-key (kbd "C-z"))
|
|
|
|
|
(global-unset-key (kbd "C-x C-z"))
|
|
|
|
|
|
2013-03-04 17:31:57 +01:00
|
|
|
|
;; Make questions less annoying.
|
2013-01-10 17:33:33 +01:00
|
|
|
|
(defalias 'yes-or-no-p 'y-or-n-p)
|
2012-10-12 15:23:36 +02:00
|
|
|
|
|
2013-10-20 18:19:19 +02:00
|
|
|
|
;; Allow some protected functions.
|
|
|
|
|
(put 'upcase-region 'disabled nil)
|
|
|
|
|
(put 'downcase-region 'disabled nil)
|
2014-02-23 13:54:39 +01:00
|
|
|
|
(put 'narrow-to-page 'disabled nil)
|
2013-10-20 18:19:19 +02:00
|
|
|
|
|
2013-06-27 17:06:07 +02:00
|
|
|
|
;; Print column number in mode line.
|
2013-01-10 17:33:33 +01:00
|
|
|
|
(column-number-mode 1)
|
2012-10-12 15:23:36 +02:00
|
|
|
|
|
2013-06-27 17:06:07 +02:00
|
|
|
|
;; Print buffer size in mode line.
|
|
|
|
|
(size-indication-mode 1)
|
|
|
|
|
|
2013-03-04 17:31:57 +01:00
|
|
|
|
;; Kill whole line including \n.
|
2013-01-10 17:33:33 +01:00
|
|
|
|
(setq kill-whole-line t)
|
2012-10-12 15:23:36 +02:00
|
|
|
|
|
2013-02-26 12:04:44 +01:00
|
|
|
|
;; Alternative scrolling
|
2013-02-04 21:32:40 +01:00
|
|
|
|
(define-key my-keys-minor-mode-map [next]
|
|
|
|
|
(lambda () (interactive)
|
2013-09-30 19:42:07 +02:00
|
|
|
|
(if (string= major-mode "doc-view-mode")
|
|
|
|
|
(doc-view-next-page)
|
|
|
|
|
(condition-case nil (scroll-up)
|
|
|
|
|
(end-of-buffer (goto-char (point-max)))))))
|
2012-10-12 15:23:36 +02:00
|
|
|
|
|
2013-02-04 21:32:40 +01:00
|
|
|
|
(define-key my-keys-minor-mode-map [prior]
|
|
|
|
|
(lambda () (interactive)
|
2013-09-30 19:42:07 +02:00
|
|
|
|
(if (string= major-mode "doc-view-mode")
|
|
|
|
|
(doc-view-previous-page)
|
|
|
|
|
(condition-case nil (scroll-down)
|
|
|
|
|
(beginning-of-buffer (goto-char (point-min)))))))
|
2012-10-12 15:23:36 +02:00
|
|
|
|
|
2014-02-23 13:54:39 +01:00
|
|
|
|
(define-key my-keys-minor-mode-map (kbd "C-x M-n") (lambda () (interactive) (narrow-to-page 1)))
|
|
|
|
|
(define-key my-keys-minor-mode-map (kbd "C-x M-p") (lambda () (interactive) (narrow-to-page -1)))
|
|
|
|
|
|
2012-10-12 15:23:36 +02:00
|
|
|
|
;; Line numbers
|
2014-02-10 19:14:56 +01:00
|
|
|
|
;; TODO: This mode is slow on big files when using beginning-of-buffer binding.
|
2013-05-24 11:44:23 +02:00
|
|
|
|
(add-hook 'find-file-hook (lambda () (linum-mode 1)))
|
2013-06-16 12:52:09 +02:00
|
|
|
|
(define-key my-keys-minor-mode-map (kbd "C-<f5>") 'linum-mode)
|
|
|
|
|
(add-hook
|
2013-06-17 11:12:18 +02:00
|
|
|
|
'linum-before-numbering-hook
|
|
|
|
|
(lambda () (if (display-graphic-p) (setq linum-format "%d") (setq linum-format "%d "))))
|
2012-10-12 15:23:36 +02:00
|
|
|
|
|
|
|
|
|
;; Indentation
|
2013-02-27 22:35:16 +01:00
|
|
|
|
(setq-default tab-width 4)
|
2013-06-06 17:29:18 +02:00
|
|
|
|
(setq-default standard-indent 4)
|
2013-01-10 17:33:33 +01:00
|
|
|
|
(setq-default indent-tabs-mode nil) ;; Indentation cannot insert tabs
|
2012-10-12 15:23:36 +02:00
|
|
|
|
|
|
|
|
|
;; Line by line scrolling
|
|
|
|
|
(setq scroll-step 1)
|
|
|
|
|
|
2014-02-23 13:54:39 +01:00
|
|
|
|
;; Useful of autofill.
|
|
|
|
|
(setq sentence-end-double-space nil)
|
|
|
|
|
|
2013-06-18 17:14:31 +02:00
|
|
|
|
;; Highlight selections -- not activated by default on old Emacs.
|
2012-10-12 15:23:36 +02:00
|
|
|
|
(transient-mark-mode 1)
|
|
|
|
|
|
2014-02-10 19:14:56 +01:00
|
|
|
|
;; Whitespace, tabs, and other frivolities. Highlight trailing whitespaces. For
|
|
|
|
|
;; programming languages only, so that it does not affect buffer like calendar
|
|
|
|
|
;; and so on. There is no prog-mode-hook on Emacs<24.
|
2014-02-24 19:55:25 +01:00
|
|
|
|
(require 'functions) ; for page-number-mode
|
2013-03-08 15:46:03 +01:00
|
|
|
|
(mapcar
|
|
|
|
|
(lambda (mode-hook)
|
|
|
|
|
(add-hook
|
|
|
|
|
mode-hook
|
2014-01-09 11:53:09 +01:00
|
|
|
|
(lambda ()
|
2014-02-24 19:55:25 +01:00
|
|
|
|
(page-number-mode t)
|
2014-03-05 10:58:42 +01:00
|
|
|
|
(when (fboundp 'guess-style-guess-all)
|
|
|
|
|
(guess-style-guess-all))
|
2014-01-09 11:53:09 +01:00
|
|
|
|
(whitespace-mode))))
|
2013-03-08 15:46:03 +01:00
|
|
|
|
'(prog-mode-hook lua-mode-hook))
|
2014-03-05 10:58:42 +01:00
|
|
|
|
|
2014-01-09 11:53:09 +01:00
|
|
|
|
;; WARNING: this can break some configuration files needing whitespaces at the
|
|
|
|
|
;; end.
|
|
|
|
|
; (add-hook 'before-save-hook 'delete-trailing-whitespace)
|
2014-01-09 14:51:36 +01:00
|
|
|
|
(setq whitespace-style (quote (face trailing tab-mark)))
|
2014-03-05 11:24:38 +01:00
|
|
|
|
;; TODO: whitespace report-on-bogus and cleanup do not seem to work properly.
|
|
|
|
|
;; Empty lines seems to be always true. Report is shown even when style is not
|
|
|
|
|
;; matching the errors.
|
2014-01-09 11:53:09 +01:00
|
|
|
|
; (setq whitespace-action '(report-on-bogus))
|
2013-03-08 15:46:03 +01:00
|
|
|
|
|
|
|
|
|
;; Remove whitespaces on region, or whole file.
|
|
|
|
|
(define-key my-keys-minor-mode-map (kbd "C-\\") 'delete-trailing-whitespace)
|
|
|
|
|
|
2014-02-21 20:41:11 +01:00
|
|
|
|
;; Hippie expand.
|
|
|
|
|
(define-key my-keys-minor-mode-map (kbd "M-/") 'hippie-expand)
|
|
|
|
|
|
2012-10-12 15:23:36 +02:00
|
|
|
|
;; Abbreviation support
|
2014-02-13 17:30:36 +01:00
|
|
|
|
(setq-default abbrev-mode t)
|
2012-10-12 15:23:36 +02:00
|
|
|
|
|
|
|
|
|
;; Set Fill Column
|
|
|
|
|
(setq-default fill-column 80)
|
|
|
|
|
(add-hook 'text-mode-hook 'turn-on-auto-fill)
|
|
|
|
|
|
2013-09-30 19:11:22 +02:00
|
|
|
|
;; Set man pages to display on a 80 character wide window.
|
2012-10-12 15:23:36 +02:00
|
|
|
|
(setenv "MANWIDTH" "80")
|
|
|
|
|
|
2013-06-18 17:14:31 +02:00
|
|
|
|
;; Windmove mode: easy window switching with Shift+arrows.
|
2012-10-12 15:23:36 +02:00
|
|
|
|
(when (fboundp 'windmove-default-keybindings)
|
|
|
|
|
(windmove-default-keybindings))
|
|
|
|
|
|
2013-06-18 17:14:31 +02:00
|
|
|
|
;; Make Emacs use environment browser, or w3m if BROWSER is not set.
|
2013-02-26 18:30:31 +01:00
|
|
|
|
(setq browse-url-generic-program
|
|
|
|
|
(executable-find
|
|
|
|
|
(let ((b (getenv "BROWSER")))
|
|
|
|
|
(if b b "w3m" )))
|
|
|
|
|
browse-url-browser-function 'browse-url-generic)
|
2013-07-27 18:00:52 +02:00
|
|
|
|
(define-key my-keys-minor-mode-map (kbd "C-M-u") 'browse-url)
|
2012-11-13 18:46:20 +01:00
|
|
|
|
|
2014-03-05 10:58:42 +01:00
|
|
|
|
;; Default ispell dictionnay. If not set, Emacs uses the current locale.
|
|
|
|
|
(setq ispell-dictionary "en")
|
2013-02-26 18:30:31 +01:00
|
|
|
|
(define-key my-keys-minor-mode-map
|
2014-02-21 15:23:25 +01:00
|
|
|
|
(kbd "<f5>")
|
2013-02-26 18:30:31 +01:00
|
|
|
|
(lambda () (interactive) (ispell-change-dictionary "en")))
|
|
|
|
|
(define-key my-keys-minor-mode-map
|
2014-02-21 15:23:25 +01:00
|
|
|
|
(kbd "<f6>")
|
2013-02-26 18:30:31 +01:00
|
|
|
|
(lambda () (interactive) (ispell-change-dictionary "fr")))
|
2014-02-21 15:23:25 +01:00
|
|
|
|
(define-key my-keys-minor-mode-map
|
|
|
|
|
(kbd "<f7>")
|
|
|
|
|
(lambda () (interactive) (ispell-change-dictionary "sv")))
|
2012-12-21 21:30:54 +01:00
|
|
|
|
|
2013-01-08 00:36:02 +01:00
|
|
|
|
;; Long paragraphs. Useful for quick navigation with backward-paragraph and
|
|
|
|
|
;; forward-paragraph.
|
|
|
|
|
(setq paragraph-start "
|
|
|
|
|
")
|
2013-01-10 15:57:07 +01:00
|
|
|
|
|
|
|
|
|
;; Show matching parenthesis
|
|
|
|
|
(show-paren-mode 1)
|
|
|
|
|
;; By default, there’s a small delay before showing a matching parenthesis. Set
|
|
|
|
|
;; it to 0 to deactivate.
|
|
|
|
|
(setq show-paren-delay 0)
|
|
|
|
|
|
2013-01-23 14:59:25 +01:00
|
|
|
|
;; query-replace-regex fix on terminals.
|
2013-05-25 13:43:22 +02:00
|
|
|
|
(if (not (fboundp 'tool-bar-mode)) (define-key my-keys-minor-mode-map (kbd "C-M-y") 'query-replace-regexp))
|
2013-02-27 18:44:46 +01:00
|
|
|
|
|
2013-05-31 19:01:32 +02:00
|
|
|
|
;; Semantic options.
|
2014-02-20 14:06:47 +01:00
|
|
|
|
(semantic-mode 0)
|
2013-06-04 15:33:36 +02:00
|
|
|
|
(setq semanticdb-default-save-directory (concat emacs-cache-folder "semanticdb"))
|
2013-02-27 18:44:46 +01:00
|
|
|
|
(define-key my-keys-minor-mode-map (kbd "C-c , d") 'semantic-ia-show-summary)
|
2013-06-06 14:11:52 +02:00
|
|
|
|
(define-key my-keys-minor-mode-map (kbd "C-, d") 'semantic-ia-show-summary)
|
|
|
|
|
(define-key my-keys-minor-mode-map (kbd "C-, g") 'semantic-symref-symbol)
|
|
|
|
|
(define-key my-keys-minor-mode-map (kbd "C-, G") 'semantic-symref)
|
|
|
|
|
(define-key my-keys-minor-mode-map (kbd "C-, j") 'semantic-complete-jump-local)
|
|
|
|
|
(define-key my-keys-minor-mode-map (kbd "C-, J") 'semantic-complete-jump)
|
|
|
|
|
(define-key my-keys-minor-mode-map (kbd "C-, l") 'semantic-analyze-possible-completions)
|
2013-06-12 22:56:30 +02:00
|
|
|
|
;; Semantic with ghost display (allows M-n and M-p to browse completion).
|
2013-05-27 20:36:12 +02:00
|
|
|
|
;; (setq semantic-complete-inline-analyzer-displayor-class 'semantic-displayor-ghost)
|
2013-05-29 17:41:15 +02:00
|
|
|
|
;; (setq semantic-complete-inline-analyzer-displayor-class 'semantic-displayor-tooltip)
|
2013-05-27 20:36:12 +02:00
|
|
|
|
;; (setq semanticdb-find-default-throttle '(project unloaded system recursive))
|
2013-02-27 18:44:46 +01:00
|
|
|
|
|
2013-03-01 16:43:21 +01:00
|
|
|
|
;; Electric Pairs to auto-complete () [] {} "" etc. You can use it on regions.
|
2013-07-02 21:42:05 +02:00
|
|
|
|
(if (>= emacs-major-version 24)
|
2013-05-22 17:35:54 +02:00
|
|
|
|
(electric-pair-mode 1))
|
2013-02-27 22:35:16 +01:00
|
|
|
|
|
|
|
|
|
;; Run ranger asynchronously.
|
|
|
|
|
(define-key my-keys-minor-mode-map (kbd "C-x D")
|
2013-03-01 16:43:21 +01:00
|
|
|
|
(lambda () (interactive)
|
2014-03-05 11:14:16 +01:00
|
|
|
|
(let ((term (getenv "TERMCMD")))
|
|
|
|
|
(when (and (executable-find "ranger") (executable-find term))
|
|
|
|
|
(start-process "dummy" nil term "-e" "ranger")))))
|
2013-02-27 22:35:16 +01:00
|
|
|
|
|
2013-03-01 16:43:21 +01:00
|
|
|
|
;; Calendar ISO display.
|
2013-02-27 22:35:16 +01:00
|
|
|
|
(setq calendar-week-start-day 1)
|
|
|
|
|
(setq calendar-date-style 'iso)
|
2013-02-28 22:09:31 +01:00
|
|
|
|
|
2013-06-12 00:48:21 +02:00
|
|
|
|
;; IDO (Interactively Do Thing) for finding files and buffers. Incompatible with
|
|
|
|
|
;; FFAP.
|
2013-03-01 16:43:21 +01:00
|
|
|
|
(require 'ido)
|
|
|
|
|
(ido-mode t)
|
|
|
|
|
(setq ido-enable-flex-matching t)
|
2013-06-27 00:36:18 +02:00
|
|
|
|
(setq ido-save-directory-list-file (concat emacs-cache-folder "ido.last"))
|
2013-06-12 00:48:21 +02:00
|
|
|
|
;; All file finding operation defaults to what is at point. Incompatible with
|
2013-06-18 17:14:31 +02:00
|
|
|
|
;; IDO.
|
|
|
|
|
;; (ffap-bindings)
|
2013-03-01 16:43:21 +01:00
|
|
|
|
|
2014-02-23 14:38:38 +01:00
|
|
|
|
;; Icomplete
|
|
|
|
|
(icomplete-mode)
|
|
|
|
|
|
2013-03-01 16:43:21 +01:00
|
|
|
|
;; Quick buffer switching.
|
|
|
|
|
(define-key my-keys-minor-mode-map (kbd "C-<prior>") 'previous-buffer)
|
|
|
|
|
(define-key my-keys-minor-mode-map (kbd "C-<next>") 'next-buffer)
|
|
|
|
|
|
|
|
|
|
;; Do not open other window for buffer menu, plus hide non-file buffers.
|
|
|
|
|
(define-key my-keys-minor-mode-map (kbd "C-x C-b")
|
|
|
|
|
(lambda () (interactive)
|
|
|
|
|
(buffer-menu 1)))
|
2013-03-01 19:06:47 +01:00
|
|
|
|
|
2013-06-16 11:53:07 +02:00
|
|
|
|
;; Remove auto-fill in dwb edit because wikis and forums do not like it.
|
2013-06-05 17:50:15 +02:00
|
|
|
|
(add-hook
|
|
|
|
|
'find-file-hook
|
|
|
|
|
(lambda ()
|
|
|
|
|
(if (string-match "edit*" (buffer-name))
|
|
|
|
|
(auto-fill-mode -1))))
|
|
|
|
|
|
2013-06-07 15:09:28 +02:00
|
|
|
|
;; Speedbar options.
|
|
|
|
|
(add-hook
|
|
|
|
|
'speedbar-mode-hook
|
|
|
|
|
(lambda ()
|
2013-06-07 20:24:05 +02:00
|
|
|
|
(speedbar-toggle-updates)))
|
2013-06-12 00:48:21 +02:00
|
|
|
|
|
2013-09-30 19:59:13 +02:00
|
|
|
|
;; Compilation bindings and conveniences.
|
2013-07-04 10:37:18 +02:00
|
|
|
|
(setq compilation-hide-window nil)
|
|
|
|
|
(define-key my-keys-minor-mode-map (kbd "<f10>")
|
|
|
|
|
(lambda () (interactive)
|
|
|
|
|
(save-buffer)
|
|
|
|
|
(compile compile-command)
|
|
|
|
|
(when compilation-hide-window
|
|
|
|
|
(sit-for 2)
|
|
|
|
|
(delete-windows-on "*compilation*"))))
|
2013-06-12 17:05:10 +02:00
|
|
|
|
(define-key my-keys-minor-mode-map (kbd "<f11>") 'previous-error)
|
2013-07-03 14:34:48 +02:00
|
|
|
|
(define-key my-keys-minor-mode-map (kbd "<f12>") 'next-error)
|
2013-09-30 19:59:13 +02:00
|
|
|
|
;; Code browsing: make C-M-e jump to next function instead of the end of the current function.
|
2013-07-09 10:57:02 +02:00
|
|
|
|
(define-key my-keys-minor-mode-map (kbd "C-M-e") (lambda () (interactive) (beginning-of-defun -1)))
|
2013-06-12 17:05:10 +02:00
|
|
|
|
|
2013-06-12 23:40:20 +02:00
|
|
|
|
;; Just because XML is ugly.
|
2013-06-16 11:53:07 +02:00
|
|
|
|
(add-hook
|
|
|
|
|
'html-mode-hook
|
|
|
|
|
(lambda ()
|
|
|
|
|
(turn-off-auto-fill)
|
|
|
|
|
(toggle-truncate-lines)))
|
2013-06-12 23:40:20 +02:00
|
|
|
|
|
|
|
|
|
;; Common LISP
|
|
|
|
|
(setq inferior-lisp-program "clisp")
|
|
|
|
|
|
2013-06-16 11:53:07 +02:00
|
|
|
|
;; Let Emacs auto-load/save sessions.
|
2013-06-16 16:57:23 +02:00
|
|
|
|
(when (boundp 'server-running-p)
|
|
|
|
|
(desktop-save-mode 1)
|
|
|
|
|
(setq history-length 250)
|
|
|
|
|
(setq desktop-dirname (concat emacs-cache-folder "desktop"))
|
|
|
|
|
(if (not (file-directory-p desktop-dirname))
|
|
|
|
|
(make-directory desktop-dirname t))
|
|
|
|
|
(setq desktop-path `(,desktop-dirname))
|
|
|
|
|
(add-to-list 'desktop-globals-to-save 'compile-command))
|
|
|
|
|
|
2014-02-21 20:14:50 +01:00
|
|
|
|
;; GMP documentation
|
2013-11-11 13:51:16 +01:00
|
|
|
|
(eval-after-load "info-look"
|
|
|
|
|
'(let ((mode-value (assoc 'c-mode (assoc 'symbol info-lookup-alist))))
|
|
|
|
|
(setcar (nthcdr 3 mode-value)
|
|
|
|
|
(cons '("(gmp)Function Index" nil "^ -.* " "\\>")
|
|
|
|
|
(nth 3 mode-value)))))
|
|
|
|
|
|
2014-02-21 20:14:50 +01:00
|
|
|
|
(require 'uniquify)
|
|
|
|
|
(setq uniquify-buffer-name-style 'forward)
|
2013-07-04 10:37:18 +02:00
|
|
|
|
|
2014-02-21 20:43:40 +01:00
|
|
|
|
;; Alternate focus.
|
|
|
|
|
(add-hook 'occur-hook (lambda () (pop-to-buffer occur-buf)))
|
2014-02-22 19:13:19 +01:00
|
|
|
|
;; (add-hook 'help-mode-hook (lambda () (pop-to-buffer (get-buffer "*Help*"))))
|
2014-02-21 20:43:40 +01:00
|
|
|
|
(add-hook 'grep-mode-hook (lambda () (pop-to-buffer (get-buffer "*grep*"))))
|
|
|
|
|
|
2014-02-12 18:31:00 +01:00
|
|
|
|
;; Disable prompt (but leave warning) on git symlink.
|
|
|
|
|
(setq vc-follow-symlinks t)
|
|
|
|
|
|
|
|
|
|
;; Git commit meessages.
|
|
|
|
|
(add-to-list 'auto-mode-alist '("COMMIT_EDITMSG\\'" . conf-mode))
|
|
|
|
|
|
2013-07-09 10:57:02 +02:00
|
|
|
|
;; Mutt support.
|
|
|
|
|
(add-to-list 'auto-mode-alist '("/tmp/mutt.*" . mail-mode))
|
|
|
|
|
|
|
|
|
|
;; Arch Linux PKGBUILD.
|
|
|
|
|
(add-to-list 'auto-mode-alist '("PKGBUILD" . sh-mode))
|
|
|
|
|
|
2013-10-07 20:01:45 +02:00
|
|
|
|
;; Shell extensions. We do not put 'sh' only because it could get messy. Emacs
|
|
|
|
|
;; knows it anyway.
|
|
|
|
|
(add-to-list 'auto-mode-alist '("\\(bash\\'\\|zsh\\'\\|csh\\'\\|tcsh\\'\\|ksh\\'\\)" . sh-mode))
|
|
|
|
|
(add-to-list 'auto-mode-alist '("rc\\'" . sh-mode))
|
|
|
|
|
|
2013-07-09 10:57:02 +02:00
|
|
|
|
;; Subtitles support.
|
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.srt\\'" . text-mode))
|
2014-02-12 18:49:41 +01:00
|
|
|
|
|
|
|
|
|
;; Read Matlab files in Octave mode.
|
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.m\\'" . octave-mode))
|
2014-02-21 20:41:11 +01:00
|
|
|
|
|
2014-03-08 11:48:35 +01:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
(provide 'main)
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
2014-02-21 20:41:11 +01:00
|
|
|
|
;; This may be needed for gud/pdb.
|
|
|
|
|
; (defadvice pop-to-buffer (before cancel-other-window first)
|
|
|
|
|
; (ad-set-arg 1 nil))
|
|
|
|
|
; (ad-activate 'pop-to-buffer)
|
|
|
|
|
|
|
|
|
|
;; Use color escape sequences. Only use if needed.
|
|
|
|
|
; (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
|
|
|
|
|
|
|
|
|
|
;; Flymake has a bug that prevents menu from spawning in a console. We redefine
|
|
|
|
|
;; the function to spawn the error message in the mini-buffer.
|
|
|
|
|
; (defun flymake-display-err-message-for-current-line ()
|
|
|
|
|
; "Display a message with errors/warnings for current line if it
|
|
|
|
|
; has errors and/or warnings."
|
|
|
|
|
; (interactive)
|
|
|
|
|
; (let* ((line-no (flymake-current-line-no))
|
|
|
|
|
; (line-err-info-list (nth 0 (flymake-find-err-info flymake-err-info line-no)))
|
|
|
|
|
; (menu-data (flymake-make-err-menu-data line-no line-err-info-list)))
|
|
|
|
|
; (if menu-data
|
|
|
|
|
; (let ((messages))
|
|
|
|
|
; (push (concat (car menu-data) ":") messages)
|
|
|
|
|
; (dolist (error-or-warning (cadr menu-data))
|
|
|
|
|
; (push (car error-or-warning) messages))
|
|
|
|
|
; (message "%s" (mapconcat #'identity (reverse messages) "\n"))))))
|
|
|
|
|
; (define-key my-keys-minor-mode-map (kbd "C-<f10>")
|
|
|
|
|
; 'flymake-display-err-message-for-current-line)
|