Richard Russon [Mon, 23 Jan 2017 16:15:43 +0000 (16:15 +0000)]
merge: add a recursive mkdir function
* lib: add mutt_mkdir
* create tmpdir
* bcache: use mutt_mkdir()
* nntp: use mutt_mkdir
* hcache: use mutt_mkdir
* Optimise the case of an existing cache file
Guyzmo [Tue, 10 Jan 2017 12:59:40 +0000 (13:59 +0100)]
Support of relative paths sourcing and cyclic source detection
Added HEAP/FILO structure and global singleton to contain the the list
of config files that have been sourced, and detect cyclic sourcing.
Implemented with a simple heap API:
Added a new method `to_absolute_path()` to convert a path into an absolute
path, relatively to another config file's path. Using POSIX methods to
do so, adding libgen's header in `mutt.h`.
Ian Zimmerman [Fri, 16 Dec 2016 18:42:36 +0000 (10:42 -0800)]
Extend the ~m pattern to allow relative ranges
The ~m pattern now accepts absolute ranges, relative ranges and has some
mnemonics (shortcuts).
There are shortcuts for some emails:
^ First email
. Current email
$ Last email
These shortcuts can be used anywhere a number is used in the examples
below.
Relative ranges have a comma ',' in them:
-3,. Previous 3 emails plus the current one
.,$ Current email and all the later ones
-2,2 Previous 2, current and next 2 emails
0,1 Current and next email
Richard Russon [Wed, 18 Jan 2017 16:57:02 +0000 (16:57 +0000)]
merge: notmuch search windows
* Searching with a window over notmuch vfolders
* Fix of the sidebar item highlight when matched by current search
* Makes the sidebar show the real msg count on the current mailbox
* Add doxygen documentation comments
* Improving the API naming and typing
Bernard Pratz [Sat, 7 Jan 2017 18:08:53 +0000 (19:08 +0100)]
Makes the sidebar show the real msg count on the current mailbox
run a notmuch count when loading values for the currently highlighted
mailbox when drawing the sidebar up, to show the request's total number
instead of just the window's number.
Bernard Pratz [Sat, 7 Jan 2017 17:52:55 +0000 (18:52 +0100)]
Fix of the sidebar item highlight when matched by current search
Because searches done manually (or shifted with a window) have an
absolute path to the current Maildir within the URI, whereas the one
declared with the virtual-mailboxes command usually have implicit
Maildir path specification, this patch parses the given URL of a mailbox
and re-builds it to contain the full path.
For that purpose has been added:
- nm_normalize_uri() function
Has been modified:
- get_query_string (in mutt_notmuch): earned an argument to disable
adding of a window in the context of the nm_normalize_uri function.
- mutt_parse_virtual_mailboxes: the path value is sent through the
nm_normalize_uri() function to be normalized.
Bernard Pratz [Sun, 15 Jan 2017 19:53:09 +0000 (19:53 +0000)]
Searching with a window over notmuch vfolders
following up on #278
Instead of adding a new command for searches that will result in
windowed searches, this commit patches a lower function of the search
mechanism, the `get_query_string()` function.
There, any search is buffered in the `nm_query_window_current_search`
global variable. And a newly introduced non-exposed function
`window_query_from_query` is taking a `data->db_query` and adds a
`date:` field implementing the window.
That function won't add a `date:` field if there's no duration set or if
there's already a date field in the query (to avoid risks of an empty
intersection).
To disable the feature, just set `nm_query_window_duration` to `0`.
The improvements over #278 implementation is that now it's working with
any search done with notmuch, whether it's a `virtual-mailbox` or using
the `vfolder-from-query` command.
Richard Russon [Sun, 15 Jan 2017 01:22:48 +0000 (01:22 +0000)]
reformat the source to mutt standards
reindent - 2 spaces
braces {} on new line
indent case statements
bracket logic - () around complex bools
rename static functions - drop "nm_" prefix
move functions - static first
move mx_ops functions to end
fix typos
reorder includes
add some doxygen comments
Richard Russon [Fri, 13 Jan 2017 14:22:08 +0000 (14:22 +0000)]
Revert "Searching with a window over notmuch vfolders"
This is the first version of Bernard's search windows.
As the final version is slightly different, I'm removing it from this
release to save confusion.
somini [Sun, 1 Jan 2017 12:37:54 +0000 (12:37 +0000)]
Allow custom status flags in index_format
The commit introduces the variable $flag_chars.
It allows the user to customise the status flags show in the index.
$flag_chars affects both %S and %Z.
$flag_chars defaults to "*!DdrONon- "
Char | Default | Description
------|---------|----------------------------------------------
1 | * | The mail is tagged
2 | ! | The mail is flagged as important
3 | D | The mail is marked for deletion
4 | d | The mail has attachments marked for deletion
5 | r | The mail has been replied to
6 | O | The mail is Old (Unread but seen)
7 | N | The mail is New (Unread but not seen)
8 | o | The mail thread is Old (Unread but seen)
9 | n | The mail thread is New (Unread but not seen)
10 | - | The mail is read - %S expando
11 | <space> | The mail is read - %Z expando
When searching over a very large result, the result will be very slow for mutt
to load. So, inspired by sup's feature to iteratively load the results, I figured
adding a couple of commands to move an user set window backward/forward in time
could be useful. And a new command extending the default vfolder-from-query function
is being exposed.
The current window information is user settable, so the user can make a macro that
would do useful stuff about a search (like moving the window's position around, or
further tweaking current search).
* addition of four configuration variables, the first two are aimed at configuring
the behaviour of the feature, the last two are exposing internals to make it
hacking friendly:
- nm_query_window_duration: duration for each window
- nm_query_window_timebase: time base for each window
- nm_query_window_current_search: the search being displayed as vfolder
- nm_query_window_current_position: the current window's position
* addition of three bindable commands:
- windowed-vfolder-from-query: execute a search with a window applied
- windowed-vfolder-backward: move the window backwards in time
- windowed-vfolder-forward: move the window forwards in time
Richard Russon [Tue, 20 Dec 2016 15:15:39 +0000 (15:15 +0000)]
fix: rework initials to allow unicode characters
Take a name, e.g. "John F. Kennedy" and reduce it to initials "JFK".
The function saves the first character from each word. Words are
delimited by whitespace, or hyphens (so "Jean-Pierre" becomes "JP").
Adam Borowski [Wed, 21 Dec 2016 22:10:02 +0000 (23:10 +0100)]
manually touch 'atime' when reading a mbox file
futimens is a new thing, coming from POSIX-2008, yet all modern Unices added
it almost immediately. If it isn't implemented, silently ignoring that is
no worse than current state.
While performance issues related to atime updates have been greatly reduced
by relatime and lazytime, it is an abomination for other reasons: CoW
filesystems (btrfs, zfs, ...), CoWed VM images, deduplicating thin
provisioning, etc lose significant space for every snapshot. It also causes
wear on flash-based storage prevalent on SoCs, and so on. Thus, it is
prudent to mount everything with noatime.
There is only one real use for atime these days: new mail notification on
mbox files. With only a limited number of readers (mutt is one), let's
do atime updates manually.
This can be done unconditionally: while redundant without noatime, there's
no performance loss as the inode will be dirty already in such case.
Richard Russon [Sat, 31 Dec 2016 16:45:35 +0000 (16:45 +0000)]
merge: upstream fixes (mutt/default)
* search muttrc file according to XDG Base Specification (closes #3207)
* Fix loop terminator in in mutt_find_cfg().
* Backout inlining of MUTT_VERSION in 42fee7585fae.
* Revert changes made to mutt_find_cfg() in 3c6d322912e3
* Improve openssl interactive_check_cert. (closes #3899)
* Add mutt_array_size macro, change interactive_check_cert() to use it. (see #3899)
* Return to pager upon aborting a jump operation. (closes #3901)
* Change sidebar_spoolfile coloring to be lower precedence.
* automatic post-release commit for mutt-1.7.2
* Move '@' pattern modifier documentation to the right section.
* Add setenv/unsetenv commands.
* Rework OpenSSL certificate verification to support alternative chains. (closes #3903)
* Remove unused OPS
* Add option to control whether threads uncollapse when new mail arrives.
* In the manual, replaced 2 para by example (similar to the first example).
* Create mbchar_table type for multibyte character arrays. (see #3024)
* Make to_chars and status_chars accept mulitibyte characters. (closes #3024)
* sync xdg config file handling
* sync Fromchars to upstream version
Michał Kępień [Tue, 13 Dec 2016 19:16:10 +0000 (11:16 -0800)]
Rework OpenSSL certificate verification to support alternative chains. (closes #3903)
The way Mutt currently verifies SSL certificates using OpenSSL does
not support alternative chains, which may cause confusion when some
popular mail providers (e.g. Gmail) are used with specific sets of
trusted CA certificates.
Replace the "manual" verification done by mutt in
check_certificate_by_signer() with SSL_set_verify() using a callback.
OpenSSL then does the certificate verification, including properly
looking at alternative chains. The callback still provides the
opportunity to override using ~/.mutt_certificates or an interactive
prompt.
Kevin McCarthy [Sat, 3 Dec 2016 23:24:32 +0000 (15:24 -0800)]
Change sidebar_spoolfile coloring to be lower precedence.
Give sidebar_new and sidebar_flagged higher precedence than
sidebar_spoolfile, so that new and flagged message colors will show up
for the spoolfile in the sidebar.
Don't use X509_NAME_oneline() with a fixed size buffer, which could
truncate the string, perhaps leaving off the CN field entirely.
Instead, work directly off the X509_NAME.
Rather than use strstr to tokenize it, call
X509_NAME_get_text_by_NID() with the nid types. Although
X509_NAME_get_text_by_NID() is "legacy", it is the most directly
useful for mutt in this simple interactive prompt.
The function was set up to include the ST and C fields in the prompt,
but the loop limit was too low. I believe this was an oversight, so
increase the loop to include those two fields.
Kevin McCarthy [Fri, 18 Nov 2016 01:54:35 +0000 (17:54 -0800)]
Revert changes made to mutt_find_cfg() in 3c6d322912e3
The usage of MUTT_VERSION in mutt_find_cfg() was fine before the
commit: it wasn't using MUTT_VERSION inlined into a string with format
string substitution.
Revert to the version of mutt_find_cfg() before that changeset.
Damien Riegel [Mon, 14 Nov 2016 02:45:35 +0000 (18:45 -0800)]
search muttrc file according to XDG Base Specification (closes #3207)
First of all, the MUTT_VERSION symbol is now concatenated (when
possible) at compile time.
Then, the logic to find the config file has been changed a bit to remove
unnecessary calls to access(), so now each possible locations for the
config file is only tested once, and it stops as soon as a valid one has
been found. So instead of:
access("/home/dkc/.muttrc-1.7.1", F_OK) = -1 ENOENT (No such file or directory)
access("/home/dkc/.muttrc", F_OK) = 0
access("/home/dkc/.muttrc", F_OK) = 0
access("/home/dkc/.muttrc", F_OK) = 0
[... Tests for Muttrc ... ]
access("/home/dkc/.muttrc", F_OK) = 0
We now have:
access("/home/dkc/.muttrc-1.7+13 (f658e517960e)", F_OK) = -1 ENOENT (No such file or directory)
access("/home/dkc/.muttrc", F_OK) = 0
It also cleans up the case where -F is passed on the command line but
points to a non-existent file by moving the error path closer to the
actual fail condition.
Finally, it adds partial support for the XDG Base Directory
Specification. mutt will now try to locate its config at:
Components:
- Date of last release
- Number of commits since release
- Git commit hash of last commit
- 'dirty' if there are uncommitted changes
- Upstream Mutt version
It's appended wherever a version string is displayed, e.g. "User-Agent:"
The version suffix (-4-bee236-dirty) is checked EVERY time you run make.
However, unlike the original version, changes will only require the
rebuilding of git-ver.c
To keep things simple for the downstream distros, there are some
limitations in place:
The NeoMutt date (20161126) and the upstream Mutt version (1.7.1) are
hard-coded into configure.ac and hence the Makefile.
The suffix will be empty if:
- git isn't present
- The source isn't in a git repo
- There aren't any "neomutt-*" tags