aboutsummaryrefslogtreecommitdiffhomepage
path: root/emacs/notmuch-wash.el
Commit message (Collapse)AuthorAge
* 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: 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: 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: 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: 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 configurable wrapping width for notmuch-wash-wrap-long-linesGravatar Daniel Schoepe2012-06-29
| | | | | | This introduces a variable to control after how many characters a line is wrapped by notmuch-wash-wrap-long-lines (still wrapping at the window width if it is lower).
* emacs: fix `notmuch-wash-region-to-button' to work at beginning of bufferGravatar Dmitry Kurochkin2012-02-04
| | | | | | | | | | | | | | | | | | `Notmuch-wash-region-to-button' is the function that creates hidden regions with buttons for signatures, citations and original messages. Before the change, it did not work correctly if the to-be-hidden region started at the beginning of a message: the visibility toggle button was hidden as well. The patch fixes this. There are two parts in the fix: * Use `insert-before-markers' instead of `insert' for creating the button, so that it does not get added to the hidden overlay. * Stop using PREFIX argument for adding a newline before the button. The newline should not be added before a button at the beginning of buffer. The corresponding test is fixed now.
* emacs: globally replace non-branching "(if COND (progn ..." with "(when ..."Gravatar Pieter Praet2012-02-01
| | | | Less code, same results, without sacrificing readability.
* emacs: create patch filename from subject for inline patch fake partsGravatar Jani Nikula2011-12-28
| | | | | | | | | | | | | | | | | | | | | Use the mail subject line for creating a descriptive filename for the wash generated inline patch fake parts. The names are similar to the ones created by 'git format-patch'. If the user has notmuch-wash-convert-inline-patch-to-part hook enabled in notmuch-show-insert-text/plain-hook, this will change the old default filename of "inline patch" in fake parts: [ inline patch: inline patch (as text/x-diff) ] into, for example: [ 0002-emacs-create-patch-filename-from-subject-for-inline.patch: inline patch (as text/x-diff) ] which is typically the same filename the sender had if he was using 'git format-patch' and 'git send-email'. Signed-off-by: Jani Nikula <jani@nikula.org>
* emacs: add inline patch fake parts through a special handlerGravatar Jani Nikula2011-12-28
| | | | | | | | Add wash generated inline patch fake parts through a special "inline-patch-fake-part" handler to distinguish them from real MIME parts. The fake parts are described as "inline patch (as text/x-diff)". Signed-off-by: Jani Nikula <jani@nikula.org>
* fix sum moar typos [user-visible documentation in code]Gravatar Pieter Praet2011-06-23
| | | | | | | | | | | | Various typo fixes in documentation within the code that can be made available to the user, (emacs function help strings, "notmuch help" output, notmuch man page, etc.). Signed-off-by: Pieter Praet <pieter@praet.org> Edited-by: Carl Worth <cworth@cworth.org> Restricted to just documentation and fixed fix of "comman" to "common" rather than "command".
* Set higher priority for headers and hidden citation overlays.Gravatar Dmitry Kurochkin2011-06-15
| | | | | | | | | | | Before the patch, message, headers and hidden citation overlays had zero priority. All these overlay have `invisible' property. Emacs documentation says that we should not make assumptions about which overlay will prevail when they have the same priority [1]. It happens to work as we need, but we should not rely on undocumented behavior. [1] http://www.gnu.org/s/emacs/manual/html_node/elisp/Overlay-Properties.html
* Fix hiding a message while some citations are shown in notmuch-show view.Gravatar Dmitry Kurochkin2011-06-15
| | | | | | | | | | | | | | | | | | | Before the change, message and citation invisibility overlays conflicted: if some citation is made visible and then the whole message is hidden, that citation remained visible. This happened because the citation's overlay has an invisible property which takes priority over the message overlay. The message invisibility spec does not affect citation visibility, it is determined solely by the citation overlay invisibility spec. Hence, if citation is made visible, it is not hidden by message invisibility spec. The patch changes citation overlay invisibility property to be a list which contains both the citation and the message invisibility specs. This makes the citation invisible if either of them is added to the `buffer-invisibility-spec'. Note that all citation visibility states are "restored" when the message hidden and shown again.
* Pass message to the `notmuch-show-insert-text/plain-hook' hook.Gravatar Dmitry Kurochkin2011-06-15
| | | | | | | | Before the change, the `notmuch-show-insert-text/plain-hook' was given only the `depth' argument. The patch adds another one - the message. Currently, the new message argument is not used by any on the hooks. But it will be used later to get access to message invisibility specs when wash buttons are inserted.
* Workaround for Emacs bug #8721.Gravatar Dmitry Kurochkin2011-06-15
| | | | | | | | | | | The emacs bug is that isearch cannot search through invisible text when the 'invisible' property is a list. The patch adds `notmuch-isearch-range-invisible' function which is the same as `isearch-range-invisible' but with fixed Emacs bug #8721. Advice added for `isearch-range-invisible' which calls `notmuch-isearch-range-invisible' instead of the original `isearch-range-invisible' when in `notmuch-show-mode'.
* notmuch.el: hide original message in top posted replies.Gravatar David Bremner2011-06-10
| | | | | | | | | | | | | This code treats top posted copies essentially like signatures, except that it doesn't sanity check their length, since neither do their senders. New user-visible variables: notmuch-wash-button-original-hidden-format notmuch-wash-button-original-visible-format Rebased-by: Carl Worth <cworth@cworth.org>
* emacs: Use "message-cited-text" instead of "message-cited-text-face"Gravatar Pieter Praet2011-06-01
| | | | | | | | | (describe-face 'message-cited-text-face) > message-cited-text-face is an alias for the face `message-cited-text'. > This face is obsolete since 22.1; use `message-cited-text' instead. Signed-off-by: Pieter Praet <pieter@praet.org> Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>
* Carefully manage save/restore of point in ↵Gravatar Dmitry Kurochkin2011-05-24
| | | | | | | | | | | | `notmuch-wash-toggle-invisible-action'. Before the change, save-excursion was used to save the point. But the marker saved by save-excursion was inside a region that was deleted, so that approach is unreliable, (leading to point jumping to a new position past the button). This patch instead saves point in an integer variable, and when restoring, carefully avoids moving point past the button, (in case the new button label is shorter than the old button label).
* Use different labels for wash buttons when text is visible or hidden.Gravatar Dmitry Kurochkin2011-05-24
| | | | | | | | | Before the change, citation and signature wash buttons used the same label in both visible and hidden states. Sometimes it is very convenient when you can determine if the text is hidden or shown without reading the context and/or clicking the button. The patch makes it easy to see if the text is shown or hidden by explicitly saying what the button does (shows or hides the text).
* emacs: Remove over-eager regular expressions from notmuch-wash-tidy-citations.Gravatar David Edmondson2010-12-07
| | | | | | | The removed expressions, which were used to ensure that citations were both preceded and followed by a blank line, were poorly implemented and caused a regexp stack overflow on messages more than a few thousand lines long.
* emacs: Correctly count the number of lines in a signature.Gravatar David Edmondson2010-11-11
|
* emacs: More functionality for `notmuch-wash-tidy-citations'.Gravatar David Edmondson2010-06-03
| | | | | | Add: - Insert a blank line before a citation if there isn't one, - Insert a blank line after a citation if there isn't one.
* emacs: Add missing parenthesis that was breaking the build.Gravatar Carl Worth2010-04-27
| | | | | Someday I'll stop pushing patches without at least compile-testing them. *sigh*
* emacs/notmuch-wash.el: Add `notmuch-wash-convert-inline-patch-to-part'.Gravatar David Edmondson2010-04-27
| | | | | | Detect inline patches and convert them to fake attachments, in order that `diff-mode' highlighting can be applied to the patch. This can be enabled by customising `notmuch-show-insert-text/plain-hook'.
* emacs: Add more functions to clean up text/plain partsGravatar David Edmondson2010-04-26
| | | | | | | | | | | | | | | | | | Add: - notmuch-wash-wrap-long-lines: Wrap lines longer than the width of the current window whilst maintaining any citation prefix. - notmuch-wash-tidy-citations: Tidy up citations by: - compress repeated otherwise blank citation lines, - remove otherwise blank citation lines at the head and tail of a citation, - notmuch-wash-elide-blank-lines: Compress repeated blank lines and remove leading and trailing blank lines. None of these is enabled by default - add them to `notmuch-show-insert-text/plain-hook' to use. Reviewed-by: Carl Worth <cworth@cworth.org>: I previously committed a stale version of this patch.
* Revert "emacs: Add more functions to clean up text/plain parts"Gravatar Carl Worth2010-04-26
| | | | This reverts commit 97570954cb583cacac35b0235cbe449a07630ae3.
* emacs: Add more functions to clean up text/plain partsGravatar David Edmondson2010-04-24
| | | | | | | | | | | | | | | | | | | | | | | Add: - notmuch-wash-wrap-long-lines: Wrap lines longer than the width of the current window whilst maintaining any citation prefix. - notmuch-wash-tidy-citations: Tidy up citations by: - compress repeated otherwise blank citation lines, - remove otherwise blank citation lines at the head and tail of a citation and remove blank lines between attribution statements and the citation, - notmuch-wash-compress-blanks: Compress repeated blank lines and remove leading and trailing blank lines. Enable `notmuch-wash-tidy-citations' and `notmuch-wash-compress-blanks' by default by adding them to `notmuch-show-insert-text/plain-hook'. `notmuch-wash-wrap-long-lines' is not enabled by default. If `notmuch-wash-wrap-long-lines' is enabled, word wrapping of the buffer leads to an unappealing display of text, so provide a function to disable it and add it to the list of `notmuch-show-mode' hook functions.
* emacs: Fix i-search to open up invisible citations as necessaryGravatar David Edmondson2010-04-24
| | | | | | Add an `isearch-open-invisible' property to the overlays used to hide citations and signatures, together with an appropriate function to leave the invisible text visible should that be required.
* emacs: Move body markup to a separate fileGravatar David Edmondson2010-04-21
Move the citation and signature markup for text/plain parts to a new file (notmuch-wash.el) and call it using a hook mechanism rather than directly.