(eval-after-load "dired"
'(progn
(define-key dired-mode-map "c" 'dired-create-empty-file)
(define-key dired-mode-map "r" 'dired-do-compress-to)))
Why is the eval-after-load
necessary when this is an init file? From my understanding, it makes it only run when dired
is loaded, but isn't the init file also loaded once? I was getting "symbol's value as variable is void" warning for dired-mode-map
but it was working fine without.
Is this because the warning is emitted before dired
is loaded, but the symbol is resolved by the time emacs is started up?
indent-tabs-mode
off with thetab-width 4
.with-eval-after-load
overeval-after-load
. If you look at its code, you'll see thatwith-eval-after-load
avoids explicit quoting by usinglambda
. Maybe, that does not play such a great role for the init file which is usually not byte-compiled but for byte-compiled library files, explicitly quoted sexps are not byte-compiled, but lambda-expressions (and sharp-quoted expressions) are. There is more (also about lexical scoping) at discourse.doomemacs.org/t/…