Commit graph

3964 commits

Author SHA1 Message Date
Mark Walters
9c25d4bbf0 emacs: show: stop stderr appearing in buffer
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).
2013-11-20 18:14:35 -04:00
Felipe Contreras
42ff2d3a0d vim: add help file
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2013-11-20 07:23:30 -06:00
Felipe Contreras
3d15ed9290 vim: check compose is done on delete
Not on unload, which happens when we switch buffers.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2013-11-20 07:23:30 -06:00
Felipe Contreras
062a73b931 vim: remove unnecessary buffer queue
Vim handles the buffers just fine: when one is deleted, we go to the
previous one.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2013-11-20 07:23:30 -06:00
Felipe Contreras
2c3623703f vim: add wrapper for old variable names
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2013-11-20 07:23:30 -06:00
Felipe Contreras
8d3b4ffb56 vim: move default sets to set_defaults()
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2013-11-20 07:23:29 -06:00
Felipe Contreras
2dedd23943 vim: rename public notmuch_rb variables
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2013-11-20 07:23:29 -06:00
Felipe Contreras
77c2853d7d vim: rename internal notmuch_rb variables
Now we are the official one.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2013-11-20 07:23:29 -06:00
Felipe Contreras
24dc32aef7 vim: add option to compose new messages
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2013-11-20 07:23:29 -06:00
Felipe Contreras
de74431cfe vim: refactor open_reply()
In preparation for composing new messages.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2013-11-20 07:23:29 -06:00
Felipe Contreras
2ec69fd39e vim: trivial cleanup
Using $email_address is more straight forward.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2013-11-20 07:23:29 -06:00
Felipe Contreras
568a541262 vim: don't execute search if it's cancelled
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2013-11-20 07:23:29 -06:00
Felipe Contreras
ce5f3f3809 vim: generate custom message-id
Using Mail as a reference.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2013-11-20 07:23:29 -06:00
Felipe Contreras
6ff607d6a0 vim: split $email_address
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2013-11-20 07:23:29 -06:00
Felipe Contreras
a760e4ab47 vim: allow calling with arguments
For example:

  :NotMuch date:today

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2013-11-20 07:23:29 -06:00
Felipe Contreras
77c2c3143b vim: add option to save the patches of a patch series
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2013-11-20 07:23:29 -06:00
Felipe Contreras
2d583fb17a vim: use much clearer sort constant
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2013-11-20 07:23:29 -06:00
Felipe Contreras
01859bd7ce vim: show first message of the thread
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2013-11-20 07:23:29 -06:00
Felipe Contreras
85b3dc9f0f vim: refactor database handling
To minimize memory usage we need to destroy the queries and the
databases, so we should keep track of them.

Each buffer gets a database connection that is destroyed when the buffer
is destroyed, and all the queries along with it.

Ideally notmuch should destroy the queries when the database is
destroyed, but it's not doing that at the moment.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2013-11-20 07:23:29 -06:00
Felipe Contreras
47e1f39c56 vim: use notmuch fields
They are better encoded than Ruby's Mail.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2013-11-20 07:23:29 -06:00
Felipe Contreras
a0b0baaf2b vim: don't automatically refresh after tagging
This operation might take a while, and even if it only takes fractions
of a second, that's not what the user might want.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2013-11-20 07:23:29 -06:00
Charlie Allom
6f8a1345eb vim: run mutt in default term
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2013-11-20 07:23:29 -06:00
Jani Nikula
6f0d54c737 NEWS: insert quotable parts in reply as they are displayed in show view
News for
commit 5c19eb46a9
Author: Jani Nikula <jani@nikula.org>
Date:   Sun Sep 1 20:59:53 2013 +0300

    emacs: insert quotable parts in reply as they are displayed in show view
