aboutsummaryrefslogtreecommitdiffhomepage
path: root/emacs/notmuch-lib.el
Commit message (Collapse)AuthorAge
* 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: Introduce notmuch-jump: shortcut keys to saved searchesGravatar Austin Clements2014-08-05
| | | | | | | | | | | | | | | This introduces notmuch-jump, which is like a user-friendly, user-configurable global prefix map for saved searches. This provides a non-modal and much faster way to access saved searches than notmuch-hello. A user configures shortcut keys in notmuch-saved-searches, which are immediately accessible from anywhere in Notmuch under the "j" key (for "jump"). When the user hits "j", the minibuffer immediately shows a helpful table of bindings reminiscent of a completions buffer. This code is a combination of work from myself (originally, "notmuch-go"), David Edmondson, and modifications from Mark Walters.
* emacs: Clarify that notmuch-poll-script is deprecatedGravatar Austin Clements2014-07-31
| | | | | | | | | notmuch-poll-script has long since been deprecated in favor of post-new hooks, but this wasn't obvious from the documentation. Update the documentation to make this clear. Since notmuch-poll-script could, to some extend, be used to control the path of the notmuch binary and that use is now clearly discouraged, promote notmuch-command to a real defcustom instead of just a variable.
* emacs: hello: bugfix for saved searches defcustomGravatar Mark Walters2014-04-21
| | | | | | | | | | | | | | | | | | | | The recent changes for saved searches introduced a bug when notmuch was loaded after the saved search was defined. This was caused by a utility function not being defined when the defcustom was loaded. Fix this by moving some code around: the defcustom is moved into notmuch-hello (which is a more natural place anyway), and the utility functions are moved before the defcustom in notmuch-hello. We are rather constrained as the defcustom for saved searches is the first variable in the notmuch-hello customize window; to avoid moving this customize the defcustom needs to be the first defcustom in notmuch-hello, and the utility functions come before that. This patch also renames one of the utility functions from notmuch--saved-searches-to-plist to notmuch-hello--saved-searches-to-plist (as it is purely local to notmuch-hello) and corrects a couple of typo/spelling mistakes pointed out by Tomi.
* emacs: Add a sort-order option to saved-searchesGravatar Mark Walters2014-04-11
| | | | | | | | | This adds a sort-order option to saved-searches, stores it in the saved-search buttons (widgets), and uses the stored value when the button is pressed. Storing the sort-order in the widget was suggested by Jani in id:4c3876274126985683e888641b29cf18142a5eb8.1391771337.git.jani@nikula.org.
* emacs: hello: add a customize for saved-searchesGravatar Mark Walters2014-04-11
| | | | | | Make the defcustom for notmuch-saved-searches use the new plist format. It should still work with oldstyle saved-searches but will write the newstyle form.
* emacs: Use whitelist instead of blacklist for term escapingGravatar Austin Clements2014-03-25
| | | | | | | | | | | | Previously, the term escaper used a blacklist of characters that needed escaping. This blacklist turned out to be somewhat incomplete; for example, it did not contain non-whitespace ASCII control characters or Unicode "fancy quotes", both of which do require the term to be escaped. Switch to a whitelist of characters that are definitely safe to leave unquoted. This fixes the broken test introduced by the previous patch.
* 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: Fix `notmuch-user-other-email' when no other emails are configuredGravatar Austin Clements2014-02-22
| | | | | | Thanks to the previous patch, this no longer crashes in this situation, but now would return (""). Fix it to return () when no emails are configured.
* emacs: Fix exception when fetching empty or unconfigured settingsGravatar Austin Clements2014-02-22
| | | | | | | | | | | | When "notmuch config" is called with the name of an empty or unconfigured setting, it prints nothing (not even a new line). Previously, `notmuch-config-get' assumed it would always print a newline. As a result, when `notmuch-config-get' was called with the name of an empty of unconfigured setting, it would attempt to (substring "" 0 -1) to strip the newline, which would fail with a (args-out-of-range "" 0 -1) exception. Fix this by only stripping the newline if there actually is one.
* emacs: ad-activate 'mm-shr after ad-disable-advice 'mm-shrGravatar Tomi Ollila2014-01-30
| | | | | | | | Imitated from "Enabling advice" in Emacs lisp manual... ad-disable-advice by itself only changes the enable flag for a piece of advice. To make the change take effect in the advised definition, the advice needs to be activated again.
* emacs: add function notmuch-assert-cli-saneGravatar David Bremner2014-01-26
| | | | | If the CLI seems borked, signal an error, and log a suggestion for the user about how to recover.
* emacs: add a function to heuristically test if the CLI is configured OK.Gravatar David Bremner2014-01-26
| | | | | We cache the result so that we can call the function many places without worrying about the cost.
* 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: help: add a special function to deal with remapsGravatar Mark Walters2013-11-13
| | | | | | remaps are a rather unusual keymap consisting of "first key" 'remap and then "second-key" the remapped-function. Thus we do the documentation for it separately.
* emacs: help: add base-keymapGravatar Mark Walters2013-11-13
| | | | | | To support key remapping in emacs help we need to know the base keymap when looking at the remapping. keep track of this while we recurse down the sub-keymaps in help.
* emacs: help: split out notmuch-describe-key as a functionGravatar Mark Walters2013-11-13
| | | | | | The actual documentation function notmuch-describe-keymap was getting rather complicated so split out the code for a single key into its own function notmuch-describe-key.
* emacs: help: remove duplicate bindingsGravatar Mark Walters2013-11-13
| | | | | | | | | | | If the user (or a mode) overrides a keybinding from the common keymap in one of the modes then both help lines appear in the help screen even though only one of them is applicable. Fix this by checking if we already have that key binding. We do this by constructing an list of (key . docstring) pairs so it is easy to check if we have already had that binding. Then the actual print help routine changes these pairs into strings "key \t docstring"
* emacs: help: save-match-dataGravatar Mark Walters2013-11-13
| | | | | | | | The routines that construct the help page in notmuch-lib rely on match-data being preserved across some fairly complicated code. This is currently valid but will not be when this series is finished. Thus place everything between the string-match and replace-match inside a save-match-data.
* emacs: help: check for nil key bindingGravatar Mark Walters2013-11-13
| | | | | | | | | A standard way to unset a key binding is local-unset-key which is equivalent to (define-key (current-local-map) key nil) Currently notmuch-help gives an error and fails if a user has done this. To fix this we only add a help line if the binding is non-nil.
* emacs: Correct documentation of `notmuch-poll-script'Gravatar Austin Clements2013-11-13
| | | | | | The functions referred to in the documentation for this variable were replaced by the unified `notmuch-poll-and-refresh-this-buffer' in 21474f0e. Update the documentation to reflect the new function.
* emacs: Use notmuch tag --batch for large tag queriesGravatar Austin Clements2013-11-08
| | | | | | (Unfortunately, it's difficult to first demonstrate this problem with a known-broken test because modern Linux kernels have argument length limits in the megabytes, which makes Emacs really slow!)
* emacs: Support passing input via `notmuch-call-notmuch-*'Gravatar Austin Clements2013-11-08
| | | | | | | This adds support for passing a string to write to notmuch's stdin to `notmuch-call-notmuch-process' and `notmuch-call-notmuch-sexp'. Since this makes both interfaces a little more complicated, it also unifies their documentation better.
* 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: add z to common keymapGravatar Mark Walters2013-11-07
| | | | Add the main entry "z" to notmuch-tree to the common keymap.
* 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: 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: Move `notmuch-poll' to notmuch-libGravatar Austin Clements2013-09-10
|
* 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 `notmuch-call-notmuch-json'Gravatar Austin Clements2013-06-24
| | | | This function is no longer used.
* emacs: Introduce `notmuch-call-notmuch-sexp'Gravatar Austin Clements2013-06-24
| | | | | | | This is just like `notmuch-call-notmuch-json', but parses S-expression output. Note that, also like `notmuch-call-notmuch-json', this doesn't consider trailing data to be an error, which may or may not be what we want in the long run.
* emacs: update search sort order help to match codeGravatar Jani Nikula2013-06-24
|
* emacs: Don't report CLI signals sent by Emacs as errorsGravatar Austin Clements2013-06-12
| | | | | | | | | Previously, when the user killed the search buffer before the CLI search process had completed, we would report the signal sent by Emacs to kill the CLI to the user as an error. Fix this by only reporting error exits if the process buffer is still live. We still report stderr output regardless in case stderr output was relevant to why the user killed the search buffer (such as a wrapper script being stuck).
* 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: 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: 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: 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: 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: 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: 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: 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.