aboutsummaryrefslogtreecommitdiffhomepage
path: root/emacs/notmuch.el
Commit message (Collapse)AuthorAge
* 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: search archive tweakGravatar Mark Walters2014-07-15
| | | | | | | notmuch-search-archive-thread moves to the next line after tagging. In the normal case this makes sense, but if the region is active, it tags the whole region and then it doesn't really. Thus only move to the next line if region is not active.
* Merge branch 'release'Gravatar David Bremner2014-05-28
|\ | | | | | | | | A point release is slowly being built on branch release. Merge those changes into master.
| * emacs: make sure tagging on an empty query is harmlessGravatar Mark Walters2014-05-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently notmuch-tag throws a "wrong-type-argument stringp nil" if passed a nil query-string. Catch this and provide a more useful error message. This fixes a case in notmuch-tree (if you try to tag when at the end of the buffer). Secondly, as pointed out by David (dme) `notmuch-search-find-stable-query-region' can return the query string () if there are no messages in the region. This gets passed to notmuch tag, and due to interactions in the optimize_query code in notmuch-tag.c becomes, in the case tag-change is -inbox, "( () ) and (tag:inbox)". This query matches some strange collection of messages which then get archived. This should probably be fixed, but in any case make `notmuch-search-find-stable-query-region' return a nil query-string in this case. This avoids data-loss (random tag removal) in this case.
* | emacs: Correct the documentation for `notmuch-search-line-faces'.Gravatar David Edmondson2014-05-18
|/ | | | | | | The implementation and documentation for `notmuch-search-line-faces' disagreed in how elements in the list were merged. Correct the documentation to match the implementation (that is, the earlier elements in the list have precedence over later elements).
* emacs: hello: use the saved-search helper functionsGravatar Mark Walters2014-04-11
| | | | | This uses the helper functions: the saved searches format has not changed yet but backwards compatibility means everything still works.
* emacs: add notmuch-version.el.tmpl and create notmuch-version.el from itGravatar Tomi Ollila2014-04-10
| | | | | | | | | The notmuch cli program and emacs lisp versions may differ (especially in remote usage). It helps to resolve problems if we can determine the versions of notmuch cli and notmuch emacs mua separately. The build process now creates notmuch-version.el from template file by filling the version info to notmuch-emacs-version variable.
* emacs: add defcustom notmuch-init-file and load it if existsGravatar Tomi Ollila2014-03-30
| | | | | | | So that users can easily organize their notmuch-specific configurations to separate file and they don't have to have notmuch configurations in *every* emacs installation they launch, especially if those need to '(require notmuch) to make the configurations possible.
* emacs: instruct user to autoload notmuch instead of require'ing itGravatar Tomi Ollila2014-03-30
| | | | | | | | | | | | | When (require 'notmuch) is added to ~/.emacs notmuch is loaded to every instance of emacs although it may not be used in majority of those instances. When (autoload 'notmuch "notmuch" ...) is added to ~/.emacs notmuch is loaded (only) when user invokes the notmuch function. User may want to add other entrypoints to notmuch by adding more autoloads -- the autoload instruction given should offer them clue how to do so.
* emacs: search: use orig-tags in searchGravatar Mark Walters2014-03-24
| | | | | | | This uses the recent functionality to show the tag changes in the search buffer. Currently this is only used to show changes the search buffer makes itself: i.e., it does not make display any changes reflecting tagging done by other notmuch-buffers.
* 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: Combine notmuch-combine-face-text-property{, -string}Gravatar Austin Clements2014-03-24
| | | | | | | | | This combines our two face combining functions into one, easy to use function with a much shorter name: `notmuch-apply-face'. This function takes the full set of arguments that `notmuch-combine-face-text-property' took, but takes them in a more convenient order and provides smarter defaults that make the function easy to use on both strings and buffers.
* emacs: add path: prefix to query completionGravatar Jani Nikula2014-03-23
| | | | Complete to the new path: prefix.
* 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: Fix search tagging racesGravatar Austin Clements2013-11-08
| | | | | | | | | | | | | | This fixes races in thread-local and global tagging in notmuch-search (e.g., "+", "-", "a", "*", etc.). Previously, these would modify tags of new messages that arrived after the search. Now they only operate on the messages that were in the threads when the search was performed. This prevents surprises like archiving messages that arrived in a thread after the search results were shown. This eliminates `notmuch-search-find-thread-id-region(-search)' because these functions strongly encouraged racy usage. This fixes the two broken tests added by the previous patch.
* emacs: Move `notmuch-call-notmuch-process' to notmuch-libGravatar Austin Clements2013-11-08
| | | | | | | Previously, this was in notmuch.el, but all of the other notmuch call wrappers were in notmuch-lib.el. Move `notmuch-call-notmuch-process' to live with its friends. This happens to fix a missing dependency from notmuch-tag.el, which required notmuch-lib, but not notmuch.
* emacs: move search based tree functions to notmuch.elGravatar Mark Walters2013-11-07
| | | | | Move a couple of the search mode specifc caller helpers for tree from tree into notmuch.el.
* emacs: minimal change to load notmuch-tree by defaultGravatar Mark Walters2013-11-07
| | | | | | | | | | We want to load notmuch-tree when notmuch is loaded, so include it as a require in notmuch.el. To avoid circular dependency we need to move one keybinding from notmuch-tree.el to notmuch.el: it makes sense for it to be defined there anyway. Since tree is now loaded by default there is no need to print a message when it is loaded.
* emacs: move notmuch-help to libGravatar Mark Walters2013-11-07
| | | | | | notmuch-help is in notmuch.el not notmuch-lib.el and this is incovenient for the way pick/tree uses it. I think lib makes more sense anyway so move it there.
* 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 searchGravatar Austin Clements2013-10-25
| | | | | | | | | | This is similar to the previous commit, but applies to search. Search is somewhat more complicated because its tagging operations can also apply to a region. Hence, this lifts interactive prompting into a helper function. This also takes advantage of the new ability to provide a prompt to distinguish tagging a single thread from tagging a region of threads.
* emacs: Fix misuse of `notmuch-tag'Gravatar Austin Clements2013-10-25
| | | | | | | | | The calling convention for `notmuch-tag' changed in commit 97aa3c06 to take a list of tag changes instead of a &rest argument, but the call from `notmuch-search-tag-all' still passed a &rest argument. This happened to work for interactive calls because tag-changes would be nil, so the `apply' call would pass only the query string to `notmuch-tag' and simply omit the &optional tag-changes argument.
* 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: Improved `notmuch-describe-keymap' documentationGravatar Austin Clements2013-10-10
|
* 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: Support overriding help and describing prefix actionGravatar Austin Clements2013-10-07
| | | | | | | | | | | | | | | | | | | | | | | | Traditionally, function documentation strings are intended primarily for programmers, rather than users. They're written from the perspective of calling the function, not interactively invoking it. They're only ever displayed along with the function prototype (and often refer to argument names). And built-in help commands like `describe-bindings' show the name of the command, not its documentation. The notmuch help system is like `describe-bindings', but tries to be more user-friendly by displaying documentation strings, rather than Elisp command names. For most commands, this is fine, but for some the "programmer description" is inappropriate for interactive use. This is particularly noticeable for commands that take an optional prefix argument. This patch adds support for two symbol properties: notmuch-doc and notmuch-prefix-doc, which let a command override its interactive documentation and provide separate documentation for its prefixed invocation. If notmuch-prefix-doc is present, we add an extra line to the help giving the prefixed key sequence along with the documentation for the prefixed command.
* 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: bugfix unquoted symbolGravatar Mark Walters2013-09-15
| | | | | | | | In the recent changes for search order handling the default-value of notmuch-search-oldest-first was used. However, default-value needs a symbol so the symbol-name needs to be quoted. This missing quote was causing strange sort-orders in some cases.
* 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: Make notmuch-help work with arbitrary keymapsGravatar Austin Clements2013-09-10
| | | | | | | | This converts notmuch-help to use map-keymap for all keymap traversal. This generally cleans up and simplifies construction of keymap documentation, and also makes notmuch-help support anything that can be in a keymap, including more esoteric stuff like multiple inheritance.
* 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: Move `notmuch-poll' to notmuch-libGravatar Austin Clements2013-09-10
|
* emacs: Remove notmuch-search quit continuationGravatar Austin Clements2013-09-10
| | | | | | Since notmuch-hello doesn't need this any more, we can remove this hack. This also eliminates `notmuch-search-quit', so now all modes bind "q" to `notmuch-kill-this-buffer'.
* emacs: Consistently use configured sort orderGravatar Austin Clements2013-09-10
| | | | | | | | | | Previously, if `notmuch-search' was called interactively (bound to "s" in search and show, but not hello), it would always use newest-first. However, `notmuch-hello-search' (bound to "s" in hello) and `notmuch-hello-widget-search` would call it with the user-configured sort order. This inconsistency seems unintentional, so change `notmuch-search' to use the user-configured sort order when called interactively.
* emacs: update search sort order help to match codeGravatar Jani Nikula2013-06-24
|
* emacs: Fix "no such file or directory" errorGravatar Austin Clements2013-06-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Occasionally, when the user killed the search buffer when the CLI process was still running, Emacs would run the notmuch-start-notmuch-sentinel sentinel twice. The first call would process and delete the error output file and the second would fail with an "Opening input file: no such file or directory, ..." error when attempting to access the error file. Emacs isn't supposed to run the sentinel twice. The reason it does is rather subtle (and probably a bug in Emacs): 1) When the user kills the search buffer, Emacs invokes kill_buffer_processes, which sends a SIGHUP to notmuch, but doesn't do anything else. Meanwhile, suppose the notmuch search process has printed some more output, but Emacs hasn't consumed it yet (this is critical and is why this error only happens sometimes). 2) Emacs gets a SIGCHLD from the dying notmuch process, which invokes handle_child_signal, which sets the new process status, but can't do anything else because it's a signal handler. 3) Emacs returns to its idle loop, which calls status_notify, which sees that the notmuch process has a new status. This is where things get interesting. 3.1) Emacs guarantees that it will run process filters on any unconsumed output before running the process sentinel, so status_notify calls read_process_output, which consumes the final output and calls notmuch-search-process-filter. 3.1.1) notmuch-search-process-filter checks if the search buffer is still alive and, since it's not, it calls delete-process. 3.1.1.1) delete-process correctly sees that the process is already dead and doesn't try to send another signal, *but* it still modifies the status to "killed". To deal with the new status, it calls status_notify. Dun dun dun. We've seen this function before. 3.1.1.1.1) The *recursive* status_notify invocation sees that the process has a new status and doesn't have any more output to consume, so it invokes our sentinel and returns. 3.2) The outer status_notify call (which we're still in) is now done flushing pending process output, so it *also* invokes our sentinel. This patch addresses this problem at step 3.1.1, where the filter calls delete-process, since this is a strange and redundant thing to do anyway.
* 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: 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: 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: 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: 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: 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: Use --format-version for search, show, and replyGravatar Austin Clements2012-12-16
|
* 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: 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: Move the incremental JSON parser to notmuch-lib.elGravatar Mark Walters2012-10-28
| | | | | | | This just moves the newly split out incremental json parser (together with its state variables) to lib. There should be no functional change.