2013-11-19 20:19:02 -04:00
Mark Walters
4eb151e26c emacs: do not put quoted reply in primary selection
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.
2013-11-19 20:18:17 -04:00
Tomi Ollila
2fd7ef64ba compact: improve error messages on failures after compaction
The error messages written during the steps replacing old
database with new now includes relevant paths and strerror.
2013-11-19 20:15:02 -04:00
Tomi Ollila
6452ae0fcb compact: unconditionally remove old wip database compact directory
In case previous notmuch compact has been interrupted there is old
work-in-progress database compact directory partially filled. Remove
it just before starting to fill the directory with new files.
2013-11-19 20:14:28 -04:00
Tomi Ollila
cb6cc296e2 compact: preserve backup database until compacted database is in place
It is less error prone and window of failure opportunity is smaller
if the old (backup) database is always renamed (instead of sometimes
rmtree'd) before new (compacted) database is put into its place.
Finally rmtree() old database in case old database backup is not kept.
2013-11-19 20:13:25 -04:00
Tomi Ollila
19a89753ca compact: catch Xapian::Error consistently
catch Xapian::Error in compact code in lib/database.cc to be consistent
with other code in addition to not making software crash on uncaught
other Xapian error.
2013-11-17 20:25:43 -04:00
Tomi Ollila
4d5986e8ad compact: tidy formatting
Notmuch compact code whitespace changes to match devel/STYLE.
2013-11-17 20:25:25 -04:00
Mark Walters
24862d5b5f News for tree-view 2013-11-16 19:15:07 -04:00
Mark Walters
9838fe8e16 emacs: tree: use remap for the over-ridden global bindings
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.]
2013-11-13 21:47:00 -04:00
Mark Walters
b5f93cc0db emacs: help: add a special function to deal with remaps
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.
2013-11-13 21:46:50 -04:00
Mark Walters
8141555d25 emacs: help: add base-keymap
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.
2013-11-13 21:46:39 -04:00
Mark Walters
141f3813d8 emacs: help: split out notmuch-describe-key as a function
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.
2013-11-13 21:46:32 -04:00
Mark Walters
9d0174b11c emacs: help: remove duplicate bindings
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"
2013-11-13 21:33:28 -04:00
Mark Walters
6f616bd733 emacs: help: save-match-data
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.
2013-11-13 21:33:14 -04:00
Mark Walters
a5ecdf390e emacs: help: check for nil key binding
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.
2013-11-13 21:33:05 -04:00
Austin Clements
9ecfc1c426 emacs: Correct documentation of `notmuch-poll-script'
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.
2013-11-13 21:27:51 -04:00
Tomi Ollila
fc68430c36 NEWS: emacs: fix notmuch-mua-reply point placement
News for commit 4ceeaf8038

Minor grammar edit by db.
2013-11-13 21:27:25 -04:00
Mark Walters
919ca31581 remove notmuch-pick 2013-11-13 21:24:05 -04:00
Austin Clements
44bff5ce8c Accumulated news for Austin's changes 2013-11-13 07:25:07 -04:00
Jani Nikula
db5189a3b9 completion: update bash completion
Update bash completion to cover new commands and options:

notmuch compact --quiet --backup=DIR
notmuch count --output=files --batch --input=FILE
notmuch insert --folder=DIR --create-folder
notmuch search --exclude=all --duplicate=N
notmuch show --include-html
notmuch tag --batch --input=FILE --remove-all
2013-11-11 07:45:04 -04:00
Tomi Ollila
001d932816 devel/release-checks.sh: check NOTMUCH_(MAJOR|MINOR|MICRO)_VERSION
New defines NOTMUCH_MAJOR_VERSION, NOTMUCH_MINOR_VERSION and
NOTMUCH_MICRO_VERSION were added to lib/notmuch.h.
Check that these match the current value defined in ./version.
2013-11-11 07:44:44 -04:00
Austin Clements
96c0ce28f8 emacs: Fix search tagging races
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.
2013-11-08 20:52:00 -04:00
Austin Clements
23fb842e04 emacs: Add known-broken tests for search tagging races
These tests check that both thread-local and global search tagging
operations are race-free.  They are currently known-broken because
they aren't race-free.
2013-11-08 20:46:53 -04:00
Austin Clements
d622cb942a Add TODO about more efficient stable thread queries 2013-11-08 20:46:26 -04:00
Austin Clements
abeac48522 search: Add stable queries to thread search results
These queries will match exactly the set of messages currently in the
thread, even if more messages later arrive.  Two queries are provided:
one for matched messages and one for unmatched messages.

This can be used to fix race conditions with tagging threads from
search results.  While tagging based on a thread: query can affect
messages that arrived after the search, tagging based on stable
queries affects only the messages the user was shown in the search UI.

Since we want clients to be able to depend on the presence of these
queries, this ushers in schema version 2.
2013-11-08 20:43:29 -04:00
Austin Clements
730b8f61e0 emacs: Use notmuch tag --batch for large tag queries
(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!)
2013-11-08 20:35:13 -04:00
Austin Clements
662e097984 emacs: Support passing input via `notmuch-call-notmuch-*'
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.
2013-11-08 20:28:44 -04:00
Austin Clements
ddc44ae0d0 emacs: Move `notmuch-call-notmuch-process' to notmuch-lib
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.
2013-11-08 20:23:03 -04:00