diff options
| author | Jonas Bernoulli <jonas@bernoul.li> | 2021-01-10 15:01:06 +0100 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2021-01-15 06:45:30 -0400 |
| commit | f47e3333b5478e43840e55710311aebdd441fc0e (patch) | |
| tree | f6edef3451d1b1122be87a44af75fdd4b49537fc /emacs/notmuch-lib.el | |
| parent | 25a8873c68f9ef033d393efaf7f4c46a29f798f4 (diff) | |
emacs: avoid unnecessary let-bindings
To some extend this is a personal preference, but the preference is
strongly dependent on whether one is used to a language that makes it
necessary to use variables like this.
This makes it perfectly clear that we are first getting and then using
a "foo":
(use-foo (get-foo))
Sure this has to be read "inside out", but that's something one better
gets used to quickly when dealing with lisp. I don't understand why
one would want to write this instead:
(let ((the-foo (get-foo)))
(use-foo the-foo))
Both `get-foo' and `use-foo' are named in a way that make it very
clear that we are dealing with a "foo". Storing the value in an
additional variable `the-foo' does not make this any more clear.
On the contrary I makes the reader wonder why the author choose to
use a variable. Is the value used more than once? Is the value
being retrieved in one context and then used in another (e.g. when
the current buffer changes)?
Diffstat (limited to 'emacs/notmuch-lib.el')
| -rw-r--r-- | emacs/notmuch-lib.el | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 2fd9a27d..cbac8859 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -416,9 +416,9 @@ A command that supports a prefix argument can explicitly document its prefixed behavior by setting the 'notmuch-prefix-doc property of its command symbol." (interactive) - (let* ((mode major-mode) - (doc (substitute-command-keys - (notmuch-substitute-command-keys (documentation mode t))))) + (let ((doc (substitute-command-keys + (notmuch-substitute-command-keys + (documentation major-mode t))))) (with-current-buffer (generate-new-buffer "*notmuch-help*") (insert doc) (goto-char (point-min)) |
