notmuch-show can be slow displaying large attachments so hide them by
default. The default maximum size is 10000 bytes/characters but it is
customizable.
Note that notmuch-show-insert-bodypart is also called from the reply
code so we need to be a little careful.
Besides generally cleaning up the code and separating the general
content ID handling from the w3m-specific code, this fixes several
problems.
Foremost is that, previously, the code roughly assumed that referenced
parts would be in the same multipart/related as the reference.
According to RFC 2392, nothing could be further from the truth:
content IDs are supposed to be globally unique and globally
addressable. This is nonsense, but this patch at least fixes things
so content IDs can be anywhere in the same message.
As a side-effect of the above, this handles multipart/alternate
content-IDs more in line with RFC 2046 section 5.1.2 (not that I've
ever seen this in the wild). This also properly URL-decodes cid:
URLs, as per RFC 2392 (the previous code did not), and applies crypto
settings from the show buffer (the previous code used the global
crypto settings).
Unibyte strings are meant for representing binary data. In practice,
using unibyte versus multibyte strings affects *almost* nothing. It
does happen to matter if we use the binary data in an image descriptor
(which is, helpfully, not documented anywhere and getting it wrong
results in opaque errors like "Not a PNG image: <giant binary spew
that is, in fact, a PNG image>").
`notmuch-get-bodypart-content' could do two very different things,
depending on conditions: for text/* parts other than text/html, it
would return the part content as a multibyte Lisp string *after*
charset conversion, while for other parts (including text/html), it
would return binary part content without charset conversion.
This commit completes the split of `notmuch-get-bodypart-content' into
two different and explicit APIs: `notmuch-get-bodypart-binary' and
`notmuch-get-bodypart-text'. It updates all callers to use one or the
other depending on what's appropriate.
The new function, `notmuch-get-bodypart-binary', replaces
`notmuch-get-bodypart-internal'. Whereas the old function was really
meant for internal use in `notmuch-get-bodypart-content', it was used
in a few other places. Since the difference between
`notmuch-get-bodypart-content' and `notmuch-get-bodypart-internal' was
unclear, these other uses were always confusing and potentially
inconsistent. The new call clearly requests the part as undecoded
binary.
This is step 1 of 2 in separating `notmuch-get-bodypart-content' into
two APIs for retrieving either undecoded binary or decoded text.
We set header-line-format to the message subject, but if the subject
contains percents, the next character is interpreted as a formatting
control, which is not desired.
The TAB-initiated address completion generates completion candidates
synchronously, blocking the UI. Since this can take long time, it is
better to let the use know what's happening.
Make a new customizable variable instead of relying on
message-cite-function because the default for the latter changed
between emacs releases.
The defcustom is borrowed from the message.el source, with minor
modifications.
The faces used when washing messages should be notmuch specific and
inherit from the underlying emacs face rather than using it
directly. This allows the washed face to be modified without requiring
the modification of the underlying face.
`with-current-notmuch-show-message' applies a `no-conversion' coding
system when reading a raw message from notmuch. That coding system
should _not_ be applied when the body of the macro is evaluated, as it
can cause file operations used during that evaluation to incorrectly
apply the `no-conversion' coding system.
This was discovered when a user's .signature file contained non-ASCII
characters. When a message is forwarded, the `no-conversion' coding
system was applied to the reading of the .signature file, resulting in
raw rather than UTF-8 interpretation of the data.
notmuch-jump uses window-body-width which is not defined in emacs
23. To get around this it does
(unless (fboundp 'window-body-width)
;; Compatibility for Emacs pre-24
(defalias 'window-body-width 'window-width))
This makes sure window-body-width is defined and all should be
well. But it seems that the byte compiler does not realise that this
guarantees that window-body-width will be defined and so, when
compiling with emacs 23, it gives an error
In end of data:
notmuch-jump.el:172:1:Warning: the function `window-body-width' is not known to be defined.
Domo and I came to following on irc: wrap the (unless (fboundp ...))
inside eval-and-compile which ensures that both the test and the
defalias (if needed) happen at both compile and load time. This fixes
the warning.
default-value needs its argument to be quoted.
Slightly strangely default-value of 't or nil is 't or nil
respectively so the code
(default-value notmuch-search-oldest-first)
just gives the current value of notmuch-search-oldest-first rather
than intended default-value of this variable.
The symptom is that if you are in a search buffer and use notmuch jump
to run a saved search which does not have an explicitly set sort order
then the sort order of the saved-search is inherited from the current
search buffer rather than being the default search order.
Thanks to Jani for finding the bug.
Fix byte compiler warning "Warning: the function `window-body-width'
is not known to be defined." by moving our compatibility wrapper
before its use and simplify the definition to a defalias for the old
name of the function.
This should help new users off to a better start with the addition of
more sensible saved searches and default shortcut keys. Most existing
users have probably customized this variable and won't be affected.
This introduces notmuch-jump, which is like a user-friendly,
user-configurable global prefix map for saved searches. This provides
a non-modal and much faster way to access saved searches than
notmuch-hello.
A user configures shortcut keys in notmuch-saved-searches, which are
immediately accessible from anywhere in Notmuch under the "j" key (for
"jump"). When the user hits "j", the minibuffer immediately shows a
helpful table of bindings reminiscent of a completions buffer.
This code is a combination of work from myself (originally,
"notmuch-go"), David Edmondson, and modifications from Mark Walters.
notmuch-poll-script has long since been deprecated in favor of
post-new hooks, but this wasn't obvious from the documentation.
Update the documentation to make this clear. Since
notmuch-poll-script could, to some extend, be used to control the path
of the notmuch binary and that use is now clearly discouraged, promote
notmuch-command to a real defcustom instead of just a variable.
tree overrides notmuch-show-get-prop so that it can use many of the
utility function directly. Now that tree is in mainline the version
from tree can be moved to show and the original overridden show
version dropped.
This adds the current query as a "default value" to
notmuch-read-qeury. The default value is available via a down-arrow as
opposed to history which is available from the up arrow.
Note if a user presses return in the minibuffer this value is not
returned.
The implementation is simple but notmuch-read-query could be called
via notmuch-search/notmuch-tree etc from any buffer so it makes sense
to put the decision of how to extract the current query in
notmuch-read-query rather than in each of the callers.
notmuch-search-archive-thread moves to the next line after tagging. In
the normal case this makes sense, but if the region is active, it tags
the whole region and then it doesn't really. Thus only move to the
next line if region is not active.
Add a function for updating seen messages to the
post-command-hook. This function calls a customizable (by eg
defcustom) function with parameters the start and end of the current
window and that function can decide what to mark read based on that
and the current point.
Since this is in the post-command-hook it should get called after most
user actions (exceptions include user resizing the window) so it
should be possible to make sure the seen status gets updated whether
the user uses notmuch commands like next-message or normal emacs
commands like scroll-up.
It removes all of the old mark read/seen points but introduces a
simple example function that just marks the current message read if it
is open. This function has one small subtlety: it makes sure it
doesn't mark the same message read twice (in the same instance of the
same buffer); otherwise the post-command-hook makes it impossible for
a user to manually mark a message unread.
This fixes the current bugs (imo) that closed messages can be marked
read, and that opening a closed message does not mark it read.
Another advantage of using the post-command-hook any programmatic use
with point passing through a message will not mark it read.
When the user begins forwarding a message, the resulting composition
buffer should not be marked as modified, in order that it can
immediately be killed without prompting.
`make install-emacs` will copy $(emacs_sources), $(emacs_images) and
$(emacs_bytecode) to their target directories. $(emacs_bytecode) was
already a prerequisite of make install-emacs as these obviously needed
to be build. Until a while ago all of $(emacs_sources) was available
in the repository, but now it includes `notmuch-version.el` which
is generated. In the future we may have generated emacs images too.
Currently notmuch-tag throws a "wrong-type-argument stringp nil" if
passed a nil query-string. Catch this and provide a more useful error
message. This fixes a case in notmuch-tree (if you try to tag when at
the end of the buffer).
Secondly, as pointed out by David (dme)
`notmuch-search-find-stable-query-region' can return the query string
() if there are no messages in the region. This gets passed to notmuch
tag, and due to interactions in the optimize_query code in
notmuch-tag.c becomes, in the case tag-change is -inbox, "( () ) and
(tag:inbox)". This query matches some strange collection of messages
which then get archived. This should probably be fixed, but in any
case make `notmuch-search-find-stable-query-region' return a nil
query-string in this case.
This avoids data-loss (random tag removal) in this case.
The implementation and documentation for `notmuch-search-line-faces'
disagreed in how elements in the list were merged. Correct the
documentation to match the implementation (that is, the earlier
elements in the list have precedence over later elements).
Some archives may use a more complicated scheme for referring to
messages than just concatenated url and message-id. In particular,
patchwork requires a query to translate message-id to a patchwork
patch id. Allow functions in notmuch-show-stash-mlarchive-link-alist
to facilitate this.
For example, one could use something like this for patchwork.
(lambda (message-id)
(concat
"http://patchwork.example.com/patch/"
(nth 0
(split-string
(car (last (process-lines "pwclient" "search" "-n" "1"
"-m" (concat "<" message-id ">"))))))))
The recent changes for saved searches introduced a bug when notmuch
was loaded after the saved search was defined. This was caused by a
utility function not being defined when the defcustom was loaded.
Fix this by moving some code around: the defcustom is moved into
notmuch-hello (which is a more natural place anyway), and the utility
functions are moved before the defcustom in notmuch-hello. We are
rather constrained as the defcustom for saved searches is the first
variable in the notmuch-hello customize window; to avoid moving this
customize the defcustom needs to be the first defcustom in
notmuch-hello, and the utility functions come before that.
This patch also renames one of the utility functions from
notmuch--saved-searches-to-plist to
notmuch-hello--saved-searches-to-plist (as it is purely local to
notmuch-hello) and corrects a couple of typo/spelling mistakes pointed
out by Tomi.
Previously, even if debug-on-error was non-nil, the debugger would not
trap on part renderer errors. This made debugging part renderer bugs
frustrating, so let the debugger trap these errors.
My recent changes to the saved search format broke the alphabetically
sorted saved sort option. This makes it work again.
Also update docs for saved-search sort defcustom to match the new
format.
Finally, since the saved-search list is no longer an alist change the
names in the sort function to avoid confusion.
It was decided that auto-signing is potentially too troublesome for the
apparently common case of users who enable crypto processing for the
purpose of checking signature validity but who are not in a position to
sign out-going messages. Users can still manually invoke signing as needed.
Encrypting replies to encrypted messages is more of a security issue
so we leave it in place.
This is a simple approach to improving security when replying to
signed or encrypted messages. If the message being replied to was
signed, add mml tag to sign the reply. If the message being replied to
was encrypted, add mml tag to sign and encrypt the reply.
This may need configuration; I for one might want to encrypt replies
to encrypted messages, but not always sign replies to signed messages.
This still includes a slight bug: if any mml tags are added, they are
included in the region containing the quoted parts. Killing the region
will kill the mml tags too.
This adds a sort-order option to saved-searches, stores it in the
saved-search buttons (widgets), and uses the stored value when the
button is pressed.
Storing the sort-order in the widget was suggested by Jani in
id:4c3876274126985683e888641b29cf18142a5eb8.1391771337.git.jani@nikula.org.