Emacs: Replace eval-after-load with with-eval-after-load

master
Pierre Neidhardt 2017-05-22 16:12:30 +02:00
parent 8f8578db06
commit 581d7799d5
3 changed files with 41 additions and 45 deletions

View File

@ -212,15 +212,14 @@
;; Compilation bindings and conveniences.
(setq compilation-ask-about-save nil)
(eval-after-load 'compile
'(progn (make-variable-buffer-local 'compile-command)
;; Making `compilation-directory' local only works with `recompile'
;; and if `compile' is never used. In such a scenario,
;; `compile-command' is not saved by `recompile' itself which adds a
;; lot of bookkeeping.
; (make-variable-buffer-local 'compilation-directory)
; (make-variable-buffer-local 'compile-history)
))
(with-eval-after-load 'compile
;; Making `compilation-directory' local only works with `recompile'
;; and if `compile' is never used. In such a scenario,
;; `compile-command' is not saved by `recompile' itself which adds a
;; lot of bookkeeping.
;; (make-variable-buffer-local 'compilation-directory)
;; (make-variable-buffer-local 'compile-history)
(make-variable-buffer-local 'compile-command))
;; Don't set these bindings in mickey as we might have to override them from
;; mode hooks.
(global-set-key (kbd "C-<f10>") 'compile)
@ -257,11 +256,11 @@
(add-to-list 'desktop-locals-to-save 'compile-command))
;; GMP documentation
(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)))))
(with-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)))))
;; Buffer names.
(require 'uniquify)

View File

@ -23,28 +23,27 @@
;; If the prompt spans over multiple lines, the regexp should match last line only.
(setq eshell-prompt-regexp "^[#>] ")
(eval-after-load 'em-term
'(nconc eshell-visual-commands
'("abook" "cmus" "fzf" "htop" "mpv" "mutt" "ncdu" "newsbeuter" "ranger")))
; (eval-after-load 'em-term
; '(add-to-list 'eshell-visual-subcommands '("git" "log" "diff" "show")))
(with-eval-after-load 'em-term
(nconc eshell-visual-commands
'("abook" "cmus" "fzf" "htop" "mpv" "mutt" "ncdu" "newsbeuter" "ranger")))
;; (with-eval-after-load 'em-term
;; (add-to-list 'eshell-visual-subcommands '("git" "log" "diff" "show")))
;; eshell/alias is too slow as it reads and write the file on each definition.
(eval-after-load 'em-alias
'(progn
(eshell-read-aliases-list)
(mapc
(lambda (alias)
(add-to-list 'eshell-command-aliases-list alias))
'(("ls" "ls -F $*")
("l" "ls -1 $*")
("la" "ls -lAh $*")
("ll" "ls -lh $*")
("grep" "grep --color=auto")
("mkdir" "mkdir -p $*")
("mkcd" "mkdir -p $* && cd $1")
("emacs" "find-file $1")
("em" "find-file $1")))
(eshell-write-aliases-list)))
(with-eval-after-load 'em-alias
(eshell-read-aliases-list)
(mapc
(lambda (alias)
(add-to-list 'eshell-command-aliases-list alias))
'(("ls" "ls -F $*")
("l" "ls -1 $*")
("la" "ls -lAh $*")
("ll" "ls -lh $*")
("grep" "grep --color=auto")
("mkdir" "mkdir -p $*")
("mkcd" "mkdir -p $* && cd $1")
("emacs" "find-file $1")
("em" "find-file $1")))
(eshell-write-aliases-list))
(provide 'mode-eshell)

View File

@ -13,20 +13,18 @@
;; Agendas.
;; If you want to add other agendas in a local file, use the following code:
; (eval-after-load "org"
; '(progn
; (add-to-list 'org-agenda-files "/path/to/agenda.org")))
; (with-eval-after-load "org"
; (add-to-list 'org-agenda-files "/path/to/agenda.org"))
(add-to-list 'org-agenda-files "~/personal/todo/todo.org")
(setq org-enforce-todo-dependencies t)
;; Set PDF association in Org-mode (was Evince by default).
(eval-after-load "org"
'(progn
(setq indent-tab-mode nil) ; Org-mode aligns text.
(require 'tool-pdf)
;; Change .pdf association directly within the alist
(setcdr (assoc "\\.pdf\\'" org-file-apps)
(concat pdf-viewer " " (mapconcat 'identity pdf-viewer-args " ")))))
(with-eval-after-load "org"
(setq indent-tab-mode nil) ; Org-mode aligns text.
(require 'tool-pdf)
;; Change .pdf association directly within the alist
(setcdr (assoc "\\.pdf\\'" org-file-apps)
(concat pdf-viewer " " (mapconcat 'identity pdf-viewer-args " "))))
(add-hook-and-eval
'org-mode-hook