Emacs: Use mapc when mapcar is not necessary
parent
4266865c4d
commit
9c3ed5b3a1
|
@ -26,7 +26,8 @@
|
|||
(defun add-hook-and-eval (hook function)
|
||||
"Add FUNCTION to HOOK and evaluate it.
|
||||
This can be useful when called from a hooked function to make
|
||||
sure it gets executed."
|
||||
sure it gets executed, since additions to hooks will be ignored
|
||||
while `run-mode-hooks' is running."
|
||||
(add-hook hook function)
|
||||
(funcall function))
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@
|
|||
(setq-default indent-tabs-mode t)
|
||||
|
||||
;; Lisp should not use tabs.
|
||||
(mapcar
|
||||
(mapc
|
||||
(lambda (hook)
|
||||
(add-hook
|
||||
hook
|
||||
|
|
|
@ -56,6 +56,11 @@ restored."
|
|||
(when makefile
|
||||
(compile (format "make -k -f '%s' clean" makefile)))))
|
||||
|
||||
;; It is tempting to add `cc-fmt' to the hook:
|
||||
; (add-hook 'before-save-hook 'cc-fmt nil t)
|
||||
;; Unlike Go however, there is no formatting standard and thus this would break
|
||||
;; the formatting rules of every third-party C file that does not follow the
|
||||
;; same style.
|
||||
(defun cc-fmt ()
|
||||
"Run uncrustify(1) on current buffer or region."
|
||||
(interactive)
|
||||
|
@ -94,7 +99,6 @@ restored."
|
|||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; C-mode
|
||||
|
||||
;; WARNING: this style is a work-in-progress.
|
||||
(c-add-style
|
||||
"ambrevar"
|
||||
`((c-comment-only-line-offset . 0)
|
||||
|
@ -119,7 +123,7 @@ restored."
|
|||
;; function. Since cc modes belong to prog-mode, each hook is called another
|
||||
;; time at the end of the initialization. No big deal since we only set some
|
||||
;; variables.
|
||||
(mapcar
|
||||
(mapc
|
||||
(lambda (mode-hook)
|
||||
(add-hook-and-eval
|
||||
mode-hook
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
(eval-after-load 'em-alias
|
||||
'(progn
|
||||
(eshell-read-aliases-list)
|
||||
(mapcar
|
||||
(mapc
|
||||
(lambda (alias)
|
||||
(add-to-list 'eshell-command-aliases-list alias))
|
||||
'(("ls" "ls -F $*")
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
(setq latex-block-default "itemize")
|
||||
(setq latex-block-names '("listing" "align" "align*" "Bmatrix" "Vmatrix" "bmatrix" "matrix" "pmatrix" "smallmatrix" "vmatrix"))
|
||||
|
||||
(mapcar
|
||||
(mapc
|
||||
(lambda (latex-block)
|
||||
(add-to-list 'latex-block-body-alist `(,latex-block nil '(delete-horizontal-space t) _)))
|
||||
'("listing" "verbatim" "verbatim*"))
|
||||
|
|
|
@ -75,13 +75,13 @@ but there is no warranty."
|
|||
(file-name-sans-extension tex-masterfile)
|
||||
(file-name-sans-extension buffer-file-name))
|
||||
".")))
|
||||
(mapcar
|
||||
(mapc
|
||||
;; Delete file if it exists.
|
||||
(lambda (argfile)
|
||||
(when (and (file-exists-p argfile) (file-writable-p argfile))
|
||||
(delete-file argfile)
|
||||
(message "[%s] deleted." argfile)))
|
||||
(mapcar
|
||||
(mapc
|
||||
;; Concat file name with extensions.
|
||||
(lambda (arg) (concat master arg))
|
||||
tex-extension-list))))
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
(set-face-foreground 'compilation-line-number "cyan")))
|
||||
|
||||
;; C additional keywords.
|
||||
(mapcar
|
||||
(mapc
|
||||
(lambda (mode)
|
||||
(font-lock-add-keywords
|
||||
mode
|
||||
|
@ -155,7 +155,7 @@
|
|||
;; Key notes highlighting. We need to apply it to the mode hook since
|
||||
;; font-lock-add-keywords has no inheritance support.
|
||||
(set-face-foreground 'font-lock-warning-face "DarkOrange")
|
||||
(mapcar
|
||||
(mapc
|
||||
(lambda (mode-hook)
|
||||
(add-hook
|
||||
mode-hook
|
||||
|
|
Loading…
Reference in New Issue