Commit graph

1133 commits

Author SHA1 Message Date
Jonas Bernoulli
adc123e4fd emacs: avoid killing process buffer when process is still alive
In practice this probably does not make a difference or we would
have heard about it many times, but better be safe than sorry.

Process sentinels are called not only when the process has finished
but also on other state changes.
2021-01-13 07:08:13 -04:00
Jonas Bernoulli
904ffbc925 emacs: avoid passing around some redundant information
When running "notmuch" we use its full path but when displaying the
command to the user we show just its name for readability reasons.
Avoid passing around both representations because it is very easy
to get the name from the path.

Notmuch itself uses the involved functions just for "notmuch" but
there might be extensions that use them for other executable so we
forgo other potential simplifications.
2021-01-13 07:07:59 -04:00
Jonas Bernoulli
778950872d emacs: notmuch-start-notmuch: avoid storing process buffer twice
The buffer of the error process is accessible using `process-buffer'.
We still have to store the error-buffer in the non-error process
because for that process `process-buffer' obviously returns its own
buffer.
2021-01-13 07:07:47 -04:00
Jonas Bernoulli
db0fd8e782 emacs: notmuch-start-notmuch-sentinel: assert buffer is alive 2021-01-13 07:06:16 -04:00
Jonas Bernoulli
d57ce9ca71 emacs: notmuch-start-notmuch-error-sentinel: assert buffer is alive 2021-01-13 06:57:41 -04:00
Jonas Bernoulli
0afb3f8b21 emacs: notmuch-start-notmuch: remove backward compatibility code
We no longer support Emacs releases before version 25.1.

Also adjust the sentinels which only had to deal with
an error file when using an older Emacs release was used.
2021-01-13 06:57:31 -04:00
Jonas Bernoulli
d931758a15 emacs: define new notmuch-search-item widget type
This is complex enough to warrant a dedicated widget type,
which will make future improvements less messy to implement.
2021-01-13 06:57:14 -04:00
Jonas Bernoulli
d7b83385af emacs: sanitize dedicated widget action/notify functions
These functions are used as action/notify functions.  That dictates
the appropriate function signatures but even though these functions
are not used for anything else they use incompatible signatures,
forcing the callers to use lambda expressions to deal with these
incompatibilities.

Fix that by adjusting the function signatures to the needs of the
only intended callers.

Two of these functions were defined as commands but because the
interactive form did not return the mandatory arguments, we know
that nobody (successfully) used these as commands.

In one case we move the location of a y-or-n-p prompt.
2021-01-13 06:56:50 -04:00
Jonas Bernoulli
5b19e6e1b4 emacs: use setq instead of set
Commonly `set' is only used if there is no way around it;
i.e. when the variable cannot be known until runtime.
2021-01-13 06:56:40 -04:00
Jonas Bernoulli
0251cab3ab Revert "emacs: notmuch-search: avoid wiping out buffer-local variables"
This reverts commit f9fbd1ee3b.

Emacs provides a mechanism for avoiding wiping out buffer-local
variables: marking them as "permanent local", which essentially
means "don't wip out the local value when enabling major-mode".

  (put 'the-variable 'permanent-local t)

See (info "(elisp)Creating Buffer-Local").

Whether refreshing the buffer contents should involve re-enable the
mode is a different question, which should not be decided based on
the fact that we want keep the value of some random variable, not
least because some other (e.g. cache) variables are likely expected
to be wiped.
2020-12-25 14:32:56 -04:00
Jonas Bernoulli
adfded9ed0 emacs: avoid binding unnamed commands in keymaps
One should never bind unnamed commands in keymaps because doing that
makes it needlessly hard for users to change these bindings.

Replace such anonymous bindings with named commands that are generated
using macros and some boilerplate. Using macros is better than using a
simple loop because that makes it possible for `find-function' to find
the definitions. Eat your boilerplate--it forms character.

Admittedly this approach is quite ugly and it might be better to teach
the original commands to support different buffers directly instead of
requiring wrapper commands to do just that.

Never-the-less as a short-term solution this is better than what we
had before.
2020-12-06 16:23:38 -04:00
Jonas Bernoulli
54492ddf23 emacs: do not quote self-quoting t 2020-12-06 16:23:11 -04:00
Jonas Bernoulli
b4ee80dcbd emacs: use setq-local
It is available since Emacs 24.3 and we require at least Emacs 25.
It makes the variable buffer-local if it isn't always buffer-local
anyway.
2020-12-06 16:22:33 -04:00
Jonas Bernoulli
9fadab4e63 emacs: use defvar-local
It is available since Emacs 24.3 and we require at least Emacs 25.
2020-12-06 16:22:18 -04:00
Jonas Bernoulli
dff7f06711 emacs: inline notmuch-split-content-type
This trivial helper function actually made things slightly
*less* readable by adding an unnecessary indirection.
2020-12-06 16:22:07 -04:00
Jonas Bernoulli
4f57e01843 emacs: inline notmuch-documentation-first-line
Inline a simplified version of `notmuch-documentation-first-line'
into its only caller.  The new code snippet differs from the
removed function in that it returns nil instead of the empty string
for symbols that have no function documentation.  That value is
ultimately used as an argument to `concat', which treats nil like
the empty string.  So we can do the logical thing without changing
the behavior.
2020-12-06 16:21:51 -04:00
Jonas Bernoulli
6db692302d emacs: remove unnecessary notmuch-tree-button-activate
Since [1: f8bdba37] no key is bound to this command and it is
redundant because the behavior of `push-command' is identical
when called as a command.

1: f8bdba37d3
   emacs: tree: remove binding for pressing button in message pane
2020-12-06 16:21:15 -04:00
Jonas Bernoulli
e7b90eedad emacs: remove unused notmuch-address-locate-command
We stopped using it in [1: 0e671478].

1: 0e671478c6
   emacs: replace use of notmuch-address-message-insinuate
2020-12-06 16:21:07 -04:00
Jonas Bernoulli
ac8a117a84 emacs: remove unnecessary notmuch-remove-if-not
We could just have switched to using `cl-remove-if-not' instead,
but the two uses of the *remove-if-not function are pretty strange
to begin with so we refactor to not use any such function at all.
2020-12-06 16:20:57 -04:00
Jonas Bernoulli
1fbae387e3 emacs: remove deprecated notmuch-folder command
It has been deprecated for a decade and it's time to let go.
2020-12-06 16:20:44 -04:00
Jonas Bernoulli
53a4eb4780 emacs: misc doc-string improvements 2020-12-06 16:20:28 -04:00
Jonas Bernoulli
d6cacef832 emacs: always use elisp quoting style in doc-strings
Emacs doc-strings use neither markdown nor lisp symbol quoting.
2020-12-06 16:20:16 -04:00
Jonas Bernoulli
3cdf105e0f emacs: place complete first sentence on first doc-string line 2020-12-06 16:20:02 -04:00
Jonas Bernoulli
a7ba52eb94 emacs: place only first sentence on first doc-string line 2020-12-06 16:19:36 -04:00
Jonas Bernoulli
27b448f381 emacs: shorten/replace first sentence of a few doc-strings
The first sentence should fit on the first line.  It is okay if
the first sentence/line does not contain all the information that
the rest of the doc-string covers.
2020-12-06 16:19:23 -04:00
Jonas Bernoulli
471f161850 emacs: define notmuch-hello-url as a constant 2020-12-06 16:18:50 -04:00
Jonas Bernoulli
dfd99c7fba emacs: sanitize function that displays version
Previously it was defined in "notmuch-hello.el" and its name contained
"hello" solely because it replaced an anonymous function that was
mistakenly only bound in `notmuch-hello-mode-map'.  But it makes more
sense to bind it in all notmuch modes and even if we did not change
that aspect it still would make no sense to have "hello" in its name.
2020-12-06 16:18:34 -04:00
Jonas Bernoulli
ff80122972 emacs: more cleanup since dropping support for Emacs 24
Notmuch requires at least version 25 of Emacs now.

Adjust comments that previously referenced version 24 specifically,
even though they also apply to later releases. Remove documentation
and code that no longer applies.

- `mm-shr' no longer references `gnus-inhibit-images'.
2020-12-06 16:18:20 -04:00
Jonas Bernoulli
1acaaa093c emacs: remove kludge for Emacs 23 from notmuch-mua-mail
Notmuch requires at least Emacs version 25.

