aboutsummaryrefslogtreecommitdiffhomepage
path: root/emacs
Commit message (Collapse)AuthorAge
* 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: Honor debug-on-error for part renderersGravatar Austin Clements2014-04-19
| | | | | | Previously, even if debug-on-error was non-nil, the debugger would not trap on part renderer errors. This made debugging part renderer bugs frustrating, so let the debugger trap these errors.
* emacs: hello: bugfix: make alphabetically sorted saved searches workGravatar Mark Walters2014-04-14
| | | | | | | | | | | My recent changes to the saved search format broke the alphabetically sorted saved sort option. This makes it work again. Also update docs for saved-search sort defcustom to match the new format. Finally, since the saved-search list is no longer an alist change the names in the sort function to avoid confusion.
* emacs: remove auto-signing of replies to signed messagesGravatar Jameson Graef Rollins2014-04-14
| | | | | | | | | | It was decided that auto-signing is potentially too troublesome for the apparently common case of users who enable crypto processing for the purpose of checking signature validity but who are not in a position to sign out-going messages. Users can still manually invoke signing as needed. Encrypting replies to encrypted messages is more of a security issue so we leave it in place.
* emacs: add $(srcdir) to notmuch-version.el.tmpl dependencyGravatar Tomi Ollila2014-04-13
| | | | This fixes out-of-tree build when generating emacs/notmuch-version.el.
* emacs: sign/encrypt replies to signed/encrypted messagesGravatar Jani Nikula2014-04-12
| | | | | | | | | | | | | | This is a simple approach to improving security when replying to signed or encrypted messages. If the message being replied to was signed, add mml tag to sign the reply. If the message being replied to was encrypted, add mml tag to sign and encrypt the reply. This may need configuration; I for one might want to encrypt replies to encrypted messages, but not always sign replies to signed messages. This still includes a slight bug: if any mml tags are added, they are included in the region containing the quoted parts. Killing the region will kill the mml tags too.
* 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: switch notmuch-hello-insert-buttons to plistsGravatar Mark Walters2014-04-11
| | | | | Switching notmuch-hello-insert-buttons to plists means we can easily pass extra options through to the buttons.
* 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: 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: hello: add helper functions for saved-searchesGravatar Mark Walters2014-04-11
| | | | | | Add helper functions to for saved searches to ease the transition to the new plist form while maintaining backwards compatibility. They will be used in the next patch.
* emacs: defun notmuch-hello-versions and bind 'v' in hello mode to itGravatar Tomi Ollila2014-04-10
| | | | | | If notmuch cli & notmuch emacs MUA versions differ, print also the emacs MUA version string (along with the cli version) to the minibuffer.
* 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: push mark before signature on replyGravatar Jani Nikula2014-03-30
| | | | | | | | We push mark on reply so user can cut the quote. Push the mark before signature, if any, instead of end of buffer so the signature is preserved. This is consistent with message-kill-to-signature.
* 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: 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: tree: use orig-tags in searchGravatar Mark Walters2014-03-24
| | | | | | | This uses the recent functionality to show the tag changes in the tree buffer. Currently this is only used to show changes the tree buffer makes itself: i.e., it does not make display any changes reflecting tagging done by other notmuch-buffers.
* 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: use orig-tags for tag displayGravatar Mark Walters2014-03-24
| | | | | This uses the previous patch to show the tag changes that have occured in the show buffer since it was last loaded/refreshed.
* 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.
* emacs: tag: add customize for deleted/added tag formatsGravatar Mark Walters2014-03-24
| | | | | | | | | | | | | | Add customize options for deleted/added tag formats. These are not used yet but will be later in the series. We switch to using `notmuch-apply-face' rather than `propertize' in the defcustom for faces so that the faces for deleted/added tags add to the default face attributes for the tag. We special case deleting the unread tag as that tag is a strong visual cue and we don't need that cue when we are just saying it used to be unread. Thus, we revert to the normal tag face with strikethough for deleted unread tags.
* emacs: tag split customise option for format-tags into a widgetGravatar Mark Walters2014-03-24
| | | | | | We will re-use the customize option for format-tags for formattting deleted tags to added tags in the next patch so split it into a widget. There should be no functional change.
* 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: use the originating buffer's working directory for pipeGravatar Jani Nikula2014-03-04
| | | | | | | | | | | | | Currently notmuch-show-pipe-message runs the command in the working directory of the *notmuch-pipe* buffer if it exists, and the current buffer's working directory (which is inherited to the new *notmuch-pipe* buffer) otherwise. This is all very surprising to the user, and it's difficult to know or change where the command will be run. Always use the current show buffer's working directory for piping. The user can check that with M-x pwd and change it with M-x cd. This is consistent with notmuch-show-pipe-part.
* emacs: Simplify and fix `notmuch-mua-prompt-for-sender'Gravatar Austin Clements2014-03-04
| | | | | | | | | | | | | | | | | | | | `notmuch-mua-prompt-for-sender' is over-engineered and often wrong. It attempts to detect when all identities have the same name and specialize the prompt to just the email address part. However, to do this it uses `mail-extract-address-components', which is meant for displaying email addresses, not general-purpose parsing, and hence performs many canonicalizations that can interfere with this use. For example, configuring notmuch-identities to ("Austin <austin@example.com>"), will cause `notmuch-mua-prompt-for-sender' to lose the name part entirely and return " <austin@example.com>". This patch rewrites `notmuch-mua-prompt-for-sender' to simply prompt for a full identity when notmuch-identities is configured, or to prompt for a sender address when it isn't. The original code also did several strange things, like using `eval' and specifying that this function was interactive. As a side-effect, this patch fixes these problems. And it adds a docstring.
* emacs: remove newlines from input to notmuch count --batchGravatar David Bremner2014-02-25
| | | | | | | | | | | Since a newline starts a new query in batch mode, this causes mysterious crashes in the emacs interface if saved searches contain newlines. See the discussion at id:87wqhcxb5j.fsf@maritornes.cs.unb.ca In general newlines seem to be just whitespace to the xapian query parser, so this should be mainly harmless.
* 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: Build forwarded message buffer more directlyGravatar Austin Clements2014-02-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we used `message-forward' to build forwarded messages, but this function is simply too high-level to be a good fit for some of what we do. First, since `message-forward' builds a full forward message buffer given the message to forward, we have to duplicate much of the logic in `notmuch-mua-mail' to patch the notmuch-y things into the built buffer. Second, `message-forward' constructs the From header from user-full-name and user-mail-address. As a result, if we prompt the user for an identity, we have to parse it into name and address components, just to have it put back together by `message-forward'. This process is not entirely loss-less because `mail-extract-address-components' does a lot of canonicalization (since it's intended for displaying addresses, not for parsing them). To fix these problems, don't use `message-forward' at all. `message-forward' itself is basically just a call to `message-mail' and `message-forward-make-body'. Do this ourselves, but call `notmuch-mua-mail' instead of `message-mail' so we can directly build a notmuch-y message and control the From header. This also fixes a bug that was a direct consequence of our use of `mail-extract-address-components': if the user chose an identity that had no name part (or the name part matched the mailbox), we would bind user-full-name to nil, which would cause an exception in the bowels of message-mode because user-full-name is expected to always be a string (even if it's just "").
* emacs: Avoid rebuilding .eldeps even when there's nothing to doGravatar Austin Clements2014-02-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we updated .eldeps only if the file contents actually needed to change. This was done to avoid unnecessary make restarts (if the .eldeps rule changes the mtime of .eldeps, make has to restart to collect the new dependencies). However, this meant that, after a modification to any .el file that did not change dependencies, .eldeps would always be out of date, so every make invocation would run the .eldeps rule, which is both expensive because it starts up Emacs and noisy. This was true even when there was nothing to do. E.g., $ make clean && make ... $ touch emacs/notmuch-lib.el && make ... $ make Use "make V=1" to see the verbose compile lines. EMACS emacs/.eldeps make: Nothing to be done for `all'. $ make Use "make V=1" to see the verbose compile lines. EMACS emacs/.eldeps make: Nothing to be done for `all'. Fix this by replacing .eldeps with two files with identical content. One tracks the mtime of the dependency information and triggers the Emacs call to rebuild dependencies only when it may be necessary. The other tracks the content only; this rule over-triggers in the same way the old rule did, but this rule is cheap and quiet.
* emacs: update alist for mail-archive.com API changeGravatar Jed Brown2014-02-16
| | | | | | | | Searching by Message-Id no longer works via the old mail-archive.com API, though I have contacted them in hopes that they restore it to prevent dead links. Anyway, the new API is cleaner. Acked-by: Austin Clements <amdragon@MIT.EDU>
* emacs: initialize ido(-completing-read) in emacs 23.[123]Gravatar Tomi Ollila2014-02-03
| | | | Otherwise `ido-completing-read' will freeze after PROMPT is displayed.
* 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 notmuch-assert-cli-sane to notmuch-helloGravatar David Bremner2014-01-26
| | | | | | | This is meant to be the friendly entrypoint, so let's do something better than the mangled output described in id:5228989D.8030607@fifthhorseman.net
* 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: tree: use tag-format-tagsGravatar Mark Walters2014-01-18
| | | | | | | | | | | | | | | | | Previously tree did not use tag-format-tags: since tree wants to distinguish matching messages from non-matching messages it is not a perfect fit. However, in preparation for allowing tag-changes to be shown (i.e., added or deleted tags to be indicated) it is convenient to make all places displaying tags call the same routines. We modify notmuch-tag-format-tags slightly so that it can take and argument for the default characteristics of the face before the special tag features are applied. This also means that things like the star symbol for flagged messages all work in tree.
* emacs: tree: default face for matching/non-matching messagesGravatar Mark Walters2014-01-18
| | | | | | | | | | | This adds default faces for matching and non-matching messages. This makes it easier for a user to do broad customization without having to customize every field. It also fits more neatly with the next patch which switches to using notmuch-tag-format-tags for tag formatting. We set the field specific face customization to nil for all the fields which use the message default face to make it clear to a user which fields customizations are being used.
* emacs: tree remove comma separator tagsGravatar Mark Walters2014-01-13
| | | | | | | | | | | | Previously the tags on each line in tree view were separarted by ", " not just " ". This is different from show and search views. This patch removes this comma. This is a large patch as essentially every line of each of the expected outputs in the tree tests needs updating. Apart from aesthetic reasons this simplifies the switch to notmuch-tag-format-tags in the next patch.
* emacs: Makefile.local: HAVE_EMACS usage fixesGravatar Tomi Ollila2014-01-13
| | | | | | | | If we don't have emacs, disable targets that used EMACS while doing the recipes of that target. If we do have emacs, make install-emacs depend on *.elc files, as making the target will attempt to install those.
* emacs: tree: bare-id in treeGravatar Mark Walters2014-01-03
| | | | | | | | | Previously notmuch-tree-get-message-id always returned the id including the prefix "id:". Modify the function to take an optional `bare' argument saying to return the raw string. This will be useful later and brings the function in line with notmuch-show-get-message-id.
* 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: do not put quoted reply in primary selectionGravatar Mark Walters2013-11-19
| | | | | | | | | | | | | | | | | | | In current emacs (24.3) select-active-regions is set to t by default. The reply insertion code sets the region to the quoted message to make it easy to delete (kill-region or C-w). These two things combine to put the quoted message in the primary selection. This is not what the user wanted and is a privacy risk (accidental pasting of the quoted message). We can avoid some of the problems by let-binding select-active-regions to nil. This fixes if the primary selection was previously in a non-emacs window but not if it was in an emacs window. To avoid the problem in the latter case we deactivate mark. One key test (which fails under many simpler "fixes") is: open emacs 24.3 with notmuch, open 2 windows (viewing different notmuch buffers), highlight some text in one, and then reply to a message in the other. In many of my earlier attempts to fix this big this test fails.
* emacs: tree: use remap for the over-ridden global bindingsGravatar Mark Walters2013-11-13
| | | | | | | | | | | Following a suggestion by Austin in id:20130915153642.GY1426@mit.edu we use remap for the over-riding bindings in pick. This means that if the user modifies the global keymap these modifications will happen in the tree-view versions of them too. [tree-view overrides these to do things like close the message pane before doing the action, so the functionality is very close to the original common keymap function.]
* 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.