aboutsummaryrefslogtreecommitdiff
path: root/emacs
AgeCommit message (Collapse)Author
2021-01-15emacs: various comment improvementsJonas Bernoulli
2021-01-15emacs: various cosmetic improvementsJonas Bernoulli
2021-01-13emacs: notmuch-crypto-status-button-type: fix potential bugJonas Bernoulli
The "help-echo" can potentially contain an unintended %-spec so we have to make sure it would not be treated as such.
2021-01-13emacs: notmuch-mua.el: move all options into "Options" sectionJonas Bernoulli
This is how we do it in other libraries.
2021-01-13emacs: notmuch-mua-prompt-for-sender: don't force Ido on usersJonas Bernoulli
We shouldn't force `ido-completion-read' on users who do not otherwise use Ido. Unfortunately simply turning on `ido-mode' does not change every `completing-read' into a `ido-completing-read', instead it only changes file and buffer completion. I do realize that existing Ido users will initially dislike this change, but I would like to encourage them to see this as an opportunity to learn about Fido. Unlike `ido-mode', build-in `fido-mode' confirms to the standard completion API, so turning it on causes every `completing-read' to use the Fido completion mechanism and which is similar to the Ido mechanism: > An enhanced `icomplete-mode' that emulates `ido-mode'. This global > minor mode makes minibuffer completion behave more like `ido-mode' > than regular `icomplete-mode'."
2021-01-13emacs: notmuch-wash.el: require diff-mode at beginning of codeJonas Bernoulli
That's what we usually do. Also do not declare variable `diff-file-header-re' because it is defined in `diff-mode.el', which we always require.
2021-01-13emacs: notmuch-message-apply-queued-tag-changes: cosmeticsJonas Bernoulli
2021-01-13emacs: define notmuch-message-queued-tag-changes as buffer-localJonas Bernoulli
Also improve the doc-string.
2021-01-13emacs: silence compiler wrt notmuch-show-insert-part-text/plainJonas Bernoulli
`notmuch-show-insert-part-text/plain' calls `notmuch-show-insert-text/plain-hook' with two arguments MSG and DEPTH. Currently all hook functions ignore MSG but third-party functions may not. One hook function uses DEPTH.
2021-01-13emacs: notmuch-wash-region-to-button: remove unused MSG argumentJonas Bernoulli
2021-01-13emacs: inline notmuch-sexp-eof into only callerJonas Bernoulli
This function had a few issues. - Neither its name nor the old comment before it is called made it clear what it does. - It took one argument but didn't do anything with it. - It's doc-string made a few claims, which are untrue and generally focused on details instead of that its purpose is.
2021-01-13emacs: notmuch-tag--get-formats: silence byte-compilerJonas Bernoulli
`format-alist' is a global variable and the byte-compiler is unhappy when a lexical function argument shadows a global (dynamic) binding.
2021-01-13emacs: deal with unused lexical arguments and variablesJonas Bernoulli
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.
2021-01-13emacs: use lexical-bindings in all librariesJonas Bernoulli
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.
2021-01-13emacs: make headings outline-minor-mode compatibleJonas Bernoulli
`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.
2021-01-13emacs: avoid killing process buffer when process is still aliveJonas Bernoulli
In practice this probably does not make a difference or we would have heard about it many times, but better be safe than sorry. Process sentinels are called not only when the process has finished but also on other state changes.
2021-01-13emacs: avoid passing around some redundant informationJonas Bernoulli
When running "notmuch" we use its full path but when displaying the command to the user we show just its name for readability reasons. Avoid passing around both representations because it is very easy to get the name from the path. Notmuch itself uses the involved functions just for "notmuch" but there might be extensions that use them for other executable so we forgo other potential simplifications.
2021-01-13emacs: notmuch-start-notmuch: avoid storing process buffer twiceJonas Bernoulli
The buffer of the error process is accessible using `process-buffer'. We still have to store the error-buffer in the non-error process because for that process `process-buffer' obviously returns its own buffer.
2021-01-13emacs: notmuch-start-notmuch-sentinel: assert buffer is aliveJonas Bernoulli
2021-01-13emacs: notmuch-start-notmuch-error-sentinel: assert buffer is aliveJonas Bernoulli
2021-01-13emacs: notmuch-start-notmuch: remove backward compatibility codeJonas Bernoulli
We no longer support Emacs releases before version 25.1. Also adjust the sentinels which only had to deal with an error file when using an older Emacs release was used.
2021-01-13emacs: define new notmuch-search-item widget typeJonas Bernoulli
This is complex enough to warrant a dedicated widget type, which will make future improvements less messy to implement.
2021-01-13emacs: sanitize dedicated widget action/notify functionsJonas Bernoulli
These functions are used as action/notify functions. That dictates the appropriate function signatures but even though these functions are not used for anything else they use incompatible signatures, forcing the callers to use lambda expressions to deal with these incompatibilities. Fix that by adjusting the function signatures to the needs of the only intended callers. Two of these functions were defined as commands but because the interactive form did not return the mandatory arguments, we know that nobody (successfully) used these as commands. In one case we move the location of a y-or-n-p prompt.
2021-01-13emacs: use setq instead of setJonas Bernoulli
Commonly `set' is only used if there is no way around it; i.e. when the variable cannot be known until runtime.
2020-12-25Revert "emacs: notmuch-search: avoid wiping out buffer-local variables"Jonas Bernoulli
This reverts commit f9fbd1ee3bfd679175d88af403752d87a730349f. 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.
2020-12-06emacs: avoid binding unnamed commands in keymapsJonas Bernoulli
One should never bind unnamed commands in keymaps because doing that makes it needlessly hard for users to change these bindings. Replace such anonymous bindings with named commands that are generated using macros and some boilerplate. Using macros is better than using a simple loop because that makes it possible for `find-function' to find the definitions. Eat your boilerplate--it forms character. Admittedly this approach is quite ugly and it might be better to teach the original commands to support different buffers directly instead of requiring wrapper commands to do just that. Never-the-less as a short-term solution this is better than what we had before.
2020-12-06emacs: do not quote self-quoting tJonas Bernoulli
2020-12-06emacs: use setq-localJonas Bernoulli
It is available since Emacs 24.3 and we require at least Emacs 25. It makes the variable buffer-local if it isn't always buffer-local anyway.
2020-12-06emacs: use defvar-localJonas Bernoulli
It is available since Emacs 24.3 and we require at least Emacs 25.
2020-12-06emacs: inline notmuch-split-content-typeJonas Bernoulli
This trivial helper function actually made things slightly *less* readable by adding an unnecessary indirection.
2020-12-06emacs: inline notmuch-documentation-first-lineJonas Bernoulli
Inline a simplified version of `notmuch-documentation-first-line' into its only caller. The new code snippet differs from the removed function in that it returns nil instead of the empty string for symbols that have no function documentation. That value is ultimately used as an argument to `concat', which treats nil like the empty string. So we can do the logical thing without changing the behavior.
2020-12-06emacs: remove unnecessary notmuch-tree-button-activateJonas Bernoulli
Since [1: f8bdba37] no key is bound to this command and it is redundant because the behavior of `push-command' is identical when called as a command. 1: f8bdba37d3f4c877e05e17b5b1c7d2d512106538 emacs: tree: remove binding for pressing button in message pane
2020-12-06emacs: remove unused notmuch-address-locate-commandJonas Bernoulli
We stopped using it in [1: 0e671478]. 1: 0e671478c6f37018973392f049979da5e1a8ff99 emacs: replace use of notmuch-address-message-insinuate
2020-12-06emacs: remove unnecessary notmuch-remove-if-notJonas Bernoulli
We could just have switched to using `cl-remove-if-not' instead, but the two uses of the *remove-if-not function are pretty strange to begin with so we refactor to not use any such function at all.
2020-12-06emacs: remove deprecated notmuch-folder commandJonas Bernoulli
It has been deprecated for a decade and it's time to let go.
2020-12-06emacs: misc doc-string improvementsJonas Bernoulli
2020-12-06emacs: always use elisp quoting style in doc-stringsJonas Bernoulli
Emacs doc-strings use neither markdown nor lisp symbol quoting.
2020-12-06emacs: place complete first sentence on first doc-string lineJonas Bernoulli
2020-12-06emacs: place only first sentence on first doc-string lineJonas Bernoulli
2020-12-06emacs: shorten/replace first sentence of a few doc-stringsJonas Bernoulli
The first sentence should fit on the first line. It is okay if the first sentence/line does not contain all the information that the rest of the doc-string covers.
2020-12-06emacs: define notmuch-hello-url as a constantJonas Bernoulli
2020-12-06emacs: sanitize function that displays versionJonas Bernoulli
Previously it was defined in "notmuch-hello.el" and its name contained "hello" solely because it replaced an anonymous function that was mistakenly only bound in `notmuch-hello-mode-map'. But it makes more sense to bind it in all notmuch modes and even if we did not change that aspect it still would make no sense to have "hello" in its name.
2020-12-06emacs: more cleanup since dropping support for Emacs 24Jonas Bernoulli
Notmuch requires at least version 25 of Emacs now. Adjust comments that previously referenced version 24 specifically, even though they also apply to later releases. Remove documentation and code that no longer applies. - `mm-shr' no longer references `gnus-inhibit-images'.
2020-12-06emacs: remove kludge for Emacs 23 from notmuch-mua-mailJonas Bernoulli
Notmuch requires at least Emacs version 25. The `return-action' argument was added prior to Emacs 24.1 in 25ca2e61403f97b5a023164f2924d5f8aca2492a.
2020-12-06emacs: fix old bug in notmuch-mua-mailJonas Bernoulli
This fixes a regression introduced in [1: 7e20d264]. If the argument RETURN-ACTION was non-nil then we should pass along the value of that argument. Instead we passed along the constant symbol `return-action'. 1: 7e20d26480553f57d53bd9ec28cae163c1ac91e3 emacs: Fix mail composition under Emacs 23
2020-12-06emacs: remove redundant notmuch-hello-trimJonas Bernoulli
Use `string-trim', which exists since Emacs 24.4.
2020-11-11emacs: don't fset keymapsJonas Bernoulli
These keymaps are never invoked as commands so the function definitions serve no purpose.
2020-11-11emacs: add doc-string to notmuch-tree-mode-mapJonas Bernoulli
2020-11-11emacs: define notmuch-message-mode-map explicitlyJonas Bernoulli
Key bindings should not be defined at the top-level but inside a `defvar' form. Doing it at the top-level makes it harder to reliably customize key bindings.
2020-11-11emacs: silence byte-compilerJonas Bernoulli