The `return-action' argument was added prior to Emacs 24.1
in 25ca2e61403f97b5a023164f2924d5f8aca2492a.
2020-12-06 16:17:52 -04:00
Jonas Bernoulli
f061ae5b42 emacs: fix old bug in notmuch-mua-mail
This fixes a regression introduced in [1: 7e20d264].  If the argument
RETURN-ACTION was non-nil then we should pass along the value of that
argument.  Instead we passed along the constant symbol `return-action'.

1: 7e20d26480
   emacs: Fix mail composition under Emacs 23
2020-12-06 16:17:36 -04:00
Jonas Bernoulli
8d701cdc99 emacs: remove redundant notmuch-hello-trim
Use `string-trim', which exists since Emacs 24.4.
2020-12-06 16:17:24 -04:00
Jonas Bernoulli
05a436f730 emacs: don't fset keymaps
These keymaps are never invoked as commands
so the function definitions serve no purpose.
2020-11-11 20:13:26 -04:00
Jonas Bernoulli
b9f328b75d emacs: add doc-string to notmuch-tree-mode-map 2020-11-11 20:13:16 -04:00
Jonas Bernoulli
0496668ad5 emacs: define notmuch-message-mode-map explicitly
Key bindings should not be defined at the top-level but inside
a `defvar' form.  Doing it at the top-level makes it harder to
reliably customize key bindings.
2020-11-11 20:13:00 -04:00
Jonas Bernoulli
bad0549da4 emacs: silence byte-compiler 2020-11-11 20:12:48 -04:00
Tomi Ollila
bdb6956afd emacs docs: rstdoc.el: consistent single quote conversions
With text-quoting-style 'grave keeps "'" and "`" quotes unaltered
for further processing done by this code (regardless of locale...).
The tools that read the reStructuredText markup generated can do
their styling instead.

Added temporary conversions of ' and ` to \001 and \002 so that
's and `s outside of `...' and `...` are converted separately
('s restored back to ' and `s converted to \`).

Both `...' and `...` are finally "converted" to `...` (not ``...``).
https://docutils.sourceforge.io/docs/user/rst/quickref.html documents
that as `interpreted text`:

 "The rendering and meaning of interpreted text is domain- or
  application-dependent. It can be used for things like index
  entries or explicit descriptive markup (like program identifiers)."

Which looks pretty much right.
2020-10-21 06:55:39 -03:00
Tim Quelch
45193bab16 emacs: Remove notmuch-mua-message-send-hook
Currently `message-send-hook` functions are being called twice: In
notmuch send common when `notmuch-mua-send-hook` functions are
run (which by default includes `notmuch-mua-message-send-hook`) and in
`message-send` itself.

Because `message-send-hook` functions are run in `message-send` itself,
we don't need also need to run them before we delegate to `message-send`

Calling `notmuch-mua-message-send-hook` resulted in functions in
`message-send-hook` to be called twice. This causes bugs in
non-idempotent hook functions.
2020-09-19 06:49:17 -03:00
Teemu Likonen
3512e2bc83 Emacs: Fix notmuch-message-summary-face definition
Emacs face definition forms are either

    ((DISPLAY . PLIST)
     (DISPLAY . PLIST))

or

    ((DISPLAY PLIST)   ;For backward compatibility.
     (DISPLAY PLIST))

Commit a2388bc56e (2020-08-08) follows
neither of the correct formats. It defines:

    `((((class color) (background light))
       ,@(and (>= emacs-major-version 27) '(:extend t))
       (:background "#f0f0f0"))
      (((class color) (background dark))
       ,@(and (>= emacs-major-version 27) '(:extend t))
       (:background "#303030")))

which produces:

    ((DISPLAY
      :extend t (:background "#f0f0f0"))
     (DISPLAY
      :extend t (:background "#303030")))

And that is wrong format.

This change fixes the face definition form to produce:

    ((DISPLAY
      :extend t :background "#f0f0f0")
     (DISPLAY
      :extend t :background "#303030"))

which follows the (DISPLAY . PLIST) format (see above).
2020-08-22 09:23:26 -03:00
Sean Whitton
88ae4f0251 emacs: Use pop-to-buffer-same-window rather than switch-to-buffer
This means that notmuch commands obey display-buffer-alist so the user
can customize how buffers show up.

It also permits the use of C-x 4 4, C-x 5 5 and C-x t t, available in
Emacs 28.  For example, one can use C-x 4 4 M-x notmuch-jump-search RET
to open a saved search in another window rather than the current window.
Or in notmuch-search mode, C-x 5 5 RET to view the message at point in
a new frame.

notmuch-tree has custom buffer display logic, so bind
display-buffer-overriding-action to make pop-to-buffer-same-window
behave exactly as switch-to-buffer while that function is running.
2020-08-22 09:11:06 -03:00
William Casarin
bcfd8575e5 emacs/tree: add notmuch-tree-archive-thread-then-next
Now that notmuch-tree-next-thread acts more like its notmuch-show
counterpart, let's update the binding to move to the next thread after
archiving.

Signed-off-by: William Casarin <jb55@jb55.com>
2020-08-16 10:42:27 -03:00
William Casarin
874f14ec2b emacs/tree: enable moving to next thread in search results
This introduces a new function called
notmuch-tree-next-thread-from-search which is analogous to
notmuch-show-next-thread. It will switch to the next or previous
thread from the parent search results.

We rename notmuch-tree-{prev,next}-thread to a more descriptive
notmuch-tree-{prev,next}-thread-in-tree to reflect the fact that it
only moves to the next thread in the current tree.

notmuch-tree-next-thread now switches to the next thread in the
current tree first, but if there are none, it looks for the next tree
in the search results.

This makes notmuch-tree feel more like notmuch-show when using the
M-Enter, M-n and M-p bindings.

Signed-off-by: William Casarin <jb55@jb55.com>
2020-08-16 10:42:17 -03:00
William Casarin
189175ecd6 emacs/tree: introduce notmuch-tree-parent-buffer variable
This variable will be used in a similar fashion to
notmuch-show-parent-buffer. It will be used to navigate between
threads from the parent search buffer.

Signed-off-by: William Casarin <jb55@jb55.com>
2020-08-16 10:42:02 -03:00
Teemu Likonen
adb90b9bb6 Emacs: Indent first header line only when indentation is turned on
Previously in message-show mode message's first header line (From
header) was always indented, even if user had turned thread
indentation off with "<" (notmuch-show-toggle-thread-indentation)
command.

This change modifies notmuch-show-insert-headerline function so that
it doesn't indent the first header line if notmuch-show-indent-content
variable is nil.

This change also modifies tests so that they expect this new output
format:
test/emacs-show.expected-output/notmuch-show-indent-thread-content-off
2020-08-15 09:16:34 -03:00
Jonas Bernoulli
6336c26d23 emacs: Use new advice mechanism do advice mm-shr
Also because we now only support Emacs >= 25,
we can remove the check for Emacs >= 24.
2020-08-09 21:17:39 -03:00
Jonas Bernoulli
96baa22318 emacs: Drop old advices that were only need for Emacs 23 2020-08-09 21:16:12 -03:00
Jonas Bernoulli
08b26f449d emacs: Remove notmuch-read-char-choice
Just use `read-char-choice', which existed since Emacs 24.1.
2020-08-09 21:15:54 -03:00
Jonas Bernoulli
2156517d90 emacs: Remove notmuch-setq-local
Just use setq-local, which existed since Emacs 24.3.
2020-08-09 21:15:27 -03:00
Jonas Bernoulli
9946380e47 emacs: Use cl-incf where appropriate
It's shorter.  That's it pretty much.
2020-08-09 21:15:27 -03:00
Jonas Bernoulli
42781f1821 NEWS: At least Emacs 25.1 is required now
Some backward incompatible changes follow in the next few commits
and going forward contributors don't have to worry about Emacs 24
at all anymore.
2020-08-09 21:14:36 -03:00
Jonas Bernoulli
a1b757c1ca emacs: Add end-of-file line to libraries that lack it 2020-08-09 21:14:36 -03:00
Jonas Bernoulli
254d0f9515 emacs: Provide 'rstdoc' feature at end of file
Features should nearly always be provided at the very end of their
libraries.  This feature isn't one of the rare exceptions.
2020-08-09 21:14:36 -03:00
Jonas Bernoulli
6c84dee531 Fix typos 2020-08-09 21:14:36 -03:00
Jonas Bernoulli
df3fab18fe emacs: Increase consistency of library headers 2020-08-09 21:14:36 -03:00
Jonas Bernoulli
73b8f0b8d7 emacs: Various cosmetic changes 2020-08-09 21:14:36 -03:00
Jonas Bernoulli
73cc4105aa emacs: Autoload notmuch-jump using an autoload cookie
Doing that is better than using an `autoload' form because the latter
may result in dependencies getting hidden and indeed it turns out we
have to declare `notmuch-jump' in "notmuch-tag.el".
2020-08-09 21:14:36 -03:00
Jonas Bernoulli
c2e9ec17fd emacs: Autoload notmuch-jump-search only once
This function is being autoloaded using an autoload cookie, so it
shouldn't additionally be autoloaded using an `autoload' form.

When building libraries we don't actually load the autoloads file and
dropping the `autoload' form results in an error, which reveals a so
far unspecified dependency: `notmuch-tree' needs `notmuch-jump'.

Before this commit compiling (or even just loading) `notmuch-tree'
resulted in `notmuch-jump' being loaded because the former requires
`notmuch-lib', which autoloaded `notmuch-jump-search'.

The bug was that this dependency was not explicitly specified, which
we fix by adding the respective `require' form.
2020-08-09 21:14:36 -03:00
Jonas Bernoulli
e63f37a4a9 emacs: Improve doc-strings
- The first sentence should fit on the first line in full.  This is
  even the case when that causes the line to get a bit long.  If it
  gets very long, then it should be made shorter.

- Even even the second sentence would fit on the first line, if it
  just provides some details, then it shouldn't be done.

- Symbols are quoted like `so'.

- There is no clear rule on how to (not) quote non-atomic
  s-expressions, but quoting like '(this) is definitely weird.

- It is a good idea to remember that \" becomes " and to take
  that in mind when adjusting the automatic filling by hand.

- Use the imperative form.

- Arguments are written in all uppercase.
2020-08-09 21:14:36 -03:00
Jonas Bernoulli
c454135376 emacs: Use makefile-gmake-mode in Makefile*s
Use `makefile-gmake-mode' instead of `makefile-mode' because the
former also highlights ifdef et al. while the latter does not.

"./Makefile.global" and one "Makefile.local" failed to specify any
major mode at all but doing so is necessary because Emacs does not
automatically figure out that these are Makefiles (of any flavor).
2020-08-09 21:14:36 -03:00
Jonas Bernoulli
177cd31fbd emacs: notmuch-poll: Let the user know we are polling
It is done synchronously and it can take a while,
so we should let the user know what is going on.
2020-08-09 20:59:11 -03:00
Jonas Bernoulli
14c4533c43 emacs: No longer define notmuch-hello-mode-map as a function
It was defined as such for a decade; ever since
a56010ac8b but there
wasn't a reason to do that then nor is there now.
2020-08-09 20:58:05 -03:00
Jonas Bernoulli
82390b2807 emacs: Fix some function declarations 2020-08-09 20:57:51 -03:00
Jonas Bernoulli
a2388bc56e emacs: Extend face to window edge again
Since Emacs 27 each face has to be explicitly configured to "extend
to the edge of the window".  Without doing that the face used for
the newline character only has an effect that spans "one character"
(i.e. it looks like there is a single trailing space character).

We don't want that so extend the face in Emacs 27, so that it looks
the same as it did in older Emacs releases.  We have to do this
conditionally, otherwise older Emacsen would choke on it.
2020-08-09 20:53:46 -03:00
Jonas Bernoulli
99b6e780c8 emacs: Use one or three lines for 'if' forms
Putting the COND and THEN parts on the same line but ELSE on a
separate line makes it harder to determine if there actually is
an ELSE part.
2020-08-09 20:53:30 -03:00
Jonas Bernoulli
e1a700067a emacs: Use 'when' instead of 'if' when there is no ELSE part 2020-08-09 20:52:34 -03:00
Jonas Bernoulli
09f6533c37 emacs: Use 'unless' instead of 'when' and 'not'
Also use 'unless' in a few cases where previously 'if' was used with
'not' but without an ELSE part.
2020-08-09 20:51:26 -03:00
Jonas Bernoulli
dfb1b8eb89 emacs: Use 'and' instead of 'when' when the return value matters
Also do so for some 'if' forms that lack an ELSE part.
Even go as far as using 'and' and 'not' instead of 'unless'.
2020-08-09 20:51:16 -03:00
Jonas Bernoulli
18d289c863 emacs: Only set one variable per setq form
It's a bit weird to avoid having to write the "(setq ... )" more than
once, just because we can.  In a language that uses '=' for the same
purpose we also happily use that once per assignment.

While there are no benefit to using just one 'setq' there are some
drawbacks.  It is not always clear on first what is a key and what a
value and as a result it is easy to make a mistake.  Also it becomes
harder to comment out just one assignment.
2020-08-09 20:50:50 -03:00
Jonas Bernoulli
2ee8e971c5 emacs: Closing parenthesis go on the same line 2020-08-09 20:50:36 -03:00
Jonas Bernoulli
caaa108760 emacs: Fix indentation 2020-08-09 20:48:09 -03:00
Jonas Bernoulli
6fb7d35069 emacs: Remove excess empty lines
Most people who write lots of lisp tend to only sparsely use empty
"separator" lines within forms.  In lisp they feel unnecessary and
since most files stick to this convention we get a bit confused
when there are extra empty lines.  It feels like the s-expressions
are falling into pieces.

All of this is especially true between a function's doc-string and
body because the doc-string is colored differently, which visually
already separates it quite sufficiently from the code that follows.
2020-08-09 20:47:52 -03:00
Jonas Bernoulli
a4617f29ce emacs: Shorten long lines 2020-08-09 19:48:36 -03:00
Teemu Likonen
e3fd546ad7 Emacs: Ensure left-to-right display for message headers
In notmuch-show buffer insert invisible U+200E LEFT-TO-RIGHT MARK
character at the beginning of message header paragraph if the From
header contains a right-to-left character. This ensures that the
header paragraph is always rendered in left-to-right mode.

See Emacs Lisp reference manual section "(elisp) Bidirectional
Display" for more info.
2020-08-08 16:18:23 -03:00
Sean Whitton
f9fbd1ee3b emacs: notmuch-search: avoid wiping out buffer-local variables 2020-07-22 19:48:24 -03:00
Tomi Ollila
ed40579ad3 emacs docstrings: consistent indentation, newlines, periods
Fixed emacs docstrings to be consistent. No functional change.

- removed some (accidental) indentation
- removed some trailing newlines
- added trailing periods where missing (some exclusions)
2020-06-06 07:55:58 -03:00
Sean Whitton
3e6e219384 emacs: Respect load-prefer-newer when loading `notmuch-init-file'
Before this change, `load-prefer-newer' was ignored.

Set NOERROR and MUST-SUFFIX arguments of `load' to t, and NOSUFFIX
argument to nil, to preserve the behaviour of the deleted `let' form.
2020-06-01 07:52:28 -03:00
Jonas Bernoulli
11ac932a45 emacs: Use cl-lib' instead of deprecated cl'
Starting with Emacs 27 the old `cl' implementation is finally
considered obsolete.  Previously its use was strongly discouraged
at run-time but one was still allowed to use it at compile-time.

For the most part the transition is very simple and boils down to
adding the "cl-" prefix to some symbols.  A few replacements do not
follow that simple pattern; e.g. `first' is replaced with `car',
even though the alias `cl-first' exists, because the latter is not
idiomatic emacs-lisp.

In a few cases we start using `pcase-let' or `pcase-lambda' instead
of renaming e.g. `first' to `car'.  That way we can remind the reader
of the meaning of the various parts of the data that is being
deconstructed.

An obsolete `lexical-let' and a `lexical-let*' are replaced with their
regular variants `let' and `let*' even though we do not at the same
time enable `lexical-binding' for that file.  That is the right thing
to do because it does not actually make a difference in those cases
whether lexical bindings are used or not, and because this should be
enabled in a separate commit.

We need to explicitly depend on the `cl-lib' package because Emacs
24.1 and 24.2 lack that library.  When using these releases we end
up using the backport from GNU Elpa.

We need to explicitly require the `pcase' library because
`pcase-dolist' was not autoloaded until Emacs 25.1.
2020-04-27 07:36:10 -03:00
Jonas Bernoulli
e02bb7e9fd emacs: Explicitly depend on Emacs 24
We use various things that were not available in earlier versions.
2020-04-16 07:58:27 -03:00
Jonas Bernoulli
b4b558ac38 emacs: Declare function notmuch-show-get-message-id 2020-04-16 07:58:20 -03:00
Keegan Carruthers-Smith
e083987338 emacs: use def instead of initial-input for notmuch-show-browse-urls
This is the non-deprecated way to use completing-read. Additionally
the old use was broken when using ivy for completing-read. For user's
using completing-read-default they won't see the default URL now, but
if they hit enter it will be visited. Alternatively they can select
it with M-n.

From the completing-read documentation for initial-input:

 This feature is deprecated--it is best to pass nil for INITIAL-INPUT
 and supply the default value DEF instead.  The user can yank the
 default value into the minibuffer easily using M-n.

Additionally collection is now all urls, rather than all but the
first. I'm not sure why "(cdr urls)" was previously done.
2020-04-14 12:29:47 -03:00
Keegan Carruthers-Smith
f28e0a9337 emacs: introduce notmuch-search-by-tag
This is like notmuch-search-filter-by-tag, but creates a new search
rather than filtering the current search. We add this to
notmuch-common-keymap since this can be used by many contexts. We bind
to the key "t", which is the same key used by
notmuch-search-filter-by-tag in notmuch-search-mode-map. This is done
intentionally since the keybinding for notmuch-search-mode-map can be
seen as a specialization of creating a new search.

This change was motivated for use in "notmuch-hello". It is a more
convenient way to search a tag than expanding the list of all tags. I
also noticed many saved searches people use are simply tags.
2020-04-14 12:29:31 -03:00
William Casarin
374217a01a emacs/tree: add x/X bindings
Add x and X binds to notmuch-tree for functionally that we have in
notmuch-show.

The notmuch-tree-quit binding is somewhat redundant, since it is
handled by notmuch-bury-or-kill-this-buffer which is bound to q.

Signed-off-by: William Casarin <jb55@jb55.com>
2020-04-06 07:17:55 -03:00
William Casarin
86f3cc265a emacs/tree: add notmuch-tree-archive-thread-then-exit
This is the notmuch-tree version of
notmuch-show-archive-thread-then-exit

Signed-off-by: William Casarin <jb55@jb55.com>
2020-04-06 07:17:34 -03:00
William Casarin
1abe5a0c5b emacs/tree: add notmuch-tree-archive-message-than-next-or-exit
This is the notmuch-tree version of
notmuch-show-archive-message-than-next-or-exit.

Signed-off-by: William Casarin <jb55@jb55.com>
2020-04-06 07:16:58 -03:00
William Casarin
c6f43306cc emacs/tree: add kill-both prefix argument to notmuch-tree-quit
This allows us to close both windows at the same time.

Signed-off-by: William Casarin <jb55@jb55.com>
2020-04-06 07:15:27 -03:00
William Casarin
d9888b301c emacs/tree: add notmuch-tree-matching-message
This functions removes some duplicate logic between
notmuch-tree-{next,prev}-matching-message

We do this because we will be adding some additional logic similar to
the notmuch-show-next-open-message function, and it will help if this
logic is all in one place.

Signed-off-by: William Casarin <jb55@jb55.com>
2020-04-06 07:15:07 -03:00
William Casarin
c0868d959d emacs/tree: add notmuch-tree-goto-matching-message
This function captures some common logic when jumping to matching
messages in notmuch-tree mode.

We also add a new return value (t or nil), that indicates if there was
a next matching message in the thread to show.

Signed-off-by: William Casarin <jb55@jb55.com>
2020-04-06 07:14:42 -03:00
William Casarin
8eec15a903 emacs/tree: return true if a thread was found in next-thread
This will allow us to pop back to parent buffers when there are no
more threads to jump to.

Signed-off-by: William Casarin <jb55@jb55.com>
2020-04-06 07:14:32 -03:00
Daniel Kahn Gillmor
ea16b5ba85 emacs: avoid warning about notmuch-show-get-message-id
Without this change, we see the following warning when compiling the
elisp:

```
EMACS emacs/notmuch-crypto.elc

In end of data:
emacs/notmuch-crypto.el:266:1:Warning: the function
    ‘notmuch-show-get-message-id’ is not known to be defined.
```

Thanks to Örjan Ekeberg and David Edmondson for their followup about
this.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2020-03-22 22:21:20 -03:00
Mark Walters
98e9bda17f notmuch-hello/jump: allow saved searches to specify unthreaded mode
Saved searches in notmuch-hello and notmuch-jump can specify whether
to use search mode or tree mode. This adds an option for them to
specify unthreaded mode.
2020-03-19 22:08:07 -03:00
Mark Walters
c578c32e3b Add a U binding to switch to unthreaded from other views
We have shortcuts S and Z to let the user switch to Search view and
Tree view with the current search. Add U to let the user switch to
unthreaded view from the current search, and ensure that S and Z
switch from unthreaded to search and tree veiew respectively.
2020-03-19 22:07:51 -03:00
Mark Walters
c36e91d9d4 Unthreaded mode: allow user to choose different `show out' than tree
Tree mode allows the user to choose whether to use the split screen
displaying just the current message or a full screen displaying the
entire thread. As unthreaded mode is quite different in use the user
may want a different customisation for this mode.
2020-03-19 22:07:20 -03:00
Mark Walters
a82fb6e670 Unthreaded mode: allow different result format
It is likely that the user will want a different line format for
unthreaded mode from tree mode; in particular the thread structure
graphics are unnecessary in unthreaded mode.

Add a new customisable variable and set it to something sensible.
2020-03-19 22:07:06 -03:00
Mark Walters
63f4ba3057 Introduce unthreaded mode
This commit introduces a new 'unthreaded' search mode where each
matching message is shown on a separate line. It shares almost all of
its code with tree view. Subsequent commits will allow it to diverge
slightly in appearance.
2020-03-19 22:06:49 -03:00
Steven Allen
92a7f26fac emacs: don't start processes stopped
It causes this function to fail with:

    let: Wrong type argument: null, t

Support for this was removed from Emacs in April
2019 (5c5e309527e6b582e2c04b83e7af45f3144863ac) because it never
worked correctly (apparently).

This also shouldn't be necessary as sentinels will not be called
unless emacs is idle or waiting for input. Therefore, the
`process-put' calls immediately following the `make-process' call
should always complete before the sentinel is first called.
2020-01-08 21:14:47 -04:00
Örjan Ekeberg
1d9ec88d87 emacs: limit search for attachment to stop at first mime-part
This commit changes the behaviour of notmuch-mua-attachment-check
so that it stops searching for notmuch-mua-attachment-regexp when a
new mime-part is reached.  This avoids false warnings when matching
words occur inside forwarded messages.
2019-12-14 07:28:42 -04:00
David Edmondson
a7884929d5 emacs: Improve the reporting of key activity
Improve the information provided about key retrieval and key validity.
2019-12-14 07:23:42 -04:00
David Edmondson
d137afface emacs: Add notmuch-crypto-gpg-program and use it
Allow the user to specify the gpg program to use when retrieving keys,
etc., defaulting to the value of `epg-gpg-program'.
2019-12-14 07:23:29 -04:00
David Edmondson
50f0cbcc4d emacs: Minor refactoring of crypto code 2019-12-14 07:23:06 -04:00
David Edmondson
a1d6e406f6 emacs: Asynchronous retrieval of GPG keys
Rather than blocking emacs while gpg does its' thing, by default run
key retrieval asynchronously, possibly updating the display of the
message on successful completion.
2019-12-14 07:22:53 -04:00
William Casarin
5f9ea4d290 emacs: bind M-RET to notmuch-tree-from-search-thread
This is an unbound function that is quite useful. It opens a selected
thread in notmuch-tree from the current search query.

Signed-off-by: William Casarin <jb55@jb55.com>
2019-12-03 07:43:36 -04:00
David Edmondson
a1139fb5ec emacs: A prefix argument kills rather than browsing URLs
In `notmuch-show', the "B" key (notmuch-show-browse-urls) will kill
the URL if called with a prefix argument rather than browsing
directly.
2019-12-03 07:41:38 -04:00
Daniel Kahn Gillmor
11f7e52651 emacs: add keywords to notmuch-emacs-mua.desktop
Debian's lintian has an informational alert
desktop-entry-lacks-keywords-entry, which recommends including
Keywords= in a .desktop file.

I dug around a bit in /usr/share/applications/*.desktop to make sure
that we covered the range of keywords other e-mail applications are
using.  If anyone has other suggestions for keywords, they can add
them to this list.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-06-29 21:06:18 +02:00
David Bremner
a6a8df7e03 build: drop variable HAVE_EMACS. use WITH_EMACS instead
The extra flexibility of having both HAVE_EMACS (for yes, there is an
emacs we can use) and WITH_EMACS (the user wants emacs support) lead
to confusion and bugs. We now just force WITH_EMACS to 0 if no
suitable emacs is detected.
2019-06-12 19:58:30 -03:00
Daniel Kahn Gillmor
9300defd64 emacs: Drop content-free "Unknown signature status" button
When we have not been able to evaluate the signature status of a given
MIME part, showing a content-free (and interaction-free) "[ Unknown
signature status ]" button doesn't really help the user at all, and
takes up valuable screen real-estate.

A visual reminder that a given message is *not* signed isn't helpful
unless it is always present, in which case we'd want to see "[ Unknown
signature status ]" buttons on all messages, even ones that don't have
a signing structure, but i don't think we want that.

Amended by db to drop the unused initialization of 'label'
2019-05-25 13:02:02 -03:00
Leo Vivier
46ab6013a2 emacs: make notmuch-search-interactive-region obsolete
`notmuch-search-interactive-region' was moved to notmuch-lib.el in
f3cba19f88 and renamed to
`notmuch-interactive-region' without making the old function
obsolete, thereby breaking user-commands which made use of it.

This commit marks the function as obsolete and makes it an alias for
the new function.
2019-05-23 14:05:05 -03:00
Daniel Kahn Gillmor
f079e7b9c3 emacs: drop use of message-default-charset
Apparently, message-default-charset is deprecated, which causes the
following warning messages during the build:

  In notmuch-maildir-setup-message-for-saving:
  emacs/notmuch-maildir-fcc.el:172:31:Warning: ‘message-default-charset’ is an
      obsolete variable (as of 26.1); The default charset comes from the
      language environment

In discussion with emacs upstream over on
https://debbugs.gnu.org/35370, it appears that we can just drop this
entirely and things should still work with emacs 25.
2019-05-07 06:35:44 -03:00
Pierre Neidhardt
f3cba19f88 emacs: Move notmuch-search-interactive-region to notmuch-lib as notmuch-interactive-region 2019-05-07 06:31:19 -03:00
Örjan Ekeberg
2dfbd26c42 emacs: Make first documentation line distinct for "a" and "x" commands.
Since only the first line of the documentation is shown by the
help command, it is confusing when "x" and "a" seem to have the same
binding in show-mode.  This commit makes the two function documentations
first lines different and (hopefully) clearer.
2019-04-26 08:18:10 -03:00
Örjan Ekeberg
f599ea7877 emacs: Add missing type and group to defcustom variable
Added the type 'regexp and group 'notmuch-send as properties to the
customizable variable notmuch-mua-attachment-regexp.
2019-04-24 07:06:55 -03:00
David Bremner
e4a8d6e2a4 build: only try to build .rsti files if we have emacs and sphinx
Emacs is needed to build them, and sphinx is needed to use them
2019-04-24 06:53:13 -03:00
Örjan Ekeberg
606f2a6615 emacs: Tag forwarded messages with +forwarded (customizable)
Use the buffer-local variable notmuch-message-queued-tag-changes
to change tags when the forwarding message is sent.
2019-04-14 08:00:44 -03:00
Örjan Ekeberg
d9800c8932 emacs: Use a buffer-local variable to update tags when sending replies
Instead of relying on the "In-Reply-To" header, use a buffer-local variable,
notmuch-message-queued-tag-changes, to add and remove tags to affected
messages when the message-send-hook is triggered.
2019-04-14 07:58:06 -03:00
Örjan Ekeberg
3b807db52b emacs: Add References header to forwarded messages
Include the message-id of forwarded messages in the new message.
This ensures that the new (forwarding) message is linked to the
same thread as the message being forwarded.
2019-04-14 07:57:32 -03:00
Léo Gaspard
8e584392dc emacs: make editing a message as new include FCC
This changes the meaning of `e` for non-drafts to make it behave
similarly to new messages, which here means add the `FCC` header.
2019-03-31 13:20:32 -03:00
Yang Sheng
0ae8cab4d3 Fix notmuch-describe-key
Fix notmuch-describe-key crashing for the following two cases
1. format-kbd-macro cannot deal with keys like [(32 . 126)], switch to
use key-description instead.
2. if a function in the current keymap is not bounded, it will crash
the whole process. We check if it is bounded and silently skip it to
avoid crashing.
2019-03-31 12:00:50 -03:00
David Edmondson
1aae6daef7 emacs: Optionally check for missing attachments in outgoing messages
Query the user if the message text indicates that an attachment is
expected but no MML referencing an attachment is found.

This is not enabled by default - see the documentation for
`notmuch-mua-attachment-check'.
2019-03-28 14:37:07 -03:00
David Edmondson
235fdc52f4 emacs: Easy access to URLs mentioned in the current message
Add a new binding when looking at messages, B, that prompts with a
list of URLs found in the current message, if any. Open the one that
is selected in a browser.

amended by db: s/--browse-urls/-browse-urls/
2019-03-28 14:29:02 -03:00
Matt Armstrong
adde6dfaef Emacs: bind "g" to 'notuch-refresh-this-buffer
Using "g" for refresh operations is a pretty common Emacs convention,
codified by `special-mode' in simple.el.
2019-02-21 07:16:53 -04:00
David Bremner
3d0fd40eb0 Merge branch 'release' 2019-02-10 09:47:47 -04:00
Daniel Kahn Gillmor
3c752b855f emacs: Invoke gpg with --batch and --no-tty
When invoking gpg as a backgrounded tool, it's important to let gpg
know that it is backgrounded, to avoid spurious prompts or other
breakage.

In particular, https://bugs.debian.org/913614 was a regression in
GnuPG which causes problems when importing keys without a terminal,
but gpg expects one.

Ensuring that notmuch-emacs always invokes gpg as a background process
should avoid some of these unnecessary failure.

Thanks to Justus Winter for finding this problem.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-02-10 09:47:12 -04:00
David Bremner
87eb477ba5 notmuch 0.28.1 release
-----BEGIN PGP SIGNATURE-----
 
 iQGzBAABCAAdFiEE3VS2dnyDRXKVCQCp8gKXHaSnniwFAlxUOSIACgkQ8gKXHaSn
 nizwvAv8DPoLLssPfwY1AJtc7+JQzAl5scpkjJbGYlzXWTkhD14Efnb0FzMFulRG
 fG4gpsqFA9iNJGT2uTKtYRvKayoMNQMk2eSk8IKyINIVO/jclNbsaSFhL7vqyzsm
 8l+A1UBQ2BsmUsv58ImoS/F65iF2ZBXu5OEEzqxzL+m+WBh9rNyuBaN4Arr64eVy
 f0V/CWYr9VmauuWg0UW3lZ2kwT2+eJDdw7/UwkdeaesuqypPrb+PyRbSDozr4yEj
 n+l0LsbP2iN2i8b0MBNS1vf9fSkUxhBmLzSoqJWbsEZFKwXLFTp5+TLyVxYDzKO5
 D5ug22DG4VFUOmvBaKkMdnavr8z0QZrfL1/z6998Ux+iYG/YrITsrAv02+BxXr5a
 MPmmhW+9x5AZBSP/qasvNCu/Zhczcu/DZ0oUe5qLXTY0yPsOWZRv/+iAWTxXbk+Q
 iS5wbmeZsF/WSH1l3vtK9PnD1wePqITQPK22bKCjSXhPxWOO6AxNcfpy3/lsZ2j2
 9NPLfpFl
 =G2Qd
 -----END PGP SIGNATURE-----

Merge tag '0.28.1'

notmuch 0.28.1 release
2019-02-01 08:35:20 -04:00
David Bremner
617b36f3d1 emacs: use ".ps" suffix for PostScript temporary files.
Joerg Jaspert [1] reported problems with evince reading unsuffixed
temporary files in Debian.

[1]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=920856
2019-01-30 07:15:59 -04:00
David Bremner
0a9fc49b90 emacs: build docstring (rsti) files
These are intended to included in the sphinx manual for notmuch-emacs.
The stamp file makes it easier to depend on the docstrings from other
parts of the build
2018-12-08 08:49:31 -04:00
David Bremner
1ac110c12e emacs: initial version of rstdoc.el
This small library is intended to support batch extraction of Emacs
Lisp docstrings from source files. Clients will need to include (or
replace) rstdoc.rsti.
2018-12-08 08:45:48 -04:00
William Casarin
0d0e2869b9 emacs: filter tag completions by current query
When filtering by tags in notmuch-search-filter-by-tag, only return tags
related to the current query.

Before, it was returning all tags. There's no reason to refine the
current query with tags that don't exist in the current result set.

Signed-off-by: William Casarin <jb55@jb55.com>
2018-12-06 21:22:40 -04:00
David Bremner
7f726c6e87 emacs: escape quote in docstring
This prevents emacs from turning it into a fancy, non-evaluable
docstring (and also makes it easier to deal with during extraction to
sphinx).
2018-10-21 10:30:51 -03:00
David Bremner
5e98bdc3be emacs: require notmuch-lib from notmuch-wash.el
This is needed so that notmuch-wash.el is loadable by itself; in
particular for the docstring processing.
2018-10-21 10:30:32 -03:00
David Edmondson
329a8c7fce emacs: Update integration with third party packages.
`mm-inline-text-html-with-images' was removed from mm-decode.el in
2016 and replaced with `mm-html-inhibit-images'.

`gnus-select-frame-set-input-focus' was removed from gnus-util.el in
2016 and existed only for XEmacs compatibility.
2018-10-08 12:50:34 -03:00
David Edmondson
e8cb6b2cd6 emacs: Call `notmuch-mua-send-hook' hooks when sending a message
Previously any hook functions attached to `notmuch-mua-send-hook' were
ignored.
2018-09-28 20:22:42 -03:00
David Bremner
ef07e3f3bd build: install notmuch-emacs-mua with absolute shebang
Follow distro-centric rules to reduce the chance of surprising
behaviour due to PATH changes
2018-09-18 07:34:33 -03:00
David Edmondson
cfd015bda4 emacs: Kill the stderr buffer when an async process completes
On some platforms (e.g. macOS), it is necessary to add a real sentinel
process for the error buffer used by `notmuch-start-notmuch' rather
than a no-op sentinel.
2018-08-29 06:27:59 -03:00
David Bremner
95f441b06b doc: install info files in elpa package
The duplication of effort in installing into different places seems
unavoidable; or more precisely not worth avoiding by more extensive
gnu-make-isms.
2018-05-26 08:26:22 -07:00
Daniel Kahn Gillmor
c20a5eb805 move more http -> https
Correct URLs that have crept into the notmuch codebase with http://
when https:// is possible.

As part of this conversion, this changeset also indicates the current
preferred upstream URLs for both gmime and sup.  the new URLs are
https-enabled, the old ones are not.

This also fixes T310-emacs.sh, thanks to Bremner for catching it.
2018-05-03 20:59:20 -03:00
Georg Faerber
c117306f2d Fix typos as found by codespell
Signed-off-by: Georg Faerber <georg@riseup.net>
2018-03-24 20:09:54 -03:00
Daniel Kahn Gillmor
54982e520c fix typos 2018-01-04 20:35:58 -04:00
Daniel Kahn Gillmor
af8255fb71 cli/reply: make --decrypt take a keyword
This brings the --decrypt argument to "notmuch reply" into line with
the other --decrypt arguments (in "show", "new", "insert", and
"reindex").  This patch is really just about bringing consistency to
the user interface.

We also use the recommended form in the emacs MUA when replying, and
update test T350 to match.
2017-12-29 16:45:55 -04:00
Daniel Kahn Gillmor
8ea4a99d74 cli/show: make --decrypt take a keyword.
We also expand tab completion for it, update the emacs bindings, and
update T350, T357, and T450 to match.

Make use of the bool-to-keyword backward-compatibility feature.
2017-12-29 16:45:46 -04:00
David Bremner
040c3236af Merge branch 'release'
Conflicts:
        NEWS

Add in NEWS from point release
2017-12-08 22:19:06 -04:00
Tomi Ollila
f55e9a3bda emacs: letf enriched-decode-display-prop for text/enriched display
Dynamically bind enriched-decode-display-prop when inserting
text/enriched part. This complements commit 9b05823838 for
emacs versions before 24.4 which do not have advice-add
functionality.

Since emacs 25.3 this particular bug is fixed.
2017-12-08 20:35:41 -04:00
Jani Nikula
b2b65b4e6d emacs: sanitize subject in replies
Commit a7964c86d1 ("emacs: Sanitize authors and subjects in search
and show") added sanitization of header information for display. Do
the same for reply subjects.

This fixes the long-standing annoying artefact of certain versions of
mailman using tab as folding whitespace, leading to tabs in reply
subjects.
2017-09-27 08:15:02 -03:00
David Bremner
ff6d3b6489 emacs/address: use member instead of memq to check for pair
Quoting from the elisp reference:

     For other types (e.g., lists, vectors, strings), two arguments
     with the same contents or elements are not necessarily ‘eq’ to
     each other.

Thanks to "Attic Hermit" for the fix.
2017-09-12 22:17:32 -03:00
David Bremner
4366895062 notmuch 0.25.1 release
-----BEGIN PGP SIGNATURE-----
 
 iQGzBAABCAAdFiEE3VS2dnyDRXKVCQCp8gKXHaSnniwFAlm3OCwACgkQ8gKXHaSn
 niz5Swv/bhm/cSBRoav7deonMPfAAqloeNSdCpcOksEvGFtn6PZMHPDLfQ0DORcb
 pHIfGnrIpGFKlOZ8zO4Q3ANhito7hCCaasn6k70Zhpu5KV+YMCKMABtnho1p3jKT
 elK/3tkvlcWFEgRBVbuLsTn/iYFz8kaukfRyh+BhlchJSifSZQDFaPnmxOCvOfNK
 Aipp7o/yAQGgiXUczISgceirOEruq3QePC9Bjbzj3UKa5D/UUqki37xlojl9dUC7
 eNmt/grittR4e0eU5ytKck5KlVwxirs9U3Hm9A8o9giWkk98lJYobLXpDFPQ8Ock
 7GGIMyP3DGBGTfn5mswKUdiEsuCgobH47y4RBd0jpSyTpFDSTD/BTYTiU/kSa8k4
 XNO9uS4+jrgUJ4rfrZYK1VNXfQ85L17zZCpgeGgV+XguVcLKwQEjQ945/wk32pVh
 03vdQX57myPLWeWVo5pIB0qzKeuEuaZ5b2m1QngHYUgROEm5PZnBGGHkgS50dNxp
 5156wSur
 =dTj5
 -----END PGP SIGNATURE-----

Merge tag '0.25.1'

notmuch 0.25.1 release (bugfix for emacs bug 28350)
2017-09-11 22:32:00 -03:00
Jani Nikula
9b05823838 emacs: override enriched-decode-display-prop for text/enriched display
Switch to a local version of enriched-decode-display-prop if we
encounter a text/enriched part. This is to mitigate
https://bugs.gnu.org/28350. Normally it would be prudent to remove the
override afterwards, but in this case just leave it in.

Notes from db:
      This doesn't disable text/enriched, just one feature of it.
2017-09-11 22:08:01 -03:00
Vladimir Panteleev
1348212cb0 emacs: Refuse requests to refresh tree views while a refresh is running
notmuch-tree did not protect against concurrent refreshes like
notmuch-search, meaning, hitting '=' (notmuch-refresh-this-buffer)
quickly will spawn multiple parallel notmuch processes, and clobber
the existing results in the current buffer.

* notmuch-tree.el: Add a guard to notmuch-tree-refresh-view similar to
  the one in notmuch-search.
2017-09-05 21:50:03 -03:00
Vladimir Panteleev
d7a49e8199 notmuch-tag.el: Fix minor grammar error 2017-08-23 08:08:01 -03:00
Vladimir Panteleev
fdf2b3007a emacs: Use make-process when available
make-process is a new function introduced in Emacs 25, which provides
greater control over process creation. Crucially, it allows
separately redirecting stderr directly to a buffer, which allows us to
avoid needing to use the shell to redirect to a temporary file in
order to correctly distinguish stdout and stderr.

* notmuch-lib.el: Use make-process when it is available; fall back to
  the previous method when not.
2017-08-20 08:33:09 -03:00
Vladimir Panteleev
69946c47c9 emacs: Refactor subprocess stderr propagation
Load subprocess error output to a string in the callers, and propagate
the error messages as a string parameter instead of a path to file
names.

Required to be able to avoid using temporary files for subprocess
error output.

* notmuch-lib.el: Update notmuch-check-async-exit-status,
  notmuch-check-exit-status: accept an err parameter instead of
  err-file; shift the responsibility of loading error messages from
  files up the call stack.
2017-08-20 08:32:47 -03:00
Jani Nikula
cb5253578d emacs: set query-context to nil if its "" or "*"
The queries "" and "*" are special cased in the notmuch library to
match all messages, but only if they're the entire query. They can't
be combined with other queries, such as "* AND foo", in which case
they "leak" down to the Xapian query parser.

Notmuch show and tree buffers inadvertently combine the thread query
with said special queries, causing incorrect collapsing of
messages. Handle the special queries specially. We already do a
similar thing in notmuch-search-filter.
2017-08-20 08:32:07 -03:00
Vladimir Panteleev
ca4688e103 Use rooted paths in .gitignore files
A leading / in paths in a .gitignore file matches the beginning of the
path, meaning that for patterns without slashes, git will match files
only in the current directory as opposed to in any subdirectory.

Prefix relevant paths with / in .gitignore files, to prevent
accidentally ignoring files in subdirectories and possibly slightly
improve the performance of "git status".
2017-08-18 19:42:35 -03:00
David Bremner
c28ac94abf emacs: Add commentary for MELPA users
We have a steady trickle of people using notmuch-emacs from melpa with
distro packages of notmuch, and then being confused when it doesn't
work. Try to warn people what a foot-gun this is; this commentary
should be copied to the melpa web site.
2017-07-20 07:01:17 -03:00
David Bremner
1d82110f83 emacs: convert remaining format-versions from 3 to 4
This is needed for consistent beheviour between notmuch built against
gmime-2.6 and gmime-3.0 w.r.t. error reporting.
2017-07-18 06:57:26 -03:00
David Bremner
f1bcb6b7c2 emacs: change default for notmuch-crypto-process-mime to t
There are some cases like remote usage where this might cause
problems, but those users can easily customize the variable. The
inconvenience seems to be outweighed by the security benefit for most
users.
2017-07-15 09:11:32 -03:00
Kyle Meyer
37d1fa5672 emacs: tree: drop repeated "of" from docstring 2017-07-10 21:58:30 -03:00
David Bremner
e1b7d32db0 cli: implement structured output version 4
Since the error field is unused by the emacs front end, no changes are
needed other than bumping the format version number.

As it is, this is a bit overengineered, but it will reduce duplication
when we support gmime 3.0
2017-07-04 08:32:44 -03:00
David Bremner
b6f87c3085 emacs: convert to use format-version 3
Keeping the emacs interface running old format-versions makes it
impossible to test new format-versions or deprecate old ones.
2017-07-04 08:32:28 -03:00
Tom Hinton
d848d4040a Fix minor mistake where indentation width is ignored 2017-06-30 08:55:16 -03:00
Damien Cassou
3840b6b495 Add indentation to imenu in notmuch-show 2017-06-30 08:33:29 -03:00
Piotr Trojanek
c9deb32933 remove extra space in Emacs prompt
Trivial: fix extra space in the "Insert failed" Emacs prompt message.
2017-06-25 09:57:48 -03:00
Damien Cassou
a83ab29930 Add Emacs' imenu support in notmuch-show and notmuch-search
Emacs' major modes can facilitate navigation in their buffers by
supporting Imenu. In such major modes, launching Imenu (M-x imenu)
makes Emacs display a list of items (e.g., function definitions in a
code buffer). Selecting an item from this list moves point to this
item.

This patch adds Imenu support to both notmuch-show and notmuch-search
buffers:

* in notmuch-show, Imenu will present a list of all messages in the
  currently visible thread;

* in notmuch-search, Imenu will present a list of all messages in the
  search buffer.
2017-06-14 07:49:08 -03:00
Tomi Ollila
427fa5e6e6 emacs: with prefix argument, notmuch-show-stash-date stashes timestamp
Using timestamp of a message is useful in many Xapian queries.
2017-05-30 08:54:35 -03:00
David Bremner
523d2b50fc Merge branch 'release'
Emacs bug fix from Mark
2017-05-13 08:51:10 -03:00
Mark Walters
2d79d38a0f emacs: tree: bugfix: specify --format-version
Previously notmuch tree did not specify the format-version when
calling notmuch. This meant that when the structured output was
slightly changed (in commit 14c60cf168)
stash filename broke. This fixes this breakage by specifying the
format-version.
2017-05-13 08:47:04 -03:00
David Bremner
0b76e4a6f4 emacs/notmuch.el: don't use 'function' as variable name.
In principle this should work, but at least in some pre-release
versions of emacs26, this causes problems inside lexical let [1].

[1]: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26406
2017-04-20 06:58:32 -03:00
John Byrnes
f0d06c8ca3 emacs: use epg-gpg-program
Adjusted notmuch-crypto gpg call-process function to respect
the GPG program set by the EasyPG epg-gpg-program variable.

This is to correct a problem observed on NixOS where only gpg2 is
installed by default. The Notmuch Emacs frontend fails when trying to
access someone's key to verify their signature when it cannot find the
GPG binary.
2017-03-13 21:12:14 -03:00
Mark Walters
95e9c137e1 emacs: compat: backport fix for folding long headers when sending
This backports the fix from emacs master (commit
77bbca8c82f6e553c42abbfafca28f55fc995d00) to notmuch-emacs to wrap
long headers.

This fixes the test introduced in the previous changeset.
2017-03-04 21:16:42 -04:00
Jani Nikula
4f2a7993a5 emacs/desktop: update to use notmuch-emacs-mua and handle mailto
With the mailto: handling in notmuch-emacs-mua, we can update the
desktop file to advertize we can be set as the default application to
handle email. While at it, add GenericName and Comment to be more
informative.

With --hello, notmuch-emacs-mua will run (notmuch) if mailto: url is
not given.
2017-03-01 19:33:52 -04:00
Mark Walters
df483ed4bd emacs: show: stop display of application/* parts
Gnus seems to display application/zip and application/tar by
default. This doesn't seem desirable so we override it.

We only override if the user has not customized
mm-inline-override-types themselves.
2017-02-26 07:55:00 -04:00
Jani Nikula
524372de10 emacs: use (system-name) instead of system-name
Fix the deprecation warning:

In notmuch-maildir-fcc-make-uniq-maildir-id:
emacs/notmuch-maildir-fcc.el:279:53:Warning: ‘system-name’ is an obsolete
    variable (as of 25.1); use (system-name) instead

I've used (system-name) since at least 2011, so it must have been
around quite a while.
2017-02-26 07:37:01 -04:00
Mark Walters
9916dea473 emacs: company: remove two build warnings
This adds two defvars to avoid two build warnings in the notmuch emacs
code. These were both introduced (by me) in commit 827c28a0.
2017-02-23 08:55:10 -04:00
Mark Walters
3e21b22c32 emacs: fully add the notmuch-address customize group
We now have several customizable options for address completion. There
is a customize group notmuch-address but it only contains one of these
options. Add all the others, and make it part of the notmuch customize
group.
2017-02-23 08:54:55 -04:00
Mark Walters
08343d3da0 emacs: address: save hash
This allows the user to save the address hash so that it is much
faster for the first completion after a restart. This defaults to off
as there are privacy implications to saving this information.

The code tries hard to avoid overwriting the wrong file. It also notes
if changes have been made to any of the relevant user settings, so
that the user does not get surprising results (i.e., outdated options
being used). Finally it stores some version information so that is
easy for us to update the format of the save file.
2017-01-27 22:08:16 -04:00
Mark Walters
df9736f20b emacs: address: move address-full-harvest-finished to a function
This makes the code access notmuch-address-full-harvest-finished via a
helper function, notmuch-address--harvest-ready. Later we will use
this to check whether we can load the harvest instead of regenerating
it.
2017-01-27 22:07:43 -04:00
David Bremner
5de84d0752 Merge branch 'release'
Add back in no-display parameter by hand.
2016-12-15 21:57:10 +09:00
David Bremner
001256ab29 emacs: restore autoload cookie for notmuch-search
The cookie only applies to next form, so in the previous location it
applied to the put, rather than the function.
2016-12-15 20:22:34 +09:00
Jani Nikula
383796c325 build: update the desktop database after installing the desktop file
This makes the option to choose Notmuch as mailto: handler show up in
the desktop environment settings. Ignore errors.
2016-11-28 22:04:26 -04:00
Jani Nikula
459989b7ef build: install notmuch-emacs-mua.desktop file with emacs
There is really no need to have a separate install target for the
desktop file. Just install the desktop file with emacs, with a
configure option to opt out.
2016-11-28 22:01:45 -04:00
Jani Nikula
66c1bff416 notmuch.desktop: move under emacs as notmuch-emacs-mua.desktop
The notmuch.desktop file is part of notmuch-emacs. Move it under
emacs, and rename as notmuch-emacs-mua.desktop to reflect this.
2016-11-26 08:16:39 -04:00
Jani Nikula
440d24e7cc build: install notmuch-emacs-mua with notmuch-emacs
notmuch-emacs-mua is good enough to be installed with notmuch-emacs.
2016-11-26 08:16:19 -04:00
Jani Nikula
a5df39c276 notmuch-emacs-mua: add --hello parameter
If the --hello parameter is given, display the notmuch hello buffer
instead of the message composition buffer if no message composition
parameters are given.

Signed-off-by: Jani Nikula <jani@nikula.org>
2016-11-26 08:15:11 -04:00
Jani Nikula
04174cdfad emacs: move notmuch-emacs-mua under emacs
While the notmuch-emacs-mua script is a sort of cli command, it is
really a part of notmuch-emacs. Move it under the emacs directory.
2016-11-26 08:10:44 -04:00
David Bremner
10f8c5d205 build/emacs: add target to create elpa package
This package can be created without emacs, but will only be usable in
versions of emacs supporting package.el
2016-11-26 07:57:58 -04:00
David Bremner
60ac94fe58 Merge branch 'release'
Updates for 0.23.2
2016-11-17 08:25:08 -04:00
David Bremner
297d27e9f9 emacs: generate notmuch-pkg.el
This file contains metadata for the built in (as of emacs 24) packaging
system.
2016-11-16 21:45:56 -04:00
Mark Walters
a3e712fa86 emacs: add compatibility functions for emacs 23
Some of the recent changes to the emacs code have used functions
introduced in emacs 24. The functions used are read-char-choice and
setq-local. This changeset adds a file notmuch-compat.el which
contains compatibility functions so that it should work on emacs
23.

Note, since these functions are taken almost unchanged from the emacs
source they are copyright the Free Software Foundation, and the header
in the file reflects that.
2016-11-16 21:42:34 -04:00
David Bremner
2dd96d6bd6 emacs: resume messages
Provide functionality to resume editing a message previously saved with
notmuch-draft-save, including decoding the X-Notmuch-Emacs-Secure
header.

Resume gets the raw file from notmuch and using the emacs function
mime-to-mml reconstructs the message (including attachments).

'e' is bound to resume a draft from show or tree mode.
2016-11-13 13:15:31 -04:00
David Bremner
90248f862b emacs: check drafts for encryption tags before saving
In general the user may not want to save plaintext copies of messages
that they are sending encrypted, so give them a chance to abort.
2016-11-13 13:15:31 -04:00
Mark Walters
d820b97477 emacs: postpone a message
This provides initial support for postponing in the emacs frontend;
resuming will follow in a later commit. On saving/postponing it uses
notmuch insert to put the message in the notmuch database

Current bindings are C-x C-s to save a draft, C-c C-p to postpone a
draft (save and exit compose buffer).

Previous drafts get tagged deleted on subsequent saves, or on the
message being sent.

Each draft gets its own message-id, and we use the namespace
draft-.... for draft message ids (so, at least for most people, drafts
are easily distinguisable).
2016-11-13 12:55:24 -04:00
Mark Walters
f8bdba37d3 emacs: tree: remove binding for pressing button in message pane
We want to use "e" for editting postponed messages in show, and in
tree view, so remove the binding for the function which does

     (In message pane) Activate BUTTON or button at point
2016-11-13 12:55:16 -04:00
David Bremner
4817005bfc emacs: rename notmuch-address-completion-hook to notmuch-address-post-completion-functions
Apparently it is a (not completely adhered to) emacs convention [1] that
only hooks that don't take arguments end in 'hook'

[1]: https://www.gnu.org/software/emacs/manual/html_node/elisp/Hooks.html
2016-11-13 08:52:17 -04:00
David Bremner
343534d82d emacs: add notmuch-address-post-completion-hook
This hook can be used to update the message based on the results of
address completion. For example using message-templ or gnus-alias to set
the From address based on the To address just completed.

The post-completion command is added to the notmuch-company backend to
ensure that the hook is also called company completion is started
without going through notmuch-address-expand-name. See the docstring of
`company-backends' for more information.
2016-11-04 12:51:50 -03:00
Mark Walters
e5786283e7 emacs: tree: use message pane decryption state for replies
This makes replying to a message in tree view, use the decrypted state
from the message pane if it is open. Previously it just used the
global decryption state from notmuch-crypto-process-mime.

In particular if notmuch-crypto-process-mime is nil, and the user
views the messages (which doesn't decrypt), toggles decryption in the
message pane, and then replies, the reply will be decrypted.
2016-11-02 07:45:28 -03:00
Mark Walters
8a20400490 emacs: tree: allow the user to decrypt the message pane
This makes $ in the tree pane toggle decryption in the message
pane. Without this the user can only decrypt the message pane by
switching to it, or by setting decryption on globally by setting
notmuch-crypto-process-mime to t.
2016-11-02 07:45:18 -03:00
Matt Armstrong
d62f9dbfc0 emacs: make faces readable on dark backgrounds.
The notmuch-tag-flagged, notmuch-search-flagged-face and
notmuch-crypto-part-header faces defaulted to "blue", which is nearly
unreadable when a dark background is in use.  This is addressed by using
"LightBlue1" for dark backgrounds.

As a side effect, these faces are now no-op definitions for grayscale or
mono displays.
2016-11-02 07:40:20 -03:00
Mark Walters
b810e64242 emacs: make notmuch-search-tag tag the region when called non-interactively.
The normal tag commands in search mode tag the all threads meeting the
region when called interactively. This makes them do the same when
called non-interactively. This is a change in the api.
2016-10-31 08:10:27 -03:00
David Bremner
608a3cb231 Merge branch 'release'
merge interesting buffers bugfix from release
2016-10-25 21:57:23 -03:00
Mark Walters
8128c7b5aa emacs: tree: make tag updates show in the message pane
This makes tag changes appear in the message pane as well as in the
tree window.

Note that the message pane is reloaded each time a message is viewed
so the tags shown in the message pane can still be different from
those in the tree window. Usually this will just be that the tag
change is still shown as a change (strikethough underline etc) in the
tree window, and are shown after the change in the message
pane. However, if something else updates the database then the tags
shown can be genuinely different.
2016-10-25 18:13:16 -03:00
Mark Walters
09caa0fce7 emacs: interesting-buffer bugfixes/updates
The command notmuch-interesting-buffer has got out of date -- it
doesn't mention notmuch-tree, and it still refers to message-mode not
notmuch-message-mode. Update both of these.

This fixes the bug that notmuch-cycle-notmuch-buffers does not include
notmuch-tree or notmuch-message-mode buffers in its cycling.
2016-10-25 18:12:12 -03:00
Matt Armstrong
c2d1984b02 Add notmuch-show--build-queries.
notmuch-show--build-buffer now queries a list of queries built by the
former.  This simplifies the logic.  It also provides an easy place to
experiment with alternate sets of queries for given notmuch-show-*
variables (e.g. users can use advice-add to do so in a surgical way).
2016-10-22 12:47:09 -03:00
David Bremner
d93e9cee13 Merge in test-suite, docstring fixes, release prep 2016-10-22 12:44:39 -03:00
Keith Amidon
4bf3bb31dd Expand docstrings about fcc using notmuch-insert
This commit expands docstrings for notmuch-fcc-dirs and
notmuch-maildir-fcc-with-notmuch-insert to describe how quoted strings
are processed and make the ability to configure sent folders containing
whitespace more discoverable.
2016-10-22 12:28:13 -03:00