aboutsummaryrefslogtreecommitdiffhomepage
path: root/emacs
Commit message (Collapse)AuthorAge
* emacs: update .gitignoreGravatar David Bremner2013-06-02
| | | | Start a seperate .gitignore for emacs stuff, move .elc rule there.
* 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: Use streaming S-expr parser for searchGravatar Austin Clements2013-06-01
| | | | | | | | | | | | In addition to being the Right Thing to do, this noticeably improves the time taken to display the first page of search results, since it's roughly an order of magnitude faster than the JSON parser. Interestingly, it does *not* significantly improve the time to completely fill a large search buffer because for large search buffers, the cost of creating author invisibility overlays and inserting text (which slows down with more overlays) dominates. However, the time required to display the first page of results is generally more important to the user experience.
* emacs: Streaming S-expression parserGravatar Austin Clements2013-06-01
| | | | | | | | | | | | | | | | | This provides the same interface as the streaming JSON parser, but reads S-expressions incrementally. The only difference is that the `notmuch-sexp-parse-partial-list' helper does not handle interleaved error messages (since we now have the ability to separate these out at the invocation level), so it no longer takes an error function and does not need to do the horrible resynchronization that the JSON parser had to. Some implementation improvements have been made over the JSON parser. This uses a vector instead of a list for the parser data structure, since this allows faster access to elements (and modern versions of Emacs handle storage of small vectors efficiently). Private functions follow the "prefix--name" convention. And the implementation is much simpler overall because S-expressions are much easier to parse.
* emacs: Use async process helper for searchGravatar Austin Clements2013-06-01
| | | | | | | | | | Previously, search started the async notmuch process directly. Now, it uses `notmuch-start-notmuch'. This simplifies the process sentinel a bit and means that we no longer have to worry about errors interleaved with the JSON output. We also update the tests of Emacs error handling, since the error output is now separated from the search results buffer.
* emacs: Utilities to manage asynchronous notmuch processesGravatar Austin Clements2013-06-01
| | | | | | | | This provides a new notmuch-lib utility to start an asynchronous notmuch process that handles redirecting of stderr and checking of the exit status. This is similar to `notmuch-call-notmuch-json', but for asynchronous processes (and it leaves output processing to the caller).
* 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: Fix trimming regexp in notmuch-check-exit-statusGravatar Austin Clements2013-05-27
| | | | | | | | | | | | | | | | | | | | | | | | | For such a simple regexp, this was broken in a very complicated way. The intent was to strip the newline (and potentially other whitespace) off the end of the error string so there wasn't an extra newline in the error signal. However, the regexp was deeply dependent on the active syntax table and the subtleties of $. We didn't notice this because all notmuch major modes put ?\n in the whitespace class, which makes this behaved as intended: the "\\s " matches all newlines, but by matching the newline character, causes the $ *not* to match *except* where it matched the empty string at the very end of the string, which was not followed by a newline. However, if the syntax table declares ?\n to be non-whitespace (lisp-mode declares it as endcomment, and is likely to be the mode you're in when testing functions), then this regexp behaves completely differently, matching trailing spaces at the end of every line within the string. The solution is to say what we mean for whitespace *and* to switch from $ to \', which matches only the end of the string, rather than the end of each line. Both are necessary or this will strip away interior newlines, which is not what we want.
* 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: Compute build dependencies to fix byte compile issuesGravatar Austin Clements2013-05-23
| | | | | | | | | | | | | | | | Previously, we simply byte compiled each Elisp source file independently. This is actually the wrong thing to do and can lead to issues with macros and performance issues with substitutions because 1) when the byte compiler encounters a (require 'x) form, it will load x.elc in preference to x.el, even if x.el is newer, and as a result may load old macro and substitution definitions and 2) if we update a macro or substitution definition in one file, we currently won't re-compile other files that depend on the file containing the definition. This patch addresses these problems by computing make dependency rules from the (require 'x) forms in the Elisp source files, which we inject into make's dependency database.
* 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: Proper error string handling in search sentinelGravatar Austin Clements2013-05-18
| | | | | | | Apparently Emacs provides a function to stringify errors properly. Use this in the search sentinel where we have to do our own error messaging, rather than assuming the first error argument will be the descriptive string.
* emacs: tag: fix compile warningGravatar Mark Walters2013-05-15
| | | | | | | | When compiling notmuch-tag.el there is a compile warning: notmuch-tag.el:27:1:Warning: cl package required at runtime Since we have decided to allow runtime use of cl we suppress this warning by adding a tail comment to the file.
* emacs: removed code attempting to support emaces prior to version 23Gravatar Tomi Ollila2013-05-13
| | | | | | | | | The support for emacs version 22 has not worked at least since September 2011 when I attempted to use it. I expanded the support in id:yf6ippgtbn0.fsf@taco2.nixu.fi but that was not enough and then I found it easier to switch to emacs 23. In case one wants to resurrect emacs 22 (or earlier!) support, pick the changes from the patch email referenced above.
* emacs/notmuch-address.el: add notmuch-address-selection-functionGravatar Tomi Ollila2013-05-13
| | | | | | | | | | | | | | | | | | | Added a customizable variable notmuch-address-selection-function and the function with the same name to provide a way for user to change the function called to do address selection. By default the functionality is exactly the same as it has been so far; completing-read is called with the same parameters as before. Setting equivalent lambda expression in place of using notmuch-address-selection-function function is done as follows: (setq notmuch-address-selection-function (lambda (prompt collection initial-input) (completing-read prompt collection nil nil initial-input))) For example drop-in replacement with ido-completing-read can be done easily as an one alternative to the default.
* 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")'
* Revert "emacs: functions to import sender or recipient into BBDB"Gravatar David Bremner2013-04-06
| | | | | | | | This reverts commit 238bf4cb09423cac4efa968e70184daad39e2846. This commit was causing a build failure. Bad me for not checking before pushing.
* emacs: functions to import sender or recipient into BBDBGravatar Daniel Bergey2013-04-06
| | | | | | | | From a show buffer, notmuch-bbdb/snarf-from imports the sender into bbdb. notmuch-bbdb/snarf-to imports all recipients. Newly imported contacts are reported in the minibuffer / Messages buffer. Both functions use the BBDB parser to recognize email address formats.
* emacs: hello: use batch countGravatar Mark Walters2013-04-01
| | | | | | | | | | | | This modifies notmuch hello to use the new count --batch functionality. It should give exactly the same results as before but under many conditions it should be much faster. In particular it is much faster for remote use. The code is a little ugly as it has to do some working out of the query when asking the query and some when dealing with the result. However, the code path is exactly the same in both local and remote use.
* emacs: introduce notmuch-command-to-string, replace use of ↵Gravatar David Bremner2013-04-01
| | | | | | | | | shell-command-to-string This has two benefits: unified error handling, and avoiding tramp's hooking into shell-command-string. This seems to be a fix for id:874nguxbvq.fsf@tu-dortmund.de
* 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: Add notmuch-combine-face-text-property-stringGravatar Damien Cassou2013-03-25
| | | | Signed-off-by: Damien Cassou <damien.cassou@gmail.com>
* emacs: Combine string faces and combine under existing facesGravatar Austin Clements2013-03-25
| | | | | | This improves notmuch-combine-face-text-property to support both applying faces to strings and to support combining the given face under existing faces, rather than over.
* emacs: Handle all face forms when combining facesGravatar Austin Clements2013-03-25
| | | | | | | | | | | | | | | Previously, notmuch-combine-face-text-property assumed that any existing face properties of the modified text were already in face list form. This was true as long as it was the only function manipulating faces (since it always produced a list form face), but if anything else has manipulated the face, it was more likely to be either a face name or a face plist. It also didn't correctly handle face lists as arguments, even though the doc string claimed it did. This patch fixes notmuch-combine-face-text-property to handle all face forms correctly by canonicalizing both the argument face and the existing faces into list form. This also means we can set the face to a simpler non-list form if there's no existing face.
* 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: don't use deprecated "notmuch search-tags" commandGravatar David Bremner2013-01-22
| | | | | A followup patch will finally remove this command, so we need to stop using it.
* 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: Use the minibuffer for CLI error reportingGravatar Austin Clements2013-01-06
| | | | | | | | | | | | | | | | We recently switched to popping up a buffer to report CLI errors, but this was too intrusive, especially for transient errors and especially since we made fewer things ignore errors. This patch changes this to display a basic error message in the minibuffer (using Emacs' usual error handling path) and, if there are additional details, to log these to a separate error buffer and reference the error buffer from the minibuffer message. This is more in line with how Emacs typically handles errors, but makes the details available to the user without flooding them with the details. Given this split, we pare down the basic message and make it more user-friendly, and also make the verbose message even more detailed (and more debugging-oriented).
* 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: Use --format-version for search, show, and replyGravatar Austin Clements2012-12-16
|
* emacs: Special handling for version mismatch errorsGravatar Austin Clements2012-12-16
| | | | | Since Emacs has more semantic information, we suppress the generic format version error from the CLI and give a more informative error.
* emacs: Use unified error handling in searchGravatar Austin Clements2012-12-16
| | | | | | This slightly changes the output of an existing test since we now report non-zero exits with a pop-up buffer instead of at the end of the search results.
* emacs: Improve error handling for notmuch-call-notmuch-jsonGravatar Austin Clements2012-12-16
| | | | | | This checks for non-zero exit status from JSON CLI calls and pops up an error buffer with stderr and stdout. A consequence of this is that show and reply now handle errors, rather than ignoring them.
* emacs: Factor out synchronous notmuch JSON invocationsGravatar Austin Clements2012-12-16
| | | | | | Previously this code was duplicated between show and reply. This factors out synchronously invoking notmuch and parsing the output as JSON.
* emacs: Use unified error handling in notmuch-call-notmuch-processGravatar Austin Clements2012-12-16
| | | | | | This makes notmuch-call-notmuch-process use the unified CLI error handling, which basically refines the error handling this function already did.
* emacs: Centralize notmuch command error handlingGravatar Austin Clements2012-12-16
| | | | | | | This provides library functions for unified handling of errors from the notmuch CLI. Follow-up patches will convert some scattered error handling to use this and add error handling where we currently ignore errors.
* emacs: Fix bug in resynchronizing after a JSON parse errorGravatar Austin Clements2012-12-15
| | | | | | | | | | | | | | | Previously, if the input stream consisted only of an error message, notmuch-json-begin-compound would signal a (wrong-type-argument number-or-marker-p nil) error when reaching the end of the error message. This happened because notmuch-json-scan-to-value would think that it reached a value and put the parser into the 'value state. Even after notmuch-json-begin-compound signaled the syntax error, the parser would remain in this state and when the resynchronization logic reached the end of the buffer, the parser would fail because the 'value state indicates that characters are available. This fixes this problem by restoring the parser's previous state if it encounters a syntax error.