Define these variables as automatically buffer-local, meaning that
they always become buffer-local when set unless explicitly told
otherwise using `setq-default' or when using the Custom interface.
Previously they were declared, which keeps the byte-compiler quiet but
is not actually the same as being defined. `notmuch-search-mode' then
made them buffer-local in the current buffer and then set the local
values. This works but is not kosher.
The definitions of the three non-option variables have to be moved up
a bit to enable the change in the next commit, which see.
The previous commit switched to lexical-binding but without dealing
with the new warnings about unused lexical arguments and variables.
This commit deals with most of them, in most cases by either removing
leftover bindings that are actually unnecessary, or by marking certain
arguments as "known to be unused" by prefixing their names with "_".
In the case of the functions named `notmuch-show-insert-...' the
amount of silencing that is required is a bit extreme and we might
want to investigate if there is a better way.
In the case of `notmuch-mua-mail', ignoring CONTINUE means that we do
not fully follow the intended behavior described in `compose-mail's
doc-string.
Doing so causes many new compile warnings. Some of these warnings
concern genuine changes in behavior that have to be addressed right
away.
Many other warnings are due to unused variables. Nothing has changed
here, except that the byte-compiler can now detect these pre-existing
and harmless issues. We delay addressing these issues so that we can
focus on the important ones here.
A third group of warnings concern arguments that are not actually used
inside the function but which cannot be removed because the functions
signature is dictated by some outside convention. Silencing these
warning is also delayed until subsequent commits.
`outline-minor-mode' treats comments that begin with three or more
semicolons as headings. That makes it very convenient to navigate
code and to show/hide parts of a file.
Elips libraries typically have four top-level sections, e.g.:
;;; notmuch.el --- run notmuch within emacs...
;;; Commentary:...
;;; Code:...
;;; notmuch.el ends here
In this package many libraries lack a "Commentary:" section, which is
not optimal but okay for most libraries, except major entry points.
Depending on how one chooses to look at it, the "... ends here" line
is not really a heading that begins a section, because it should never
have a "section" body (after all it marks eof).
If the file is rather short, then I left "Code:" as the only section
that contains code. Otherwise I split the file into multiple sibling
sections. The "Code:" section continues to contain `require' and
`declare-function' forms and other such "front matter".
If and only if I have split the code into multiple sections anyway,
then I also added an additional section named just "_" before the
`provide' form and shortly before the "...end here" line. This
section could also be called "Back matter", but I feel it would be
distracting to be that explicit about it. (The IMO unnecessary but
unfortunately still obligatory "... ends here" line is already
distracting enough as far as I am concerned.)
Before this commit some libraries already uses section headings, some
of them consistently. When a library already had some headings, then
this commit often sticks to that style, even at the cost inconsistent
styling across all libraries.
A very limited number of variable and function definitions have to be
moved around because they would otherwise end up in sections they do
not belong into.
Sections, including but not limited to their heading, can and should
be further improved in the future.
This reverts commit f9fbd1ee3b.
Emacs provides a mechanism for avoiding wiping out buffer-local
variables: marking them as "permanent local", which essentially
means "don't wip out the local value when enabling major-mode".
(put 'the-variable 'permanent-local t)
See (info "(elisp)Creating Buffer-Local").
Whether refreshing the buffer contents should involve re-enable the
mode is a different question, which should not be decided based on
the fact that we want keep the value of some random variable, not
least because some other (e.g. cache) variables are likely expected
to be wiped.
Emacs face definition forms are either
((DISPLAY . PLIST)
(DISPLAY . PLIST))
or
((DISPLAY PLIST) ;For backward compatibility.
(DISPLAY PLIST))
Commit a2388bc56e (2020-08-08) follows
neither of the correct formats. It defines:
`((((class color) (background light))
,@(and (>= emacs-major-version 27) '(:extend t))
(:background "#f0f0f0"))
(((class color) (background dark))
,@(and (>= emacs-major-version 27) '(:extend t))
(:background "#303030")))
which produces:
((DISPLAY
:extend t (:background "#f0f0f0"))
(DISPLAY
:extend t (:background "#303030")))
And that is wrong format.
This change fixes the face definition form to produce:
((DISPLAY
:extend t :background "#f0f0f0")
(DISPLAY
:extend t :background "#303030"))
which follows the (DISPLAY . PLIST) format (see above).
This means that notmuch commands obey display-buffer-alist so the user
can customize how buffers show up.
It also permits the use of C-x 4 4, C-x 5 5 and C-x t t, available in
Emacs 28. For example, one can use C-x 4 4 M-x notmuch-jump-search RET
to open a saved search in another window rather than the current window.
Or in notmuch-search mode, C-x 5 5 RET to view the message at point in
a new frame.
notmuch-tree has custom buffer display logic, so bind
display-buffer-overriding-action to make pop-to-buffer-same-window
behave exactly as switch-to-buffer while that function is running.
This variable will be used in a similar fashion to
notmuch-show-parent-buffer. It will be used to navigate between
threads from the parent search buffer.
Signed-off-by: William Casarin <jb55@jb55.com>
- The first sentence should fit on the first line in full. This is
even the case when that causes the line to get a bit long. If it
gets very long, then it should be made shorter.
- Even even the second sentence would fit on the first line, if it
just provides some details, then it shouldn't be done.
- Symbols are quoted like `so'.
- There is no clear rule on how to (not) quote non-atomic
s-expressions, but quoting like '(this) is definitely weird.
- It is a good idea to remember that \" becomes " and to take
that in mind when adjusting the automatic filling by hand.
- Use the imperative form.
- Arguments are written in all uppercase.
Since Emacs 27 each face has to be explicitly configured to "extend
to the edge of the window". Without doing that the face used for
the newline character only has an effect that spans "one character"
(i.e. it looks like there is a single trailing space character).
We don't want that so extend the face in Emacs 27, so that it looks
the same as it did in older Emacs releases. We have to do this
conditionally, otherwise older Emacsen would choke on it.
It's a bit weird to avoid having to write the "(setq ... )" more than
once, just because we can. In a language that uses '=' for the same
purpose we also happily use that once per assignment.
While there are no benefit to using just one 'setq' there are some
drawbacks. It is not always clear on first what is a key and what a
value and as a result it is easy to make a mistake. Also it becomes
harder to comment out just one assignment.
Most people who write lots of lisp tend to only sparsely use empty
"separator" lines within forms. In lisp they feel unnecessary and
since most files stick to this convention we get a bit confused
when there are extra empty lines. It feels like the s-expressions
are falling into pieces.
All of this is especially true between a function's doc-string and
body because the doc-string is colored differently, which visually
already separates it quite sufficiently from the code that follows.
Fixed emacs docstrings to be consistent. No functional change.
- removed some (accidental) indentation
- removed some trailing newlines
- added trailing periods where missing (some exclusions)
Before this change, `load-prefer-newer' was ignored.
Set NOERROR and MUST-SUFFIX arguments of `load' to t, and NOSUFFIX
argument to nil, to preserve the behaviour of the deleted `let' form.
Starting with Emacs 27 the old `cl' implementation is finally
considered obsolete. Previously its use was strongly discouraged
at run-time but one was still allowed to use it at compile-time.
For the most part the transition is very simple and boils down to
adding the "cl-" prefix to some symbols. A few replacements do not
follow that simple pattern; e.g. `first' is replaced with `car',
even though the alias `cl-first' exists, because the latter is not
idiomatic emacs-lisp.
In a few cases we start using `pcase-let' or `pcase-lambda' instead
of renaming e.g. `first' to `car'. That way we can remind the reader
of the meaning of the various parts of the data that is being
deconstructed.
An obsolete `lexical-let' and a `lexical-let*' are replaced with their
regular variants `let' and `let*' even though we do not at the same
time enable `lexical-binding' for that file. That is the right thing
to do because it does not actually make a difference in those cases
whether lexical bindings are used or not, and because this should be
enabled in a separate commit.
We need to explicitly depend on the `cl-lib' package because Emacs
24.1 and 24.2 lack that library. When using these releases we end
up using the backport from GNU Elpa.
We need to explicitly require the `pcase' library because
`pcase-dolist' was not autoloaded until Emacs 25.1.
This is like notmuch-search-filter-by-tag, but creates a new search
rather than filtering the current search. We add this to
notmuch-common-keymap since this can be used by many contexts. We bind
to the key "t", which is the same key used by
notmuch-search-filter-by-tag in notmuch-search-mode-map. This is done
intentionally since the keybinding for notmuch-search-mode-map can be
seen as a specialization of creating a new search.
This change was motivated for use in "notmuch-hello". It is a more
convenient way to search a tag than expanding the list of all tags. I
also noticed many saved searches people use are simply tags.
We have shortcuts S and Z to let the user switch to Search view and
Tree view with the current search. Add U to let the user switch to
unthreaded view from the current search, and ensure that S and Z
switch from unthreaded to search and tree veiew respectively.
This is an unbound function that is quite useful. It opens a selected
thread in notmuch-tree from the current search query.
Signed-off-by: William Casarin <jb55@jb55.com>
When filtering by tags in notmuch-search-filter-by-tag, only return tags
related to the current query.
Before, it was returning all tags. There's no reason to refine the
current query with tags that don't exist in the current result set.
Signed-off-by: William Casarin <jb55@jb55.com>
We have a steady trickle of people using notmuch-emacs from melpa with
distro packages of notmuch, and then being confused when it doesn't
work. Try to warn people what a foot-gun this is; this commentary
should be copied to the melpa web site.
Emacs' major modes can facilitate navigation in their buffers by
supporting Imenu. In such major modes, launching Imenu (M-x imenu)
makes Emacs display a list of items (e.g., function definitions in a
code buffer). Selecting an item from this list moves point to this
item.
This patch adds Imenu support to both notmuch-show and notmuch-search
buffers:
* in notmuch-show, Imenu will present a list of all messages in the
currently visible thread;
* in notmuch-search, Imenu will present a list of all messages in the
search buffer.
The notmuch-tag-flagged, notmuch-search-flagged-face and
notmuch-crypto-part-header faces defaulted to "blue", which is nearly
unreadable when a dark background is in use. This is addressed by using
"LightBlue1" for dark backgrounds.
As a side effect, these faces are now no-op definitions for grayscale or
mono displays.
The normal tag commands in search mode tag the all threads meeting the
region when called interactively. This makes them do the same when
called non-interactively. This is a change in the api.
The command notmuch-interesting-buffer has got out of date -- it
doesn't mention notmuch-tree, and it still refers to message-mode not
notmuch-message-mode. Update both of these.
This fixes the bug that notmuch-cycle-notmuch-buffers does not include
notmuch-tree or notmuch-message-mode buffers in its cycling.
In commit 2a7b11b064 the default value
for notmuch-search-line-faces was changed so that it didn't match the
specification in the corresponding defcustom. This meant that it was
difficult for the user to customize this variable as they got a type
mismatch error.
Note anyone who had already customised this variable would not see
this bug as their customisation would match the defcustom.