aboutsummaryrefslogtreecommitdiffhomepage
path: root/emacs/notmuch-show.el
Commit message (Collapse)AuthorAge
* emacs: Fix coding system in `notmuch-show-view-raw-message'Gravatar Austin Clements2014-09-21
| | | | | This fixes the known-broken test of viewing 8bit messages added by the previous commit.
* emacs: Remove redundant NTH argument from `notmuch-get-bodypart-content'.Gravatar Austin Clements2014-09-21
| | | | | | This can be derived from the PART argument (which is arguably canonical), so there's no sense in giving the caller an extra foot gun.
* emacs: show: make return value of notmuch-show-get-prop explicitGravatar Mark Walters2014-07-30
| | | | | This makes the fact the notmuch-show-get-prop returns nil if the major mode is neither show not tree explicit.
* emacs: tree/show remove duplicate functionGravatar Mark Walters2014-07-16
| | | | | | | tree overrides notmuch-show-get-prop so that it can use many of the utility function directly. Now that tree is in mainline the version from tree can be moved to show and the original overridden show version dropped.
* emacs: set default in notmuch-read-queryGravatar Mark Walters2014-07-15
| | | | | | | | | | | | | | This adds the current query as a "default value" to notmuch-read-qeury. The default value is available via a down-arrow as opposed to history which is available from the up arrow. Note if a user presses return in the minibuffer this value is not returned. The implementation is simple but notmuch-read-query could be called via notmuch-search/notmuch-tree etc from any buffer so it makes sense to put the decision of how to extract the current query in notmuch-read-query rather than in each of the callers.
* emacs: show: add an update seen function to post-command-hookGravatar Mark Walters2014-07-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add a function for updating seen messages to the post-command-hook. This function calls a customizable (by eg defcustom) function with parameters the start and end of the current window and that function can decide what to mark read based on that and the current point. Since this is in the post-command-hook it should get called after most user actions (exceptions include user resizing the window) so it should be possible to make sure the seen status gets updated whether the user uses notmuch commands like next-message or normal emacs commands like scroll-up. It removes all of the old mark read/seen points but introduces a simple example function that just marks the current message read if it is open. This function has one small subtlety: it makes sure it doesn't mark the same message read twice (in the same instance of the same buffer); otherwise the post-command-hook makes it impossible for a user to manually mark a message unread. This fixes the current bugs (imo) that closed messages can be marked read, and that opening a closed message does not mark it read. Another advantage of using the post-command-hook any programmatic use with point passing through a message will not mark it read.
* emacs: Fix indentation.Gravatar David Edmondson2014-07-13
| | | | Fix the indentation of `notmuch-show-mode-map'.
* emacs: allow functions in notmuch-show-stash-mlarchive-link-alistGravatar Jani Nikula2014-05-04
| | | | | | | | | | | | | | | | | | Some archives may use a more complicated scheme for referring to messages than just concatenated url and message-id. In particular, patchwork requires a query to translate message-id to a patchwork patch id. Allow functions in notmuch-show-stash-mlarchive-link-alist to facilitate this. For example, one could use something like this for patchwork. (lambda (message-id) (concat "http://patchwork.example.com/patch/" (nth 0 (split-string (car (last (process-lines "pwclient" "search" "-n" "1" "-m" (concat "<" message-id ">"))))))))
* emacs: Honor debug-on-error for part renderersGravatar Austin Clements2014-04-19
| | | | | | Previously, even if debug-on-error was non-nil, the debugger would not trap on part renderer errors. This made debugging part renderer bugs frustrating, so let the debugger trap these errors.
* emacs: show: use orig-tags for tag displayGravatar Mark Walters2014-03-24
| | | | | This uses the previous patch to show the tag changes that have occured in the show buffer since it was last loaded/refreshed.
* emacs: show: mark tags changed since buffer loadedGravatar Mark Walters2014-03-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows (and requires) the original-tags to be passed along with the current-tags to be passed to notmuch-tag-format-tags. This allows the tag formatting to show added and deleted tags.By default a removed tag is displayed with strike-through in red (if strike-through is not available, eg on a terminal, inverse video is used instead) and an added tag is displayed underlined in green. If the caller does not wish to use the new feature it can pass current-tags for both arguments and, at this point, we do exactly that in the three callers of this function. Note, we cannot tidily allow original-tags to be optional because we would need to distinguish nil meaning "we are not specifying original-tags" from nil meaning there were no original-tags (an empty list). We use this in subsequent patches to make it clear when a message was unread when you first loaded a show buffer (previously the unread tag could be removed before a user realised that it had been unread). The code adds into the existing tag formatting code. The user can specify exactly how a tag should be displayed normally, when deleted, or when added. Since the formatting code matches regexps a user can match all deleted tags with a ".*" in notmuch-tag-deleted-formats. For example setting notmuch-tag-deleted-formats to '((".*" nil)) tells notmuch not to show deleted tags at all. All the variables are customizable; however, more complicated cases like changing the face depending on the type of display will require custom lisp. Currently this overrides notmuch-tag-deleted-formats for the tests setting it to '((".*" nil)) so that they get removed from the display and, thus, all tests still pass.
* Make keys of notmuch-tag-formats regexps and use cachingGravatar Austin Clements2014-03-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This modifies `notmuch-tag-format-tag' to treat the keys of `notmuch-tag-formats' as (anchored) regexps, rather than literal strings. This is clearly more flexible, as it allows for prefix matching, defining a fallback format, etc. This may cause compatibility problems if people have customized `notmuch-tag-formats' to match tags that contain regexp specials, but this seems unlikely. Regular expression matching has quite a performance hit over string lookup, so this also introduces a simple cache from exact tags to formatted strings. The number of unique tags is likely to be quite small, so this cache should have a high hit rate. In addition to eliminating the regexp lookup in the common case, this cache stores fully formatted tags, eliminating the repeated evaluation of potentially expensive, user-specified formatting code. This makes regexp lookup at least as fast as assoc for unformatted tags (e.g., inbox) and *faster* than the current code for formatted tags (e.g., unread): inbox (usec) unread (usec) assoc: 0.4 2.8 regexp: 3.2 7.2 regexp+caching: 0.4 0.4 (Though even at 7.2 usec, tag formatting is not our top bottleneck.) This cache must be explicitly cleared to keep it coherent, so this adds the appropriate clearing calls.
* emacs: use the originating buffer's working directory for pipeGravatar Jani Nikula2014-03-04
| | | | | | | | | | | | | Currently notmuch-show-pipe-message runs the command in the working directory of the *notmuch-pipe* buffer if it exists, and the current buffer's working directory (which is inherited to the new *notmuch-pipe* buffer) otherwise. This is all very surprising to the user, and it's difficult to know or change where the command will be run. Always use the current show buffer's working directory for piping. The user can check that with M-x pwd and change it with M-x cd. This is consistent with notmuch-show-pipe-part.
* emacs: update alist for mail-archive.com API changeGravatar Jed Brown2014-02-16
| | | | | | | | Searching by Message-Id no longer works via the old mail-archive.com API, though I have contacted them in hopes that they restore it to prevent dead links. Anyway, the new API is cleaner. Acked-by: Austin Clements <amdragon@MIT.EDU>
* emacs: add '?' to some prefix keymaps to describe its bindingsGravatar Mark Walters2013-12-10
| | | | | Added function notmuch-subkeymap-help to describe keybindings of a subkeymap (eg after . or c in notmuch-search and notmuch-show).
* emacs: show: stop stderr appearing in bufferGravatar Mark Walters2013-11-20
| | | | | | | | | | | | | | | | | | | | | | In emacs 24.3+ the stdout/stderr from externally displaying an attachment gets inserted into the show buffer. This is caused by changes in mm-display-external in mm-decode.el. Ideally, we would put this output in the notmuch errors buffer but the handler is called asynchronously so we don't know when the output will appear. Thus if we put it straight into the errors buffer it could get interleaved with other errors. Also we can't easily tell when we have got all the error output so can't wait until the process is complete. One solution would be to create a new buffer for the stderr of each attachment viewed. Again, since we can't tell when the process has finished, we can't close these buffers automatically so this will leave lots of buffers around. Thus we add a debug variable notmuch-show-attachment-debug: it this is non-nil we create a new buffer for each viewer; if this variable is nil we just use a temp buffer which means all error output is discarded (this is the same behaviour as with emacs pre 24.3).
* emacs: move the show entry to tree into show.elGravatar Mark Walters2013-11-07
| | | | Move the keybinding and show specific helper from tree.el to show.el
* emacs: Sanitize authors and subjects in search and showGravatar Austin Clements2013-10-27
| | | | | | Authors and subjects can contain embedded, encoded control characters like "\n" and "\t" that mess up display. Transform control characters into spaces everywhere we display them in search and show.
* emacs: Use interactive specifications for tag changes in showGravatar Austin Clements2013-10-25
| | | | | | | | | | | | | | | This modifies all tagging operations in show to call `notmuch-read-tag-changes' in their interactive specification to input tag changes, rather than depending on lower-level functions to prompt for tag changes regardless of their calling context. Besides being more Elispy and providing a more consistent programmatic API, this enables callers to provide two call site-specific pieces of information: an appropriate prompt, and the set of visible tags. The prompt lets us differentiate * from +/-. Providing visible tags enables a more consistent user experience than retrieving the (potentially different) tags from the database, and avoids a round-trip to the CLI and database.
* emacs: show: use interactive instead of current-prefix-argGravatar Mark Walters2013-10-19
| | | | | | | | | Currently notmuch-show looks at the prefix-arg directly via current-prefix-arg. This changes it to use the interactive specification. One test (for elide-toggle functionality) set the prefix arg directly. Update this test to set the new argument directly.
* emacs: Improve interactive use documentationGravatar Austin Clements2013-10-07
| | | | | | | | | | | | This improves the function documentation for many interactive commands, either by improving their documentation string where the improvement also makes sense for programmatic use or by adding a 'notmuch-doc property where it doesn't. For nearly all commands that support a prefix argument, this adds a 'notmuch-prefix-doc property to document their prefixed behavior This omits prefix documentation for a few commands where I thought the prefixed behavior was too obscure (or too complex to fit in one line).
* emacs: Clean up a few documentation stringsGravatar Austin Clements2013-10-07
| | | | | Correct some grammatical errors, fix some violations of standard documentation string formatting conventions, and be more precise.
* emacs: Move ?, q, s, m, =, and G to the common keymapGravatar Austin Clements2013-09-10
| | | | | | | | | The only user-visible effect of this should be that "G" now works in show mode (previously it was unbound for no apparent reason). This shared keymap gives us one place to put global commands, which both forces us to think about what commands should be global, and ensures their bindings can't diverge (like the missing "G" in show).
* emacs: Define a common shared keymap for all of notmuchGravatar Austin Clements2013-09-10
| | | | | This defines a single, currently empty keymap that all other notmuch mode maps inherit from.
* emacs: Add unified refresh-this-buffer functionGravatar Austin Clements2013-09-10
| | | | | | | | This unifies the various refresh and poll-and-refresh functions we have for different modes. Now all modes bind "=" and "G" (except show, which doesn't bind "G" for some reason) to `notmuch-refresh-this-buffer' and `notmuch-poll-and-refresh-this-buffer', respectively.
* emacs: add buttons for all multipart/related partsGravatar Istvan Marko2013-09-10
| | | | | | | | | When text/html parts include images as multipart/related and the text/plain alternative is used these images can be completely hidden with no easy way to access them or even find out that they are there. Make notmuch-show-insert-part-multipart/related add buttons for all parts, the first one visible the rest hidden.
* emacs: show: lazy part handling bugfixGravatar Mark Walters2013-09-10
| | | | | | | | | | | The lazy part handler had a bug that it allowed the button to be toggled to be specified. During toggling it needs to save and restore the text-properties for the button but it actually saved the text properties at point rather than from the button. In almost all cases this didn't matter as as point had the same text properties as the button. However, it is a bug and did cause incorrect behaviour in some cases: see id:87txhz14z6.fsf@qmul.ac.uk for details.
* emacs: insert quotable parts in reply as they are displayed in show viewGravatar Jani Nikula2013-09-05
| | | | | | | | | | | | | | | | In reply, insert quotable parts using notmuch-show-insert-bodypart instead of calling notmuch-mm-display-part-inline directly to render the quoted parts as they are rendered in show view. We use a temp buffer to not leak text properties from the show renderer into the reply. This way we also don't need to worry about narrowing or point placement. Credits to Mark Walters <markwalters1009@gmail.com> and Austin Clements <amdragon@MIT.EDU> for getting this part straight. The notable change is that replies to text/calendar parts quote the pretty printed output of icalendar-import-buffer rather than the ugly raw vcalendar.
* emacs: removed 3 duplicate functions from notmuch-show.elGravatar Tomi Ollila2013-08-27
| | | | | | | notmuch-show.el and notmuch.el had 3 duplicate, identical functions: notmuch-foreach-mime-part, notmuch-count-attachments and notmuch-save-attachments. Now these functions in notmuch-show.el are replaced with declare-functions pointing to "notmuch"(.el).
* emacs: bugfix attachment content-type as mime-type handlingGravatar Mark Walters2013-07-31
| | | | | | | | | | | | Notmuch puts attachments in as declared content-type except when the content-type is application/octet-stream it tries to guess the type from the filename/extension. This means that viewing a pdf (for example) which is sent as application/octet-strem invokes the pdf viewer rather than just offering to save the part. Recent changes to the attachment handling (commit 1546387d) changed (broke) this. This patch stores the calculated mime-type with the part and changes the attachment part handlers can use it instead.
* emacs: dropped rest of now-unused JSON functionalityGravatar Tomi Ollila2013-07-20
| | | | | | Notmuch cli provides all structured data previously provided in json format now in s-expression format, rendering all current json functionality obsolete.
* emacs: Remove v commandGravatar Austin Clements2013-06-24
| | | | | | | | This removes the v command, since we now have much nicer part commands, and deprecates the underlying notmuch-show-view-all-mime-parts. This also means that people who try using the old unprefixed 'v' command on a part button will no longer be greeted by ALL of their parts popping up.
* emacs: show: change emacs interactive pipe message.Gravatar Mark Walters2013-06-24
| | | | | | | | Previously the query string for piping a message to a command was "Pipe message to command: " regardless of whether the function was called with a prefix argument (which pipes all open messages to the command). This patch modifies the `interactive' command to reflect this.
* emacs: show: implement lazy hidden part handlingGravatar Mark Walters2013-06-13
| | | | | | | | | | | | | | | | | | | | | This adds the actual code to do the lazy insertion of hidden parts. We use a memory inefficient but simple method: when we come to insert the part if it is hidden we just store all of the arguments to the part insertion function as a button property. This means when we want to show the part we can just resume where we left off. One thing is that we can't tell if a lazy part will produce text until we try to render it so when unhiding a part we check to see if it rendered; if not we invoke the default part handler (e.g. an external viewer). Also, we would like to insert the lazy part at the start of the line after the part button. But if this line has some text properties (e.g. the colours for a following message header) then the lazy part gets these properties. Thus we start at the end of the part button line, insert a newline, insert the lazy part, and then delete the extra newline at the end of the part.
* emacs: show move addition of :notmuch-part to separate functionGravatar Mark Walters2013-06-13
| | | | | | This separates out the adding of the :notmuch-part text property to a separate function to simplify calling from the lazy part insertion code.
* emacs: show: modify the way hidden state is recorded.Gravatar Mark Walters2013-06-13
| | | | | | | | | | | | | | | | | Previously, whether a part was hidden or shown was recorded in the invisibility/visibility of the part overlay. Since we are going to have lazily rendered parts with no overlay store the hidden/shown state in the part button itself. Additionally, in preparation for the invisible part handling move the actual hiding of the hidden parts to insert-bodypart from create-part-overlays. Finally, we will need to know whether a part-insertion has done anything (it won't if the invisible part cannot be displayed by emacs) so we slightly rejig the code order in notmuch-show-toggle-part-invisibility to make it easier for the function to set an appropriate return value.
* emacs: show: pass button to create-overlaysGravatar Mark Walters2013-06-13
| | | | | Now that the bodypart code has the button we can pass that to create-overlays and simplify that.
* emacs: show: move the insertion of the header button to the top levelGravatar Mark Walters2013-06-13
| | | | | | | | | | | | | | | | | | | Previously each of the part insertion handlers inserted the part button themselves. Move this up into notmuch-show-insert-bodypart. Since a small number of the handlers modify the button (the encryption/signature ones) we need to pass the header button as an argument into the individual part insertion handlers. However, the declared-type argument was only used for the text for the part buttons we can now omit it. The patch is large but mostly simple. The only things of note are that we let the text/plain handler applies notmuch-wash to the whole part including the part button. In particular, notmuch-wash removes leading blank lines from a text/plain part, but since the button is counted as part of the part this does not happen with text/plain buttons that have a button. This is probably a bug in notmuch-wash but changing it does make several tests fail (that rely on this blank line) so, for the moment, keep the old behaviour.
* emacs: show: fake wash parts are handled at insert-bodypart levelGravatar Mark Walters2013-06-13
| | | | | | Earlier patches have moved the handling of wash fake inline patch parts to insert-bodypart so we can drop the function notmuch-show-insert-part-inline-patch-fake-part
* emacs: Fix applying stickiness to the :notmuch-part propertyGravatar Austin Clements2013-06-04
| | | | | | | | | | | Previously, we simply called pushnew to add :notmuch-part to the front-sticky and rear-nonsticky text property lists. This works if these are nil or lists, but they can also have the value t, meaning that all properties are front-sticky/rear-nonsticky. In this case, pushnew will signal an error because t is not a list. We never set these properties to t ourselves, but since we apply these property changes over arbitrary renderer output, we have to deal with this possibility.
* emacs: add `notmuch-archive-tags' cross references in docstringsGravatar David Bremner2013-06-02
| | | | | | Several function docstrings refer to behaviour in docstrings that is really controlled by notmuch-archive-tags. Add cross references, and replace hardcoding.
* emacs: remove hardcoded defaults values from docstringsGravatar David Bremner2013-06-02
| | | | | | These functions refer to default values of variables, but it seems less confusing and less likely to get out of date to just allow the user to follow the help cross-reference links.
* emacs: replace setq + let with let*Gravatar David Bremner2013-06-02
| | | | | | | I found several places where a setq is immediately followed by a let or a let*. This seems to be the pessimal combination, with the implicit scope of the setq combined with the extra indentation of the let. I combined these cases into a single let* which I think is easier to read.
* emacs: replace (funcall 'foo ...) with (foo ...)Gravatar David Bremner2013-06-02
| | | | | | I can't see any benefit to the funcall, and it looks like the result of cut-and-paste from some code that actually used a variable for the function to call.
* emacs: Bind MIME part commands to "." submapGravatar Austin Clements2013-05-31
| | | | | | | | | | | | | Since the part commands are no longer tied to a button, but can be applied with point anywhere within a part, bind the part commands keymap to "." everywhere in the show buffer. This lets you save or view parts without having to navigate to the part button, and is particularly useful for parts that have no button. This removes the un-prefixed MIME part commands from the part button keymap, but that's okay because those clashed in annoying ways with show buffer bindings like "s" for search. RET on part buttons is unaffected, which is the most important part button binding.
* emacs: Simplify MIME part command implementationGravatar Austin Clements2013-05-31
| | | | | | | | | | | | | | | | | | | | This unifies the part button actions and the underlying part action functions into single interactive command that simply applies to the part containing point using the just-added part p-list text property instead of button properties. Since all part actions can be performed by applying the appropriate mm function to an mm-handle, this patch abstracts out the creation of mm handles, making the implementations of the part commands trivial. This also eliminates our special handling for part save in favor of using the appropriate mm function. This necessarily modifies the way we handle the default part button action, but in a way that does not change the meaning of the notmuch-show-part-button-default-action defcustom. Since these commands are no longer specific to buttons, this patch eliminates the extra metadata stored with each button. This also eliminates one rather special-purpose macro for a collection of general purpose part handling utilities.
* emacs: Record part p-list in a text propertyGravatar Austin Clements2013-05-31
| | | | | | | This is similar to what we already do with the message p-list, though we apply the part's text property to the whole part's text, in contrast with the message p-list, which is (rather obscurely) only applied to the first character.
* emacs: Retain text properties when toggling buttonsGravatar Austin Clements2013-05-31
| | | | | | | | Previously, we lost any text properties applied to part buttons or wash buttons when they were toggled because `insert' directly copies the text properties of the string being inserted. Fix this by capturing the properties applied to the button beforehand and re-applying them after inserting the new text.
* emacs: add show view bindings to move to previous/next threadGravatar Jani Nikula2013-05-26
| | | | We have most of the plumbing in place, add the bindings M-n and M-p.
* emacs: Don't override mm-show-part in notmuch-show-view-partGravatar Austin Clements2013-05-26
| | | | | | | | | | | | | | Previously, notmuch-show-view-part overrode the function binding of mm-show-part to redirect it to notmuch-show-save-part to get notmuch's default file name handling in case mm-display-part decided to fall back to saving the part. In addition to being messy, this depended on the now-deprecated dynamic binding behavior of flet. This patch removes the mm-show-part override in favor of passing the file name in to mm-show-part the way it expects, so we get its default file name handling. It's not clear why we didn't do this before; mm-show-part has supported default file names since at least Emacs 23.1.