aboutsummaryrefslogtreecommitdiff
path: root/emacs/notmuch-show.el
AgeCommit message (Collapse)Author
2026-03-15emacs: Switch mode before pop-to-bufferAurelien Rouene
When showing an email using notmuch-show-mode, set the mode "notmuch-show-mode" before using "pop-to-buffer-same-window", to be able to match on the major-mode with an entry in "display-buffer-alist". Using the major mode is the the only mean to set display rules, because the buffer title is set to the title of the email and is not fixed. Signed-off-by: Aurelien Rouene <aurelien@rouene.fr>
2026-02-22emacs: Fix warnings on emacs@31.1Al Haji-Ali
Use `when-let*' instead of `when-let'. Use quoted `font-lock-warning-face' instead of obsolete variable.
2025-03-20emacs: fix disabling notmuch-show-header-line via customlen@realtimegenomics.com
The defcustom had a typo that prevented it from working as intended.
2025-03-14Set 'untrusted-content' to t in all modesStefan Kangas
Instead of trying to guess in which modes this is safe not to set in, let's just set it in all of them. Background (added by db): untrusted-content was added in Emacs 29.3 and is currently set by Gnus and used by org-mode to prevent certain unsafe operations. I think the intent is to use it for blocking more unsafe operations in the future.
2025-02-18notmuch-show-imenu-prev-index-position-function: Don't recenterDamien Cassou
The previous version of notmuch-show-imenu-prev-index-position-function was calling notmuch-show-previous-message which was recentering the window. This is a problem when which-func-mode is active because which-func-mode is called each time the user moves point around. Because this function is only meant to be executed by imenu, there is no reason to recenter the window. For the same reason, the new implementation doesn't have to follow strictly how notmuch-show-previous-message is implemented because imenu only places point at very specific locations before calling notmuch-show-imenu-prev-index-position-function.
2024-06-15emacs/show: fix for text/calendar displayDavid Bremner
In certain scenarios involving symlinks and setting find-file-visit-truename, text/calendar parts were not displayed properly. Following a suggestion of Al Haji-Ali [1], replace the use of get-file-buffer with find-buffer-visiting. [1]: id:m2wmneguh8.fsf@gmail.com
2023-10-06emacs: wrap docstringsDavid Bremner
Suppress byte-compiler warnings about >80 character docstrings.
2023-10-01emacs/show: special case toggling display of images0.38.1_pre0David Bremner
According to emacs upstream [1], we can't expect overlay invisibility and images to get along. This commit uses the previously stashed undisplayer functions to actually remove the images from the buffer. When the image is toggled, it is essentially redisplayed from scratch, using the previously stashed redisplay data. [1]: https://lists.gnu.org/archive/html/emacs-devel/2023-08/msg00593.html
2023-10-01emacs: save image redisplay data during non-lazy displayDavid Bremner
This data will eventually be used to redisplay hidden images. A certain amount of refactoring is done here to avoid code duplication.
2023-10-01emacs/show: save redisplay redisplay data when showing lazy part.David Bremner
This data will be used to redisplay an image that is hidden by deleting it from the buffer. We cannot easily delay until the image is hidden, as we won't have the original data at that point.
2022-11-15emacs/show: use n-s-i-headerline to update tagsDavid Bremner
Although this has more steps than the previous regular expression search and replace, it should be more robust against changes in the headerline format, such as the inclusion of duplicate numbers (which broke the previous version).
2022-11-15emacs/show: add optional orig-tags argument to n-s-i-headerlineDavid Bremner
This will support use of this function in notmuch-show-update-tags.
2022-11-15emacs/show: use plist to pass message info to n-s-insert-headerlineDavid Bremner
This should allow calling notmuch-show-insert-headerline from other places without duplicating the set of plist accesses.
2022-09-03emacs/show: use read-shell-command instead of read-stringAntoine Beaupré
This enables auto-completion of commands, something which plain read-string does not do. It's otherwise a drop-in replacement. According to `C-h f`, read-shell-command was introduced in Emacs 23.1 or earlier.
2022-08-11emacs: add docstring for notmuch-show-choose-duplicateDavid Bremner
It should have one in any case, but in particular it is needed for the manual.
2022-08-11emacs/show: restrict inlined mimetypes on refresh.David Bremner
This fixes the bug reported by Al [1]. Essentially apply the same fix as [2] in a different place. [1]: id:877d41nmr1.fsf@gmail.com [2]: 90a7c1af368a527700dcde9b0dcbd760afc7bd92
2022-08-07emacs: add duplicate support to notmuch-show-view-raw-messageDavid Bremner
This fixes one of the bugs reported by Gregor in [1] [1]: id:87edxw8jp4.fsf@no.workgroup
2022-08-07emacs/show: provide a more friendly function to get duplicate numDavid Bremner
There is not much code here, but at least we can fix the indexing as 1 based.
2022-08-07emacs: update notmuch-show-get-filename to handle duplicatesDavid Bremner
This fixes one of the bugs reported by Gregor in [1]. [1]: id:87edxw8jp4.fsf@no.workgroup
2022-07-30emacs/reply: reply to correct duplicateDavid Bremner
Essentially we just need to arrange to pass the right --duplicate argument to notmuch reply. As a side-effect, correct the previously unused value of EXPECTED in T453-emacs-reply.sh.
2022-07-30CLI/reply: support --duplicate argumentDavid Bremner
We want the reply used to match that shown e.g. in the emacs interface. As a first step provide that functionality on the command line. Schema does not need updating as the duplicate key was already present (with a constant value of 1).
2022-07-30emacs/show: display count of duplicates in headerlineDavid Bremner
There is no real cost here, except screen real estate. Some people might prefer hiding the duplicate count, but we leave that for a future commit.
2022-07-30emacs/show: provide notmuch-show-choose-duplicateDavid Bremner
This new command allows the user to interactively choose a different duplicate (file) to display for a given message in notmuch-show-mode. Since both tree and unthreaded view use notmuch-show-mode, this provides the same facility there.
2022-07-14emacs/show: introduce notmuch-show-height-limitDavid Bremner
Analogous to notmuch-show-depth-limit, it requires a bit more calculation, but that cost seems dominated by the rendering cost.
2022-07-14emacs/show: obey notmuch-show-max-text-part-size for part 0David Bremner
This parameter was originally introduced to hide large attachements that happened to be text/plain. From a performance point of view, there is no reason not to also hide large message bodies.
2022-07-14emacs/show: optionally insert bodies of "deep messages" lazilyDavid Bremner
This leverages the machinery already there to insert buttons for attachments. A potential use-case is browsing the top layers of the tree to decide which of the lower subtrees to read.
2022-07-03emacs: mark notmuch-query.el as obsoleteDavid Bremner
The only functionality actually used by notmuch is the base function notmuch-query-get-threads; the other functions in this file have nothing to do with that (single) use. Move that function into notmuch-lib.el and rename to reflect use. Deprecate the other functions in notmuch-query.el.
2022-06-13emacs: Make notmuch-show-next-thread return nil on failureLeo Okawa Ericson
Having notmuch-show-next-thread return non-nil on success and nil on failure makes it easier for users to interact with notmuch via elisp. This commit changes notmuch-search-show-thread too since the return value of notmuch-show-next-thread depends on notmuch-search-show-thread. Amended by db: fix whitespace in T450-emacs-show
2022-06-01emacs: notmuch-show-header-line: allow format strings and functionsjao
If a string value is assigned to notmuch-show-header-line, it's used as a format string to be passed passed to format-spec with `%s` substituted by the message's subject. If a function is given, it's called with the subject as argument, and its return value used as header line. As before, t means displaying the subject and nil not using any header line. Signed-off-by: jao <jao@gnu.org> Amended-by: db, docstring spelling fix
2022-05-16emacs: factor out calculation of mm-inline-override-typesDavid Bremner
The intended use case of this new function is to make reply behaviour track that of show with respect to attachments. Also fix the glob (which worked by fluke) into the documented regexp.
2022-01-10emacs: make header line in notmuch-show buffers optionaljao
New notmuch-show-header-line customizable boolean to allow inhibiting a header line in notmuch-show-mode buffers (for instance, because one prefers to just include Subject in notmuch-message-headers).
2021-10-19emacs: fix call to nonexistent notmuch--call-process-shell-commandDoug Woos
Looks like a find/replace error in e722b4f4
2021-09-11emacs: wrap call-processDavid Bremner
Provide safe working directory
2021-08-30emacs: don't inline message/rfc822 parts without contentDavid Bremner
This avoids some ugly error messages and exceptions, and hopes that some gnus method will display message/rfc822 parts that have only a file, no :content part.
2021-08-29emacs: notmuch-show-pipe-message: cosmeticsJonas Bernoulli
2021-08-03emacs: honour notmuch-show-text/html-blocked-images in w3m messagesjao
When mm-text-html-renderer is set to 'w3m, the variable playing the role of a regular expression for blocked images is w3m-ignored-image-url-regexp. We bind it when the renderer is not 'shr.
2021-06-27emacs/show: add parameter notmuch-show-single-messageDavid Bremner
This dynamically bound variable can be set when the caller of notmuch-show guarantees that exactly one message will match the query. It avoids transporting and parsing the complete thread structure.
2021-06-05emacs: update default mailing list archives for stashing linksJani Nikula
Gmane web interface is long gone, remove it. Make MARC the new default. Update LKML to Lore, where it already redirects anyway. Also add Notmuch web archive.
2021-06-05emacs: fix declare-function definitions with related line breaksTomi Ollila
- declare-function notmuch-unthreaded lacked file name - declare-function notmuch-search had differently named last arg - note: check-declare-directory did not complain about that - declare-function notmuch-search-show-thread without nil - some functions declared to be in different file than those existed ("notmuch" -> "notmuch-lib") - some related function/declare lines were (/are now) wider than 80-columns; added line breaks (and proper indentation) there
2021-01-15emacs: avoid type errors due to nil as content-typeJonas Bernoulli
The output of "notmuch show --format=sexp --format-version=4" may contain `:content-type' entries with `nil' as the value, when it fails to detect the correct value. Account for that in a few places where we would otherwise risk a type error. Note that `string=' does not choke on `nil' because it uses the `symbol-name' when encountering a symbol.
2021-01-15emacs: notmuch-show--get-cid-content: cosmeticsJonas Bernoulli
2021-01-15emacs: notmuch-show--register-cids: fix names of bindingsJonas Bernoulli
2021-01-15emacs: use string-empty-pJonas Bernoulli
2021-01-15emacs: improve how cl-lib and pcase are requiredJonas Bernoulli
We need to load `cl-lib' at run-time because we use more from it than just macros. Never-the-less many, but not all libraries required it only at compile-time, which we got away with because at least some libraries already required it at run-time as well. We use `cl-lib' and (currently to a lesser extend) `pcase' throughout the code-base, which means that we should require these features in most libraries. In the past we tried to only require these features in just the libraries that actually need them, without fully succeeding. We did not succeed in doing so because that means we would have to check every time that we use a function from these features whether they are already being required in the current library. An alternative would be to add the `require' forms at the top of every library but that is a bit annoying too. In order to make sure that these features are loaded when needed but also to keep the noise down we only require them in "notmuch-lib.el", which most other libraries require, and in most of the few libraries that do not do so, namely "notmuch-draft.el", "notmuch-message.el" and "notmuch-parser.el". ("coolj.el", "make-deps.el", various generated libraries, and "notmuch-compat.el" are left touched.)
2021-01-15emacs: avoid unnecessary let-bindingsJonas Bernoulli
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)?
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.
2020-12-06emacs: do not quote self-quoting tJonas Bernoulli
2020-12-06emacs: use defvar-localJonas Bernoulli
It is available since Emacs 24.3 and we require at least Emacs 25.