aboutsummaryrefslogtreecommitdiffhomepage
path: root/emacs/notmuch-show.el
Commit message (Collapse)AuthorAge
* 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.
* emacs: show: handle inline patch fake parts at top levelGravatar Mark Walters2013-05-20
| | | | | The inline patch fake part handler also modifies the content-type so handle this in notmuch-show-insert-bodypart too.
* emacs:show: separate out handling of application/octet-streamGravatar Mark Walters2013-05-20
| | | | | | | | | | Currently mime parts are basically handled based on their mime-type with the exception of application/octet-stream parts. Deal with these parts at the top level (notmuch-show-insert-bodypart). This is needed later in the series as we need to put in a part button for each part (which means knowing its mime type) while deferring the actual insertion of the part.
* emacs: add kernel.org mail archive redirectorGravatar Jani Nikula2013-05-05
| | | | See http://lkml.kernel.org/
* emacs: fixed (declare-function ...) definitionsGravatar Tomi Ollila2013-04-30
| | | | | | | | Some (declare-function ...) definitions were drifted away from the actual (defun ...)'s. To find the drifts and to verify changes the following command line was used: $ emacs --batch -L emacs --eval '(check-declare-directory "emacs")'
* emacs: possibility to customize the rendering of tagsGravatar Damien Cassou2013-03-25
| | | | | | | | | | | | | | | | | This patch extracts the rendering of tags in notmuch-show to the notmuch-tag file. This file introduces a `notmuch-tag-formats' variable that associates each tag to a particular format. This variable can be customized thanks to the work of Austin Clements. For example, '(("unread" (propertize tag 'face '(:foreground "red"))) ("flagged" (notmuch-tag-format-image tag "star.svg"))) associates a red foreground to the "unread" tag and a star picture to the "flagged" tag. Signed-off-by: Damien Cassou <damien.cassou@gmail.com>
* emacs: show: make buttons select windowGravatar Mark Walters2013-02-18
| | | | | | | | | | | | | | Emacs has two button type objects: widgets (as used for saved searches in notmuch-hello) and buttons as used by parts/citations and id links in notmuch-show. These two behave subtly differently when clicked with the mouse: widgets select the window clicked before running the action, buttons do not. This patch makes all of these behave the same: clicking always selects the clicked window. It does this by defining a notmuch-button-type supertype that the other notmuch buttons can inherit from. This supertype binds the mouse-action to select the window and then activate the button.
* emacs: show: w3m/invisibility workaroundGravatar Mark Walters2013-01-14
| | | | | | | | | | | | | | | | | | There is a bug in the current notmuch code with w3m and invisible parts. w3m sets a keymap, and if we have a hidden [text/html] point at the start of the following line still gets this w3m keymap which causes some strange effects. For example, RET gives an error "No URL at Point" rather than hiding the message, <down> goes to the next link rather than just down a line. These keybinding are also inconvenient when the text/html part is displayed so we ask w3m not to install a keymap. This is only likely to be a problem for emacs 23 as shr is preferred as html renderer on emacs 24 (although the user can set the renderer to w3m even on emacs 24). This solution was suggested by Tomi Ollila <tomi.ollila@iki.fi>
* emacs: show: set default show-all-multipart/alternatives to nilGravatar Mark Walters2012-12-21
| | | | | | Now that the invisibility display of parts is present we no longer need to force the display of all multipart/alternatives: users can toggle them for themselves when needed.
* emacs: show: add invisibility button actionGravatar Mark Walters2012-12-21
| | | | | | | | | This adds a button action to show hidden parts. In this version "RET" toggles the visibility of any part which puts content in the buffer (as opposed to attachments such as application/pdf). The button is used to hide parts when appropriate (eg text/html in multipart/alternative).
* emacs: show: add overlays for each partGravatar Mark Walters2012-12-21
| | | | | | | | | | | This makes notmuch-show-insert-bodypart add an overlay for any non-trivial part with a button header (currently the first text/plain part does not have a button). At this point the overlay is available to the button but there is no action using it yet. In addition the argument HIDE is passed down to notmuch-show-insert-part-overlays to request that the part be hidden by default but this is not acted on yet.
* emacs: show: modify insert-part-header to save the button textGravatar Mark Walters2012-12-21
| | | | | | | This just make notmuch-show-insert-part-header save the basic button text for parts as an attribute. This makes it simpler for the button action (added in a later patch) to reword the label as appropriate (eg append "(not shown)" or not as appropriate).
* emacs: Eliminate buffer invisibility specs from show and washGravatar Austin Clements2012-12-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, all visibility in show buffers for headers, message bodies, and washed text was specified by generating one or more symbols for each region and creating overlays with their 'invisible property set to carefully crafted combinations of these symbols. Visibility was controlled not by modifying the overlays directly, but by adding and removing the generated symbols from a gigantic buffer invisibilty spec. This has myriad negative consequences. It's slow because Emacs' display engine has to traverse the buffer invisibility list for every overlay and, since every overlay has its own symbol, this makes rendering O(N^2) in the number of overlays. It composes poorly because symbol-type 'invisible properties are taken from the highest priority overlay over a given character (which is often ambiguous!), rather than being gathered from all overlays over a character. As a result, we have to include symbols related to message hiding in the wash code lest the wash overlays un-hide parts of hidden messages. It also requires various workarounds for isearch to properly open overlays, to set up buffer-invisibility-spec for remove-from-invisibility-spec to work right, and to explicitly refresh the display after updating the buffer invisibility spec. None of this is necessary. This patch converts show and wash to use simple boolean 'invisible properties and to not use the buffer invisibility spec. Rather than adding and removing generated symbols from the invisibility spec, the code now directly toggles the 'invisible property of the appropriate overlay. This speeds up rendering because the display engine only has to check the boolean values of the overlays over a character. It composes nicely because text will be invisible if *any* overlay over it has 'invisible t, which means we can overlap invisibility overlays with abandon. We no longer need any of the workarounds mentioned above. And it fixes a minor bug for free: now, when isearch opens a washed region, the button text will update to say "Click/Enter to hide" rather than remaining unchanged.
* emacs: add support for stashing the thread id in show viewGravatar Jani Nikula2012-12-09
| | | | | Add a prefix argument to notmuch-show-stash-message-id to stash thread id instead of message id.
* emacs: show: refresh buffer did not remove overlaysGravatar Mark Walters2012-12-06
| | | | | | | | | Previously refreshing the notmuch show buffer did not remove overlays which meant that if the user refreshed a message with images the images would remain and then the new text was added after. One might have guessed that erase-buffer would have removed them but it seems not. Thus force the removal of overlays with remove-overlays.