aboutsummaryrefslogtreecommitdiffhomepage
path: root/emacs/notmuch-lib.el
Commit message (Collapse)AuthorAge
* 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.
* 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.
* emacs: stash bugfixGravatar Mark Walters2012-12-06
| | | | | | Currently an attempt to stash a non-existent field (eg cc when not present) throws an error. Catch this case and give the user a warning message.
* emacs: drop support for deprecated notmuch-foldersGravatar Jani Nikula2012-12-04
| | | | | | | | | | | | Remove notmuch-folders which has been deprecated since commit a4669217600e4536dc0c49f0255af5e2d9bc183f Author: Carl Worth <cworth@cworth.org> Date: Mon Apr 26 22:42:07 2010 -0700 emacs: Rip out all of the notmuch-folder code. This lets us simplify the notmuch-saved-searches code slightly.
* 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.
* emacs: Introduce generic boolean term escaping functionGravatar Austin Clements2012-10-27
| | | | | | | Currently, we only properly escape stashed id queries, but there are other places where the Emacs UI constructs queries for boolean terms. Since this escaping function is meant to be used in other places, it avoids escaping strings that don't need escaping.
* emacs: Work around gnus-inhibit-images bug in mm-shrGravatar Austin Clements2012-09-30
| | | | | | | | | | | | | Emacs 24's mm-shr HTML email renderer fails to load gnus-art before referencing gnus-inhibit-images, resulting in a void-variable error when notmuch attempts to render an HTML email with inline images. This works around this bug by advising mm-shr to load gnus-art. mm-shr is the only function outside of gnus-art itself that references gnus-inhibit-images, so this workaround should be correct. If this ever changes, hopefully they will have fixed this bug upstream first. This fixes the "Rendering HTML mail with images" test for Emacs 24.
* emacs: add support for custom tag changes on message/thread archiveGravatar Jani Nikula2012-09-19
| | | | | | | Add support for customization of the tag changes that are applied when a message or a thread is archived. Instead of hard-coded removal of the "inbox" tag, the user can now specify a list of tag changes to perform.
* emacs: Fix "not defined at runtime" warningGravatar Austin Clements2012-08-12
| | | | | | | | | | Previously, the Emacs byte compiler produced the warning the function `remove-if-not' might not be defined at runtime. because we only required cl at compile-time (not runtime). This fixes this warning by requiring cl at runtime, ensuring that the definition of remove-if-not is available.
* emacs: Use text properties instead of overlays for tag coloringGravatar Austin Clements2012-07-24
| | | | | | | | | | | | | | | | | | | Previously, tag-based search result highlighting was done by creating an overlay over each search result. However, overlays have annoying front- and rear-advancement semantics that make it difficult to manipulate text at their boundaries, which the next patch will do. They also have performance problems (creating an overlay is linear in the number of overlays between point and the new overlay, making highlighting a search buffer quadratic in the number of results). Text properties have neither problem. However, text properties make it more difficult to apply multiple faces since, unlike with overlays, a given character can only have a single 'face text property. Hence, we introduce a utility function that combines faces into any existing 'face text properties. Using this utility function, it's straightforward to apply all of the appropriate tag faces in notmuch-search-color-line.
* emacs: Implement an incremental JSON parserGravatar Austin Clements2012-07-12
| | | | | | | | | | | | | | | | | | | | | | This parser is designed to read streaming JSON whose structure is known to the caller. Like a typical JSON parsing interface, it provides a function to read a complete JSON value from the input. However, it extends this with an additional function that requires the next value in the input to be a compound value and descends into it, allowing its elements to be read one at a time or further descended into. Both functions can return 'retry to indicate that not enough input is available. The parser supports efficient partial parsing, so there's no need to frame the input for correctness or performance. The bulk of the parsing is still done by Emacs' json.el, so any improvements or optimizations to that will benefit the incremental parser as well. Currently only descending into JSON lists is supported because that's all we need, but support for descending into JSON objects can be added in the future.
* emacs: Suppress warnings about using cl at runtimeGravatar Austin Clements2012-06-03
| | | | | | | | | It was decided in the thread starting at [0] that it is okay for notmuch to use 'cl runtime functions. However, by default, these produce byte compiler warnings. This suppresses those using file-local variables. [0] id:"m262g864dz.fsf@wal122.wireless-pennnet.upenn.edu"
* emacs: use 'gnus-decoded in notmuch-mm-display-part-inline ()Gravatar Tomi Ollila2012-05-23
| | | | | | | | | | | | | | | | | | | | When mail message is read from emacs, the message structure obtained may contain parts which have content included (`text/plain` for example) and other parts where content is not included (`text/html` for example). In case content is included, the string is already available in emacs' internal format and therefore mm-... functions should not attempt to do further decoding for the data in temp buffer provided for it. Currently when reply buffer is created, notmuch-mm-display-part-inline () is used to provided quoted reply content. This change makes the mm-... functions called by it use 'gnus-decoded as charset whenever the content is already available. File .../emacs-23.3/lisp/gnus/mm-uu.el mentions: "`gnus-decoded' is a fake charset, which means no further decoding."
* emacs: Correctly quote non-text/plain parts in replyGravatar Adam Wolfe Gordon2012-05-06
| | | | | | | | | | Quote non-text parts nicely by displaying them with mm-display-part before calling message-cite-original to quote them. HTML-only emails can now be quoted correctly. We re-use some code from notmuch-show (notmuch-show-mm-display-part-inline), which has been moved to notmuch-lib.el. Mark the test for this feature as not broken.
* emacs: Fix two bugs in replyGravatar Adam Wolfe Gordon2012-04-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug 1: Replying from alternate addresses ---------------------------------------- The reply code was inconsistent in its use of symbols and strings for header names being passed to message.el functions. This caused the From header to be lookup up incorrectly, causing an additional From header to be added with the user's primary address instead of the correct alternate address. This is fixed by using symbols everywhere, i.e. never using strings for header names when interacting with message.el. This change also removes our use of `mail-header`, since we don't use it anywhere else, and using assq makes it clear how the header lists are expected to work. Bug 2: Duplicate headers in emacs 23.2 -------------------------------------- The message.el code in emacs 23.2 assumes that header names will always be passed as symbols, so our use of strings caused problems. The symptom was that on 23.2 (and presumably on earlier versions) the reply message would end up with two of some headers. Converting everything to symbols also fixes this issue.
* emacs: Fix mis-named argument to notmuch-get-bodypart-internalGravatar Austin Clements2012-03-31
| | | | | | Previously, this function took an argument called "message-id", even though it was a general query, rather than a message ID. This changes it to "query".
* emacs: Escape all message ID queriesGravatar Austin Clements2012-03-30
| | | | | | | | | | This adds a lib function to turn a message ID into a properly escaped message ID query and uses this function wherever we previously hand-constructed ID queries. Wherever this new function is used, documentation has been clarified to refer to "id: queries" instead of "message IDs". This fixes the broken test introduced by the previous patch.
* emacs: content-type comparison should be case insensitive.Gravatar Mark Walters2012-03-30
| | | | | | | | The function notmuch-match-content-type was comparing content types case sensitively. Fix it so it tests case insensitively. This fixes a bug where emacs would not include any body when replying to a message with content-type TEXT/PLAIN.
* emacs: Use the new JSON reply format and message-cite-originalGravatar Adam Wolfe Gordon2012-03-19
| | | | | | | | | | | | | | | | | Use the new JSON reply format to create replies in emacs. Quote HTML parts nicely by using mm-display-part to turn them into displayable text, then quoting them with message-cite-original. This is very useful for users who regularly receive HTML-only email. Use message-mode's message-cite-original function to create the quoted body for reply messages. In order to make this act like the existing notmuch defaults, you will need to set the following in your emacs configuration: message-citation-line-format "On %a, %d %b %Y, %f wrote:" message-citation-line-function 'message-insert-formatted-citation-line The tests have been updated to reflect the (ugly) emacs default.
* emacs: Factor out useful functions into notmuch-libGravatar Adam Wolfe Gordon2012-03-19
| | | | | Move a few functions related to handling multipart/alternative parts into notmuch-lib.el, so they can be used by future reply code.
* emacs: Prefer '[No Subject]' to blank subjects.Gravatar David Edmondson2012-02-03
|
* emacs: use a single history for all searchesGravatar Dmitry Kurochkin2012-01-25
| | | | | | | | There are two ways to do search in Emacs UI: search widget in notmuch-hello buffer and `notmuch-search' function bound to "s". Before the change, these search mechanisms used different history lists. The patch makes notmuch-hello search use the same history list as `notmuch-search' function.
* emacs/*.el: changed one-char comment prefix ';' to two; ';;'Gravatar Tomi Ollila2012-01-21
| | | | | In order for emacs (indent-region) to (re)indent emacs lisp properly there needs to be at least 2 comment characters (;;).
* emacs: invert relation between 'notmuch-send and 'message customization groupsGravatar Pieter Praet2012-01-21
| | | | | | | 'message contains options relevant to 'notmuch-send, not the other way around. Thanks to Austin for suggesting `custom-add-to-group'. id:"20120118184408.GD16740@mit.edu"
* emacs: logically group def{custom,face}sGravatar Pieter Praet2012-01-19
| | | | | | | | | | | | | | | | | | | | | To allow for expansion whilst keeping everything tidy and organized, move all defcustom/defface variables to the following subgroups, defined in notmuch-lib.el: - Hello - Search - Show - Send - Crypto - Hooks - External Commands - Appearance As an added benefit, defcustom keyword args are now consistently ordered as they appear @ defcustom's docstring (OCD much?). Proper defgroup docstrings and various other improvements by courtesy of Austin Clements.
* emacs: remove unused `point-invisible-p' functionGravatar Dmitry Kurochkin2011-11-07
| | | | | | `point-invisible-p' does not work correctly when `invisible' property is a list. There are standard `invisible-p' and related functions that should be used instead.
* fix sum moar typos [user-visible documentation in code]Gravatar Pieter Praet2011-06-23
| | | | | | | | | | | | Various typo fixes in documentation within the code that can be made available to the user, (emacs function help strings, "notmuch help" output, notmuch man page, etc.). Signed-off-by: Pieter Praet <pieter@praet.org> Edited-by: Carl Worth <cworth@cworth.org> Restricted to just documentation and fixed fix of "comman" to "common" rather than "command".
* emacs: Add support for PGP/MIME verification/decryptionGravatar Jameson Graef Rollins2011-05-27
| | | | | | | | | | | | | A new emacs configuration variable "notmuch-crypto-process-mime" controls the processing of PGP/MIME signatures and encrypted parts. When this is set true, notmuch-query will use the notmuch show --decrypt flag to decrypt encrypted messages and/or calculate the sigstatus of signed messages. If sigstatus is available, notmuch-show will place a specially color-coded header at the begining of the signed message. Also included is the ability to switch decryption/verification on/off on the fly, which is bound to M-RET in notmuch-search-mode.
* emacs: Make the queries used in the all-tags section configurableGravatar Daniel Schoepe2011-05-26
| | | | | | | | | | This patch adds a customization variable that controls what queries are used to construct the all-tags section in notmuch-hello. It allows the user to specify a function to construct the query given a tag or a string that is used as a filter for each tag. It also adds a variable to hide various tags from the all-tags section. Signed-off-by: Daniel Schoepe <daniel.schoepe@googlemail.com>
* emacs: Add an accessor function for emacs code to get at user.other_emailGravatar Carl Worth2011-05-24
| | | | | This is like the other notmuch-config accessor functions except that it converts the newline-separated string into an actual lisp list.
* emacs: Only compile replacement functions for emacs < emacs-23Gravatar Carl Worth2011-05-11
| | | | | | This avoids the emacs lisp compiler from emitting warnings on this replacement code, (which warnings would be hard for us to eliminate since we didn't write the code but copied it verbatim from emacs 23).
* compatibility with emacs22Gravatar James Vasile2010-11-16
| | | | | | | | | | Emacs22 lacks apply-partially and mouse-event-p, so define them if emacs version is less than 23. With this change, I was able to begin using notmuch in emacs22. The definitions of apply-partially and mouse-event-p are copied from the emacs 23 distribution, (which is distributed under the GPLv3+ just as notmuch).
* emacs: mv notmuch-{show,common}-do-stashGravatar Jameson Rollins2010-11-11
| | | | | | | Here we move the notmuch-show/notmuch-show-do-stash function to notmuch-lib/notmuch-common-do-stash. Nothing in this function is notmuch-show mode specific, so this move will make it cleaner to be used by other modes (such as notmuch-search).
* Don't use kill-this-buffer to kill notmuch emacs buffersGravatar Jameson Rollins2010-11-08
| | | | | | | | kill-this-buffer appears to be a function intended specifically for use in the menu bar, and causes problem killing notmuch buffers when multiple frames have been used. This patch replaces kill-this-buffer with notmuch-kill-this-buffer, which in turn just simply calls (kill-buffer (current-buffer)).
* emacs: Explicitly set the From address when composing a new message.Gravatar Carl Worth2010-10-27
| | | | | Previously, underlying emacs code was setting this header. Now, we do the right thing and query the notmuch configuration for the default value here.
* emacs: Change FCC to be relative to notmuch mail store, not message-directoryGravatar Carl Worth2010-10-27
| | | | | | | | | | | | | Otherwise, FCC is too hard to use, (user must set it and also set message- directory variable to match notmuch mail datbase path). As a rule, I'd like for users of notmuch to not be required to muck around with non-notmuch mail settings in emacs. The above is only really possible now thanks to the recent addition of the "notmuch config get" command which allows emacs to query the currently configured notmuch database path. This also now allows an absolute-path FCC to be set if desired.
* emacs: Rip out all of the notmuch-folder code.Gravatar Carl Worth2010-04-26
| | | | | | | | | | | | We are asserting that the new notmuch-hello implementation, (available by just calling `notmuch') is just as easy to use as the old notmuch-folder. So let's remove what's now a largely redundant implementation. To make this transition easier, we are still supporting the notmuch-folders variable name, and we still provide `notmuch-folder' as an alias which can be invoked to get the new notmuch-hello functionality.
* emacs: Add a notmuch-saved-searches function.Gravatar Carl Worth2010-04-26
| | | | | | | | | | | | | We use this function to abstract away the common 3-step process for looking for a value for the saved-searches variable: 1. Look at the notmuch-saved-searches variable itself 2. Look at the notmuch-folders vaiable 3. Use a default value We were already using this logic (open-coded) in notmuch-hello, but notmuch.el was accessing notmuch-folders directly for the clever name selection of search buffers.
* emacs: Move declare-function from notmuch-lib.el to notmuch-hello.el.Gravatar Carl Worth2010-04-26
| | | | | | Apparently the declare-function macro doesn't work in a required file as I might like it too. Put it where it needs to go to avoid the warning.
* notmuch-hello: Add a 'G' keybinding.Gravatar Carl Worth2010-04-26
| | | | | Just like the G keybinding we've had in notmuch-folder-mode and notmuch-search-mode, (to call `notmuch-poll' to 'G'et new mail).
* emacs: `notmuch' should display the `notmuch-hello' interfaceGravatar David Edmondson2010-04-26
| | | | | | | | | | | | | | | | | Reviewed-by: Carl Worth <cworth@cworth.org> The notmuch-hello functionality is now sufficiently useful that we want to make it the default view of notmuch for new users. This also effectively hides the "hello" name from the user, so we'll be free to change that in the implementation if necessary. This change also shuffles the requires between notmuch.el and notmuch-hello.el. This fixes things so that our documented (require 'notmuch) is sufficient for getting the notmuch-hello functionality. Finally, the shuffling caused the notmuch-search-oldest-first variable from one file to the other. While doing that, give this variable the defcustom treatment for easier customization.
* emacs: Re-arrange message sending codeGravatar David Edmondson2010-04-23
| | | | | | | | | | | | | | | Define a new `mail-user-agent' (`notmuch-user-agent') and use it by default. Re-arrange various routines that send mail to use this (compose, reply, forward). Insert a `User-Agent:' header by default. This is the real commit for this functionality this time. The previous attempt to merge this code: commit 57926bc7b0f784cbacb620fda0ee5157e2e0ff27 was botched (by Carl Worth, not David) to include only the Makefile change. So the build was broken until this commit that actually adds the new file.
* emacs: Add notmuch-hello.el, a friendly frontend to notmuchGravatar David Edmondson2010-04-23
| | | | | | | This is based on the prototype that Carl Worth described in the TODO file. It provides a search bar as well as support for recent searches, saved searches, and a list of all tags in the database (as well as the number of messages with each tag).
* emacs: JSON based implementationGravatar David Edmondson2010-04-21
| | | | | | Re-implement notmuch-show.el using the JSON output format of the notmuch command. Most functionality is retained - HTML display is noticeably missing.