Emacs: Move local-set-key out of mode hooks
parent
c9ab8f8948
commit
4266865c4d
|
@ -1,15 +1,12 @@
|
|||
;; BBcode
|
||||
|
||||
; For new tags use `bbcode/make-key-binding'.
|
||||
(local-set-key (kbd "M-RET") 'bbcode/insert-tag-*)
|
||||
|
||||
(add-hook-and-eval
|
||||
'bbcode-mode-hook
|
||||
(lambda ()
|
||||
(local-set-key (kbd "C-c C-b") 'bbcode/insert-tag-b)
|
||||
(local-set-key (kbd "C-c C-u") 'bbcode/insert-tag-url)
|
||||
(local-set-key (kbd "C-c C-i") 'bbcode/insert-tag-i)
|
||||
(font-lock-add-keywords nil `((,(bbcode/make-tag-regex "h") . 'font-lock-builtin-face)))
|
||||
(font-lock-add-keywords nil `((,(bbcode/make-tag-regex "\\*") . 'font-lock-string-face)))))
|
||||
|
||||
(bbcode/make-key-binding "M-RET" "*")
|
||||
(bbcode/make-key-binding "C-c C-h" "h")
|
||||
|
||||
(provide 'mode-bbcode)
|
||||
|
|
|
@ -1,6 +1,17 @@
|
|||
;; C/C++
|
||||
|
||||
;; Should we split this in mode-c and mode-c++?
|
||||
;; Should we split this into mode-c and mode-c++?
|
||||
|
||||
(local-set-key (kbd "C-c m") 'cc-main)
|
||||
(local-set-key (kbd "<f9>") 'cc-clean)
|
||||
(local-set-key (kbd "M-.") 'semantic-ia-fast-jump)
|
||||
(local-set-key (kbd "C-c C-d") 'semantic-ia-show-summary)
|
||||
(local-set-key (kbd "M-TAB") 'semantic-complete-analyze-inline)
|
||||
(local-set-key (kbd "C-c o") 'ff-find-other-file)
|
||||
(local-set-key (kbd "C-M-e") (lambda () (interactive) (c-beginning-of-defun -1)))
|
||||
|
||||
(when (fboundp 'company-mode)
|
||||
(local-set-key (kbd "M-TAB") (if (require 'company nil t) 'helm-company 'company-complete)))
|
||||
|
||||
(defvar-local cc-ldlibs "-lm -pthread"
|
||||
"Custom linker flags for C/C++ linkage.")
|
||||
|
@ -114,22 +125,9 @@ restored."
|
|||
mode-hook
|
||||
(lambda ()
|
||||
(c-set-style "ambrevar") ;; We override existing values.
|
||||
(cc-set-compiler)
|
||||
(local-set-key (kbd "<f9>") 'cc-clean)
|
||||
(local-set-key (kbd "M-.") 'semantic-ia-fast-jump)
|
||||
(local-set-key (kbd "C-c C-d") 'semantic-ia-show-summary)
|
||||
(local-set-key (kbd "M-TAB") 'semantic-complete-analyze-inline)
|
||||
(when (fboundp 'company-mode)
|
||||
(company-mode)
|
||||
(if (fboundp 'helm-company)
|
||||
(local-set-key (kbd "M-TAB") 'helm-company)
|
||||
(local-set-key (kbd "M-TAB") 'company-complete)))
|
||||
(local-set-key (kbd "C-c o") 'ff-find-other-file)
|
||||
(local-set-key (kbd "C-c m") 'cc-main)
|
||||
;; The cc-fmt hook is disable since there is no standard C formatting,
|
||||
;; unlike for Go.
|
||||
; (add-hook 'before-save-hook 'cc-fmt nil t)
|
||||
(local-set-key (kbd "C-M-e") (lambda () (interactive) (c-beginning-of-defun -1))))))
|
||||
(when (require 'company nil t)
|
||||
(company-mode))
|
||||
(cc-set-compiler))))
|
||||
'(c-mode-hook c++-mode-hook))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
;; Dired
|
||||
|
||||
(local-set-key (kbd "C-c h") 'dired-toggle-humansize)
|
||||
(local-set-key (kbd "<left>") 'dired-up-directory)
|
||||
(local-set-key (kbd "<right>") 'dired-find-file)
|
||||
(local-set-key (kbd "SPC") 'dired-mark)
|
||||
(local-set-key (kbd "<backspace>") 'dired-up-directory)
|
||||
(local-set-key (kbd "b") 'dired-up-directory)
|
||||
|
||||
;; On a GNU system, ls has the option to sort folders first.
|
||||
(if (string-match "^gnu.*" (prin1-to-string system-type))
|
||||
(setq dired-listing-switches "--group-directories-first -lha")
|
||||
|
@ -53,11 +60,4 @@
|
|||
(setq dired-showing-humansize t))))
|
||||
(revert-buffer))
|
||||
|
||||
(local-set-key (kbd "C-c h") 'dired-toggle-humansize)
|
||||
(local-set-key (kbd "<left>") 'dired-up-directory)
|
||||
(local-set-key (kbd "<right>") 'dired-find-file)
|
||||
(local-set-key (kbd "SPC") 'dired-mark)
|
||||
(local-set-key (kbd "<backspace>") 'dired-up-directory)
|
||||
(local-set-key (kbd "b") 'dired-up-directory)
|
||||
|
||||
(provide 'mode-dired)
|
||||
|
|
|
@ -1,5 +1,23 @@
|
|||
;; Go
|
||||
|
||||
;; TODO: Report missing `use-local-map` upstream.
|
||||
;; https://github.com/dominikh/go-mode.el/issues/191
|
||||
(use-local-map go-mode-map)
|
||||
|
||||
(local-set-key (kbd "C-c m") 'go-main)
|
||||
(local-set-key (kbd "C-c D") 'godoc)
|
||||
(when (require 'helm-go-package nil t)
|
||||
(local-set-key (kbd "C-c D") 'helm-go-package))
|
||||
(local-set-key (kbd "C-c d") 'godoc-at-point)
|
||||
(local-set-key (kbd "M-.") #'godef-jump)
|
||||
(local-set-key (kbd "<f9>") 'go-metalinter)
|
||||
(local-set-key (kbd "C-<f9>") (lambda () (interactive) (go-metalinter t)))
|
||||
|
||||
(when (require 'company-go nil t)
|
||||
(add-hook-and-eval 'go-mode-hook 'company-mode)
|
||||
(add-to-list 'company-backends 'company-go)
|
||||
(local-set-key (kbd "M-TAB") (if (require 'company nil t) 'helm-company 'company-complete)))
|
||||
|
||||
(setq gofmt-command "goimports")
|
||||
(setq godoc-command "godoc -ex")
|
||||
(setq godoc-and-godef-command "godoc -ex")
|
||||
|
@ -74,20 +92,6 @@ Note that the -cover test flag is left out since it shifts line numbers."
|
|||
(add-hook 'before-save-hook #'gofmt-before-save nil t)
|
||||
(when (require 'go-eldoc nil t)
|
||||
(go-eldoc-setup))
|
||||
(when (require 'company-go nil t)
|
||||
(add-to-list 'company-backends 'company-go)
|
||||
(company-mode)
|
||||
(if (fboundp 'helm-company)
|
||||
(local-set-key (kbd "M-TAB") 'helm-company)
|
||||
(local-set-key (kbd "M-TAB") 'company-complete)))
|
||||
(local-set-key (kbd "C-c m") 'go-main)
|
||||
(local-set-key (kbd "C-c D") 'godoc)
|
||||
(when (require 'helm-go-package nil t)
|
||||
(local-set-key (kbd "C-c D") 'helm-go-package))
|
||||
(local-set-key (kbd "C-c d") 'godoc-at-point)
|
||||
(local-set-key (kbd "M-.") #'godef-jump)
|
||||
(local-set-key (kbd "<f9>") 'go-metalinter)
|
||||
(local-set-key (kbd "C-<f9>") (lambda () (interactive) (go-metalinter t)))
|
||||
(go-set-compile-command)))
|
||||
|
||||
(define-skeleton go-main
|
||||
|
|
|
@ -3,6 +3,18 @@
|
|||
;; We use the TeX setup.
|
||||
(require 'mode-tex)
|
||||
|
||||
(local-set-key (kbd "C-c m") 'latex-article)
|
||||
(local-set-key (kbd "C-c C-a") 'latex-insert-table)
|
||||
(local-set-key (kbd "C-c C-c") 'latex-smallcaps)
|
||||
(local-set-key (kbd "C-c C-e") 'latex-emph)
|
||||
(local-set-key (kbd "C-c C-l") 'latex-slanted)
|
||||
(local-set-key (kbd "C-c C-s") 'latex-insert-section)
|
||||
(local-set-key (kbd "C-c C-u") 'latex-superscript)
|
||||
(local-set-key (kbd "C-c l") 'latex-lstinline)
|
||||
(local-set-key (kbd "C-c o") 'latex-orgtbl)
|
||||
(local-set-key (kbd "C-c u") 'latex-package)
|
||||
(local-set-key (kbd "M-RET") 'latex-itemize)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Functions
|
||||
|
||||
|
@ -57,17 +69,6 @@
|
|||
(tex-set-compiler)
|
||||
;; For some unknown reasons, `skeleton-end-hook' is set to nil in tex-mode.
|
||||
(add-hook 'skeleton-end-hook 'skeleton-make-markers)
|
||||
(local-set-key (kbd "C-c m") 'latex-article)
|
||||
(local-set-key (kbd "C-c C-a") 'latex-insert-table)
|
||||
(local-set-key (kbd "C-c C-c") 'latex-smallcaps)
|
||||
(local-set-key (kbd "C-c C-e") 'latex-emph)
|
||||
(local-set-key (kbd "C-c C-l") 'latex-slanted)
|
||||
(local-set-key (kbd "C-c C-s") 'latex-insert-section)
|
||||
(local-set-key (kbd "C-c C-u") 'latex-superscript)
|
||||
(local-set-key (kbd "C-c l") 'latex-lstinline)
|
||||
(local-set-key (kbd "C-c o") 'latex-orgtbl)
|
||||
(local-set-key (kbd "C-c u") 'latex-package)
|
||||
(local-set-key (kbd "M-RET") 'latex-itemize)
|
||||
(turn-on-orgtbl)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
@ -377,15 +378,16 @@ The table type is any value found in `latex-table-names'."
|
|||
|
||||
;; Extra for latex-math-preview-mode.
|
||||
;; TODO: latex-math-preview-mode extra does not work.
|
||||
(require 'latex-math-preview-extra-data nil t)
|
||||
(add-hook
|
||||
(when (require 'latex-math-preview-extra-data nil t)
|
||||
;; (local-set-key (kbd "C-c p") 'latex-math-preview-expression)
|
||||
;; (local-set-key (kbd "C-c C-p") 'latex-math-preview-save-image-file)
|
||||
(local-set-key (kbd "C-c j") 'latex-math-preview-insert-symbol)
|
||||
(local-set-key (kbd "C-c C-j") 'latex-math-preview-last-symbol-again)
|
||||
;; (local-set-key (kbd "C-c C-b") 'latex-math-preview-beamer-frame)
|
||||
)
|
||||
(add-hook-and-eval
|
||||
'latex-mode-hook
|
||||
(lambda ()
|
||||
;; (local-set-key (kbd "C-c p") 'latex-math-preview-expression)
|
||||
;; (local-set-key (kbd "C-c C-p") 'latex-math-preview-save-image-file)
|
||||
(local-set-key (kbd "C-c j") 'latex-math-preview-insert-symbol)
|
||||
(local-set-key (kbd "C-c C-j") 'latex-math-preview-last-symbol-again)
|
||||
;; (local-set-key (kbd "C-c C-b") 'latex-math-preview-beamer-frame)
|
||||
;; (add-to-list 'latex-math-preview-text-symbol-datasets
|
||||
;; latex-math-preview-textcomp-symbol-data)
|
||||
;; (add-to-list 'latex-math-preview-text-symbol-datasets
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
;; Makefile
|
||||
|
||||
(add-hook-and-eval
|
||||
'makefile-mode-hook
|
||||
(lambda ()
|
||||
(local-set-key (kbd "C-c c") 'makefile-config)
|
||||
(local-set-key (kbd "C-c d") 'makefile-doc)
|
||||
(local-set-key (kbd "C-c m") 'makefile-main)
|
||||
(local-set-key (kbd "C-c s") 'makefile-c)))
|
||||
(local-set-key (kbd "C-c c") 'makefile-config)
|
||||
(local-set-key (kbd "C-c d") 'makefile-doc)
|
||||
(local-set-key (kbd "C-c m") 'makefile-main)
|
||||
(local-set-key (kbd "C-c s") 'makefile-c)
|
||||
|
||||
(define-skeleton makefile-main
|
||||
"Insert root Makefile." nil
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
;; MediaWiki
|
||||
|
||||
(local-set-key (kbd "C-c o") 'mediawiki-browse)
|
||||
(local-unset-key (kbd "M-g")) ; This shadows M-g M-g.
|
||||
(local-set-key (kbd "C-x C-s") 'save-buffer)
|
||||
(local-set-key (kbd "C-c M-s") 'mediawiki-save)
|
||||
|
||||
(setq
|
||||
mediawiki-site-alist
|
||||
'(
|
||||
("Wikipedia" "http://en.wikipedia.org/w/" "Ambrevar" "" "Main Page")
|
||||
'(("Wikipedia" "http://en.wikipedia.org/w/" "Ambrevar" "" "Main Page")
|
||||
("Wikibooks" "http://en.wikibooks.org/w/" "Ambrevar" "" "LaTeX")
|
||||
("ArchLinux" "https://wiki.archlinux.org/" "Ambrevar" "" "Mutt")
|
||||
("WikEmacs" "https://wikemacs.org/wiki/" "Ambrevar" "" "Main Page")
|
||||
))
|
||||
("WikEmacs" "https://wikemacs.org/wiki/" "Ambrevar" "" "Main Page")))
|
||||
|
||||
;; The url-cookie timer is set to a high value because it seems that once the
|
||||
;; cookie has been saved, MediaWiki fails to upload files correctly. Is
|
||||
|
@ -20,14 +23,7 @@
|
|||
'mediawiki-mode-hook
|
||||
(lambda ()
|
||||
(visual-line-mode 1)
|
||||
(turn-off-auto-fill)
|
||||
(define-key mediawiki-mode-map (kbd "C-c RET") 'mediawiki-open-page-at-point)
|
||||
(define-key mediawiki-mode-map (kbd "C-c o") 'mediawiki-browse)
|
||||
(local-unset-key (kbd "M-g"))
|
||||
(local-set-key (kbd "C-c C-d") 'duplicate-line)
|
||||
(local-set-key (kbd "C-c C-s") 'mediawiki-save)
|
||||
(local-set-key (kbd "C-x C-s") 'save-buffer)
|
||||
))
|
||||
(turn-off-auto-fill)))
|
||||
|
||||
;; Skeletons
|
||||
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
;; Nroff
|
||||
|
||||
(add-hook-and-eval
|
||||
'latex-mode-hook
|
||||
(lambda ()
|
||||
(local-set-key (kbd "C-c C-b") 'nroff-bold)
|
||||
(local-set-key (kbd "C-c C-i") 'nroff-italic)))
|
||||
(local-set-key (kbd "C-c C-b") 'nroff-bold)
|
||||
(local-set-key (kbd "C-c C-i") 'nroff-italic)
|
||||
|
||||
;; Skeletons
|
||||
(define-skeleton nroff-bold "Bold text." nil "\\fB" @ _ "\\fR" @)
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
;; Org mode config.
|
||||
|
||||
(local-set-key (kbd "C-c C-a") 'org-agenda)
|
||||
|
||||
;; Move annoying babel folder. This move does not seem to work properly.
|
||||
(setq org-babel-temporary-directory (concat emacs-cache-folder "babel"))
|
||||
;; Disable line splitting on M-RET
|
||||
|
@ -30,7 +32,6 @@
|
|||
'org-mode-hook
|
||||
(lambda ()
|
||||
(setq indent-tabs-mode nil)
|
||||
(local-set-key (kbd "C-c C-a") 'org-agenda)
|
||||
(auto-fill-mode -1)))
|
||||
|
||||
(provide 'mode-org)
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
;; SGML
|
||||
|
||||
;; Just because XML is ugly.
|
||||
(add-hook-and-eval
|
||||
'sgml-mode-hook
|
||||
(lambda ()
|
||||
(setq sgml-xml-mode t)
|
||||
;; This seems to slow down Emacs.
|
||||
; (toggle-truncate-lines)
|
||||
; (toggle-truncate-lines) ; This seems to slow down Emacs.
|
||||
(turn-off-auto-fill)))
|
||||
|
||||
(provide 'mode-sgml)
|
||||
|
|
|
@ -18,6 +18,11 @@
|
|||
;; Note that -shell-escape can also be toggled with universal
|
||||
;; argument.
|
||||
|
||||
(dolist (key '("\C-c\C-f" "\C-c\C-b"))
|
||||
(local-unset-key key))
|
||||
(local-set-key (kbd "<f9>") 'tex-pdf-view)
|
||||
(local-set-key (kbd "<f10>") (lambda () (interactive) (progn (compile compile-command) (sit-for tex-compilation-delay) (delete-windows-on "*compilation*"))))
|
||||
|
||||
(defvar-local tex-masterfile nil
|
||||
"The file that should be compiled. Useful for modular documents.")
|
||||
|
||||
|
@ -125,15 +130,11 @@ This does not interfere with `subword-mode'."
|
|||
;; argument: "TABs in verbatim environments don't do what you think." Not
|
||||
;; sure how relevant this bad comment is. We revert it.
|
||||
(setq indent-tabs-mode t)
|
||||
(dolist (key '("\C-c\C-f" "\C-c\C-b"))
|
||||
(local-unset-key key))
|
||||
(set-face-attribute 'tex-verbatim nil :family "freemono")
|
||||
(set (make-local-variable 'compilation-scroll-output) t)
|
||||
(set (make-local-variable 'paragraph-start) "
|
||||
")
|
||||
;; (set (make-local-variable 'use-hard-newlines) t)
|
||||
(local-set-key (kbd "<f9>") 'tex-pdf-view)
|
||||
(local-set-key (kbd "<f10>") (lambda () (interactive) (progn (compile compile-command) (sit-for tex-compilation-delay) (delete-windows-on "*compilation*"))))
|
||||
(tex-set-compiler)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
(require 'tex-mode)
|
||||
(require 'mode-tex)
|
||||
|
||||
(local-set-key (kbd "C-c C-b") 'texinfo-menu-update)
|
||||
|
||||
(defun texinfo-menu-update ()
|
||||
"Update texinfo node menu automatically."
|
||||
(interactive)
|
||||
|
@ -16,8 +18,7 @@
|
|||
(add-hook-and-eval
|
||||
'texinfo-mode-hook
|
||||
(lambda ()
|
||||
(setq fill-column 80) ;; Really needed?
|
||||
(local-set-key (kbd "C-c C-b") 'texinfo-menu-update)
|
||||
(setq fill-column 80) ;; Is it needed?
|
||||
(set (make-local-variable 'tex-extension-list)
|
||||
'("aux" "cp" "cps" "fn" "ky" "log" "pg" "toc" "tp" "vr" "vrs"))
|
||||
(set (make-local-variable 'tex-start-options) nil)
|
||||
|
|
Loading…
Reference in New Issue