When building with BSD make, running `make` after updating a source file
will not cause the binary to be rebuilt. After inspection, it appears
that the GOSRC variable only contains "go.mod go.sum". The aerc target
does not depend on .go source files.
The $(shell) construct is GNU make specific. BSD make has a special
assignment operator (!=) which evaluates a shell command. Since GNU make
4.0, the BSD != operator is supported for compatibility.
Use a syntax that is available in both make flavours.
Link: https://git.savannah.gnu.org/cgit/make.git/commit/?id=b34438bee83ee
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Koni Marti <koni.marti@gmail.com>
Running make with different values for GOFLAGS or VERSION does not cause
aerc to be rebuilt whereas it should.
Write the go build command line into a file and force aerc to be rebuilt
if the command line has changed.
Use the BSD make compatible != operator to run the command. This
operator is also available in GNU make since version 4.0.
Link: https://git.savannah.gnu.org/cgit/make.git/commit/?id=b34438bee83ee
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Koni Marti <koni.marti@gmail.com>
When messages are marked, pipe their contents into the specified
command. The messages are ordered according to their respective
Message-Id headers. This allows applying complete patch series with
a single command.
When piping more than one message, make sure to write them in the mbox
format as git am expects them to be.
Link: https://en.wikipedia.org/wiki/Mbox
Link: https://github.com/git/git/blob/v2.35.1/builtin/mailsplit.c#L15-L44
Signed-off-by: Robin Jarry <robin@jarry.cc>
Reviewed-by: Koni Marti <koni.marti@gmail.com>
Tested-by: akspecs <akspecs@gmail.com>
aerc.SelectedAccount() is used in lots of places. Most of them without
checking the return value.
In some cases, the currently selected tab is not related to any account
(widget.Terminal for example). This can lead to unexpected crashes when
accessing account specific configuration.
When possible, return an error when no account is currently selected.
If no error can be returned, fallback to non-account specific
configuration.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Reviewed-by: Koni Marti <koni.marti@gmail.com>
implement message threading on the message store level using the
jwz algorithm. Build threads on-the-fly when new message headers arrive.
Use the references header to create the threads and the in-reply-to
header as a fall-back option in case no references header is present.
Does not run when the worker provides its own threading (e.g. imap
server threads).
Include only those message headers that have been fetched and are
stored in the message store.
References: https://www.jwz.org/doc/threading.html
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Tested-by: Inwit <inwit@sindominio.net>
Tested-by: akspecs <akspecs@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
add the expand-folder and collapse-folder commands to navigate the
directory tree view. Provide keybinds for a vi-like folder navigation
experience.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
implement a foldable tree for the directory list. Expand all parent
directories when a hidden directory is selected with the change-folder
command.
folders-sort considers the top-level directories only. The folders and
foldersexclude filters work with the full directory path.
Enable tree view by adding 'dirlist-tree=true' to the config file.
Implements: https://todo.sr.ht/~sircmpwn/aerc2/228
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Add an extra attribute to the status line. When non-empty, display it
after the current status.
Set that extra status after a successful :search or :filter. Remove it
after :clear.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Python is not available on all systems. Port the colorize filter to awk
as it is a more widespread POSIX utility.
Users are free to copy the filter into their home dir and tweak the
colors to their needs. The highlighted items are:
=============== ======= ======= ========= =================
Item Red Green Blue Color
=============== ======= ======= ========= =================
quoted text 1 95 175 255 Blue
quoted text 2 255 135 0 Orange
quoted text 3 175 135 255 Purple
quoted text 4 255 95 215 Pink
quoted text * 128 128 128 Grey
diff meta 255 255 255 White bold
diff chunk 205 0 205 Cyan
diff added 0 205 0 Red
diff removed 205 0 0 Green
signature 175 135 255 Purple
header 175 135 255 Purple
url 255 255 175 Yellow
=============== ======= ======= ========= =================
This assumes a terminal emulator with true color support and with
a dark/black background.
Link: https://github.com/termstandard/colors
Signed-off-by: Robin Jarry <robin@jarry.cc>
This script is referenced by some users configuration. Restore it to
avoid breaking existing setups.
Fixes: bca93cd915 ("filters: add a more complete plaintext filter")
Signed-off-by: Robin Jarry <robin@jarry.cc>
This filter script is not compatible with the previous one. Rename it to
avoid issues with existing configs.
Fixes: bca93cd915 ("filters: add a more complete plaintext filter")
Signed-off-by: Robin Jarry <robin@jarry.cc>
Start the reconnect cycle when the initial connect fails. Make the
connection observer send a connection error when the imap client is nil.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Parse the terminal capabilities from the TERM environment variable
instead of using a hard coded list of terminals.
tcell does not expose the status line capabilities. Use another library
for this: github.com/xo/terminfo
Signed-off-by: Robin Jarry <robin@jarry.cc>
; is a special character for the INI format. It starts a comment and
apparently cannot be escaped nor quoted. This causes the default
text/plain filter to be truncated and causes this obscure error when
viewing a message:
sh: 1: Syntax error: Unterminated quoted string
Debugging shows that the filter command is:
sh -c "sed 's/^>\\+.*/\\x1b[2"
Remove the explicit dim style. It should be the default anyway.
Fixes: 7c3ce816c8 ("config: set a default filter for text/plain")
Signed-off-by: Robin Jarry <robin@jarry.cc>
The status is not cleared. It is annoying.
Fixes: c37f1eaaea ("filter/search: display current search/filter arguments")
Signed-off-by: Robin Jarry <robin@jarry.cc>
Avoid the following issue when running aerc with the default
configuration:
No filter configured for this mimetype ('text/plain')
Use a very basic sed command to replace the default plaintext filter.
Fixes: bb0f180140 ("config: do not hardcode sharedir")
Signed-off-by: Robin Jarry <robin@jarry.cc>
Add an XDG desktop file to handle mailto: links, to make it easier to
reply to mailing list threads and compose emails with aerc in general.
Signed-off-by: Moritz Poldrack <git@moritz.sh>
Signed-off-by: Robin Jarry <robin@jarry.cc>
Make the statusbar message after search and filter completion more
informative by showing the full call that was used.
Signed-off-by: inwit <inwit@sindominio.net>
Fix the parsing of internationalized headers (RFC 6532). Enable
unsubscribe to work with regular and encoded headers.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
waits an increasing amount of time before attempting a reconnect.
Wait is capped at 16s. Prevents many reconnect attemps in a short time period.
Fixes commit 05ad96a30c ("imap: improve reconnect stability") that
improved the reliability of the reconnect mechanism but did not
implement controls to prevent the triggering of too many reconnects
within a short period of time.
Fixes: 05ad96a30c ("imap: improve reconnect stability")
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Instead of using a static SHAREDIR at compile time, use a list of
standard paths to use at runtime for templates, config files and
stylesets.
This implies removing all default filters in the default configuration.
Replace them with basic commands. New users can configure the filters as
they wish.
Signed-off-by: Robin Jarry <robin@jarry.cc>
improves the robustness of the imap reconnect feature which was
introduced in commit beae17a6da ("imap: auto-reconnects on connection
error").
If a connection error is emitted, the message list is cleared and a
corresponding error message is shown in the ui. Status bar is updated as
well. Upon reconnect, the directories and the message list will be
re-fetched (same behavior as the connect command).
Reconnect can be enabled and disabled with the connect and the
disconnect commands.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
re-opens the review UI when the postpone operation fails. Before, the
composer would close, even on error, and we would lose the email draft.
Now, the user can decide on how to proceed when postponing fails.
References: https://lists.sr.ht/~rjarry/aerc-devel/patches/28824
Signed-off-by: Koni Marti <koni.marti@gmail.com>
This channel has not received much activity and all development
discussions are happening on #aerc. No need to multiply channels.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Some messages contain invalid headers, textproto.ReadHeader fails with
an error:
malformed MIME header key: From nobody Fri Jan 14 19
And all other messages of the selected folder are ignored.
Return an explicit error message to the UI and continue processing other
messages. This is consistent with what the maildir worker does.
Signed-off-by: Robin Jarry <robin@jarry.cc>
It is not obvious by reading the license text that aerc is distributed
under the MIT license. Explicitly state it.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Parse the actual user bindings to determine what shortcuts are available
in the compose::review stage. Add a predefined list of commands for
which we want to display the keyboard shortcuts.
Fixes: https://todo.sr.ht/~rjarry/aerc/14
Signed-off-by: Robin Jarry <robin@jarry.cc>
Do not use this to run the debugger. Instead, build a non-optimized
binary and display what command should be executed to attach to
a running program.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Introduce an option in aerc.conf to disable the auto-including
of your own address when replying to your own emails (address
replies to the original To: and Cc: instead); default to true
(allow the auto-including)
Since commit 01c96e78df ("Update DirectoryInfo handling for maildir"),
flags are checked for every message of a folder when entering it.
Iterating over all messages of a folder takes a long time for large
collections of emails.
Only count the number of messages and state that the directory info
counts are not accurate. Defer the parsing of message flags in
a goroutine to have a more responsive UI.
Fixes: https://todo.sr.ht/~rjarry/aerc/16
Suggested-by: Koni Marti <koni.marti@gmail.com>
Signed-off-by: Robin Jarry <robin@jarry.cc>
1 second is a bit excessive. Use 200ms which should cover most quick
folder changes.
Add an option to make that delay configurable by the users.
References: https://todo.sr.ht/~rjarry/aerc/16
Fixes: cb3090956c ("dirlist: skip unnecessary change-folder action")
Suggested-by: Koni Marti <koni.marti@gmail.com>
Signed-off-by: Robin Jarry <robin@jarry.cc>
implements a recover command that searches the local temp dir for aerc
emails. If a file is found and selected, a new composer tab will open
with the file contents as the message body. No header data is stored in
the temp file and thus this information cannot be recovered.
Recover will not remove the temporary file unless the force flag (-f) is
explicitly used.
This recovery method only works when the editor buffer is saved to
disk and the Close() function of the composer has not been called yet.
Sending, postponing or quitting will call the Close() function which
removes the temporary file completely. After Close() is called, no
recovery is possible anymore.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Unless a template is specified with reply -T, use the new-message
template for non-quoted replies.
Fixes: 877a94f5d9 ("compose: add default template for new messages")
Signed-off-by: Robin Jarry <robin@jarry.cc>
When provided with a mailto argument, aerc tries to connect to an
existing instance via a unix socket. If that fails, it starts up a new
instance and tries again. However, if that fails again (e.g. if the
unix server could not be started) then the new instance will remain open
without any indication that an error occured. Instead, shutdown the new
instance so the user can see the error message.
After commit 175d0ef ("binds: add account specific bindings"), when
bindings are defined for an account not defined in accounts.conf, aerc
quits with an error. After this commit, a warning is logged and aerc
ignores those bindings.
Signed-off-by: inwit <inwit@sindominio.net>
when traversing the directory list, aerc will fetch the contents for
every directory even though the user might just move on to the next.
This causes an unnecessary delay (and load on the worker) and can be
avoided by skipping the old change-folder action when a newer one
arrives within a predefined time interval.
Signed-off-by: Koni Marti <koni.marti@gmail.com>
improves change-folder responsiveness. When changing folders, the
highlighted directory is currently updated in a callback function to the
open-directory action. This creates an unpleasent lag in the ui until
the entire operation is done. Instead, we should provide an immediate
visual feedback of the selection to the user and keep loading the
directory contents in the background.
Signed-off-by: Koni Marti <koni.marti@gmail.com>