Commit graph

22 commits

Author SHA1 Message Date
David Bremner
5500868bd9 emacs: mark notmuch-query.el as obsolete
The only functionality actually used by notmuch is the base function
notmuch-query-get-threads; the other functions in this file have
nothing to do with that (single) use.  Move that function into
notmuch-lib.el and rename to reflect use. Deprecate the other
functions in notmuch-query.el.
2022-07-03 17:08:08 -03:00
David Bremner
731697d671 CLI: define and use format version 5
This is a bit of a cheat, since the format does not actually
change. On the other hand it is fairly common to do something like
this to shared libary SONAMEs when the ABI changes in some subtle way.
It does rely on the format-version argument being early enough on the
command line to generate a sensible error message.
2021-08-22 07:05:13 -07:00
Jonas Bernoulli
16b2db0986 emacs: various cosmetic improvements 2021-01-15 06:38:00 -04:00
Jonas Bernoulli
fc4cda07a9 emacs: use lexical-bindings in all libraries
Doing so causes many new compile warnings.  Some of these warnings
concern genuine changes in behavior that have to be addressed right
away.

Many other warnings are due to unused variables.  Nothing has changed
here, except that the byte-compiler can now detect these pre-existing
and harmless issues.  We delay addressing these issues so that we can
focus on the important ones here.

A third group of warnings concern arguments that are not actually used
inside the function but which cannot be removed because the functions
signature is dictated by some outside convention.  Silencing these
warning is also delayed until subsequent commits.
2021-01-13 07:16:04 -04:00
Jonas Bernoulli
2ca941163d emacs: make headings outline-minor-mode compatible
`outline-minor-mode' treats comments that begin with three or more
semicolons as headings.  That makes it very convenient to navigate
code and to show/hide parts of a file.

Elips libraries typically have four top-level sections, e.g.:

;;; notmuch.el --- run notmuch within emacs...
;;; Commentary:...
;;; Code:...
;;; notmuch.el ends here

In this package many libraries lack a "Commentary:" section, which is
not optimal but okay for most libraries, except major entry points.

Depending on how one chooses to look at it, the "... ends here" line
is not really a heading that begins a section, because it should never
have a "section" body (after all it marks eof).

If the file is rather short, then I left "Code:" as the only section
that contains code.  Otherwise I split the file into multiple sibling
sections.  The "Code:" section continues to contain `require' and
`declare-function' forms and other such "front matter".

If and only if I have split the code into multiple sections anyway,
then I also added an additional section named just "_" before the
`provide' form and shortly before the "...end here" line.  This
section could also be called "Back matter", but I feel it would be
distracting to be that explicit about it.  (The IMO unnecessary but
unfortunately still obligatory "... ends here" line is already
distracting enough as far as I am concerned.)

Before this commit some libraries already uses section headings, some
of them consistently.  When a library already had some headings, then
this commit often sticks to that style, even at the cost inconsistent
styling across all libraries.

A very limited number of variable and function definitions have to be
moved around because they would otherwise end up in sections they do
not belong into.

Sections, including but not limited to their heading, can and should
be further improved in the future.
2021-01-13 07:10:27 -04: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
e1a700067a emacs: Use 'when' instead of 'if' when there is no ELSE part 2020-08-09 20:52:34 -03:00
Jonas Bernoulli
caaa108760 emacs: Fix indentation 2020-08-09 20:48:09 -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
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
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
Daniel Kahn Gillmor
6a833a6e83 Use https instead of http where possible
Many of the external links found in the notmuch source can be resolved
using https instead of http.  This changeset addresses as many as i
could find, without touching the e-mail corpus or expected outputs
found in tests.
2016-06-05 08:32:17 -03:00
Chunyang Xu
0cf457b73b emacs: Fix packaging
Refer to (info "(elisp) Library Headers") for package conventions.
2016-04-16 08:24:42 -03:00
Tomi Ollila
2bd374c91e emacs: dropped rest of now-unused JSON functionality
Notmuch cli provides all structured data previously provided
in json format now in s-expression format, rendering all current
json functionality obsolete.
2013-07-20 09:13:48 -03:00
Austin Clements
43251ab653 emacs: Use S-exp format everywhere
This switches `notmuch-mua-reply' and `notmuch-query-get-threads' to
the S-exp format.  These were the last two uses of the JSON format in
the Emacs frontend.
2013-06-24 22:57:13 -07:00
Austin Clements
2cdb3f54f7 emacs: Use --format-version for search, show, and reply 2012-12-16 17:22:26 -04:00
Austin Clements
66c935cff3 emacs: Factor out synchronous notmuch JSON invocations
Previously this code was duplicated between show and reply.  This
factors out synchronously invoking notmuch and parsing the output as
JSON.
2012-12-16 17:00:22 -04:00
Jameson Graef Rollins
45fe354745 emacs: Add support for PGP/MIME verification/decryption
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.
2011-05-27 16:22:00 -07:00
Jameson Rollins
15d8928f41 emacs: send notmuch-query stderr to /dev/null
The call-process to notmuch in notmuch-query.el was previously sending
stderr into the output buffer.  This means that if there is any stderr
the JSON parsing breaks.  Unfortunately call-process does not support
sending stderr to a separate buffer or to the minibuffer [0], but it
does support sending it to /dev/null.  So we do that here instead.

[0] a bug was filed against emacs (#7842)
2011-01-27 14:44:05 +10:00
Carl Worth
4ddb5ab4dd emacs: Fix to eliminate warning in notmuch-query-map-aux
This is one of those cases where the warning looks absolutely correct,
(complaining about a free variable), but I'm left wondering how the
original code could have worked at all.

From what I can tell, this code wasn't actually being called by any
of the current code in notmuch.
2010-10-27 17:54:38 -07:00
David Bremner
c2f3710a78 notmuch-query.el: new file to support access to the notmuch database.
Initially this file provides one main function
notmuch-query-get-threads, which takes a set of search terms, and
returns a parsed set of matching threads as a lisp data structure.

A set of notmuch-query-map-* functions are provided to help map
functions over the data structure.

The function notmuch-query-get-message-ids uses this machinery to get
the set of message-ids matching a query.

Edited-by: Carl Worth <cworth@cworth.org>: Change comment syntax,
(";;" rather than ";" to make emacs-lisp mode happy), and eliminate
some excess whitespace, as suggested by David Edmonson.
2010-04-05 11:08:45 -07:00