Fix the following build error on mac os:
worker/imap/worker.go:368:29: undefined: syscall.TCP_KEEPCNT
worker/imap/worker.go:376:29: undefined: syscall.TCP_KEEPINTVL
These symbols are not defined on darwin.
Fixes: 5dfeff75f3 ("imap: add tcp connection options")
Signed-off-by: Robin Jarry <robin@jarry.cc>
When using aerc for multiple accounts often bindings might differ
slightly between accounts. For example:
* Account A archives to one directory (:archive)
* Account B archives to monthly directories (:archive month)
Add account specific bindings to allow the user to add a "context" to a
binding group using a context specifier and a regular expression.
Currently the only context specifier is 'account'.
The regular expression is validated against the accounts loaded from
accounts.conf and the configuration fails to load if there are no
matches.
Contextual bindings are merged with global bindings, with contextual
bindings taking precedence, when that context is active.
Bindings are be configured using a generic pattern of
'view:context=regexp'. E.g.:
# Globally Applicable Archiving
[messages]
A = :read<Enter>:archive<Enter>
# Monthly Archiving for 'Mailbox' Account
[messages:account=Mailbox$]
A = :read<Enter>:archive month<Enter>
In the above example all accounts matching the regular expression will
archive in the monthly format - all others will use the global binding.
Signed-off-by: Jonathan Bartlett <jonathan@jonnobrow.co.uk>
This has been requested numerous times. People are not all used to the
git email workflow. Also, I am quite anal about commit messages.
Signed-off-by: Robin Jarry <robin@jarry.cc>
In preparation for tcp keepalive options, we need access to the
net.TCPConn object associated with an IMAP connection. The only way to
do this is to create the connection ourselves.
No functional change.
Signed-off-by: Robin Jarry <robin@jarry.cc>
This will prepare for extra tcp connection options support and for
automatic reconnect. No functional change.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Messages flags can also be changed without changing directories.
Changing flags in maildirs means renaming the message files. Also take
renames into account.
Link: https://cr.yp.to/proto/maildir.html
Fixes: f4d3c8fc77 ("maildir: watch for external changes")
Signed-off-by: Robin Jarry <robin@jarry.cc>
When a maildir is synchronized by an external process while aerc is
running (e.g. mbsync), some emails may be moved out of "new" to "cur" or
completely deleted.
These deletions are ignored and aerc may assume these messages are still
here, leading to errors.
Take file deletions into account. Also, add "cur" to the watched
folders since these can be modified as well.
Signed-off-by: Robin Jarry <robin@jarry.cc>
New border-char-horizontal and border-char-vertical config settings in
aerc.conf allow users to modify border appearance from the default
1-wide/tall blank space. In stylesets, border.fg now affects the
foreground color when custom characters are defined.
Signed-off-by: Robin Jarry <robin@jarry.cc>
These settings now have a default value.
Fixes: fe7ed940d3 ("config: use dynamic time format for default config")
Signed-off-by: Robin Jarry <robin@jarry.cc>
When using the notmuch backend, it often makes more sense to sort
folders (actual virtual folders, or queries) by the order specified in
the query-map file, rather than alphabetically. This patch introduces a
configuration option (disabled by default) that allows this.
Additionally, due to the notmuch backend previously using maps (which
are order-undefined) to store the list of queries, default query
selection on aerc startup fluctuated. This patch fixes that by using
slices to store query order.
Display threads in the message list. For now, only supported by the
notmuch backend and on IMAP when the server supports the THREAD
extension.
Setting threading-enable=true is global and will cause the message list
to be empty with maildir:// accounts.
Co-authored-by: Kevin Kuehler <keur@xcf.berkeley.edu>
Co-authored-by: Reto Brunner <reto@labrat.space>
Signed-off-by: Robin Jarry <robin@jarry.cc>
In the maildir worker we manually need to track the Recent flag in order for the
notification command etc to work.
Push that responsibility to the container, we must make sure to manually add the
flag though if one grabs the message info.
With IMAP, due to an unidentified reason, some messages to not have any
body accessible. When viewing them, aerc crashes:
git.sr.ht/~sircmpwn/aerc/lib.usePGP
lib/messageview.go:37
git.sr.ht/~sircmpwn/aerc/lib.NewMessageStoreView
lib/messageview.go:67
git.sr.ht/~sircmpwn/aerc/commands/account.ViewMessage.Execute
commands/account/view.go:45
git.sr.ht/~sircmpwn/aerc/commands.(*Commands).ExecuteCommand
commands/commands.go:66
main.execCommand
aerc.go:61
main.main.func2
aerc.go:160
aerc crashed: runtime error: invalid memory address or nil pointer
dereference
Check the pointer before dereferencing.
Also, add a global check in ParseMessageFormat where a similar issue may
occur.
Signed-off-by: Robin Jarry <robin@jarry.cc>
When composing a message, there is an empty fill line between the
headers and the text editor. The line is printed with the default style
which may cause users to assume it is part of the editor.
Display the fill lines with the border color to avoid confusion.
Signed-off-by: Robin Jarry <robin@jarry.cc>
When a message has been sent today (or this year) allow formatting the
date differently.
For example, with:
[ui]
index-format=%-25.25n %-25.25D %s
timestamp-format=2006 Jan 02, 15:04 GMT-0700
this-day-time-format=Today at 15:04
this-year-time-format=Jan 02
The message list would look like this (spaces collapsed):
Robin Jarry Today at 16:30 [PATCH 1/2] bindings: prepare for more modifers
bugzilla@dpdk.org Oct 26 [dpdk-dev] [Bug 839] pdump: any subsequent runs of pdump_autotest fail
Holger Levsen 2020 Mar 15, 13:44 GMT+01 +1 (Re: FTP Team -- call for volunteers)
Signed-off-by: Robin Jarry <robin@jarry.cc>
In addition of the common headers (subject, to, from, cc), allow
matching arbitrary email headers in filters. E.g.:
x-bugzilla-severity,critical=tput setaf 1; cat;tput sgr0
Signed-off-by: Robin Jarry <robin@jarry.cc>
It makes absolutely no sense to copy over the default template from aerc.conf
when the syntax is invalid and our ini parser fails.
The only valid case to do that is if the file is actually missing.
This fixes a substantial performance issue when scrolling emails with
long/complicated contents, where scrolling down a single line can take
something like hundreds of ms before the screen is updated to reflect
the scroll. It's really bad if the email has lots of columns, e.g. like
if it's an html email that was passed through a filter (w3m, etc) to
render it.
Using pprof, I found that the multiple calls to vterm.ScreenCell.Attrs()
in styleFromCell were really really expensive. This patch replaces them
with a single call.
Here's a before and after with a simple, but very manual test of opening
a large email with contents that went through a w3m filter and
continuously scrolling up and down over and over for ~30 seconds:
*** Before:
----------------------------------------------------------+-------------
flat flat% sum% cum cum% calls calls% + context
----------------------------------------------------------+-------------
28.25s 100% | git.x2esr.x2eht..z2f..z7esircmpwn..z2faerc..z2fwidgets.PartSwitcher.Draw
0 0% 99.94% 28.25s 82.31% | git.x2esr.x2eht..z2f..z7esircmpwn..z2faerc..z2fwidgets.PartViewer.Draw
28.25s 100% | git.x2esr.x2eht..z2f..z7esircmpwn..z2faerc..z2fwidgets.Terminal.Draw
----------------------------------------------------------+-------------
28.25s 100% | git.x2esr.x2eht..z2f..z7esircmpwn..z2faerc..z2fwidgets.PartViewer.Draw
0 0% 99.94% 28.25s 82.31% | git.x2esr.x2eht..z2f..z7esircmpwn..z2faerc..z2fwidgets.Terminal.Draw
19.23s 68.07% | git.x2esr.x2eht..z2f..z7esircmpwn..z2faerc..z2fwidgets.Terminal.styleFromCell
6.04s 21.38% | github.x2ecom..z2fddevault..z2fgo..z2dlibvterm.Screen.GetCellAt
1.38s 4.88% | git.x2esr.x2eht..z2f..z7esircmpwn..z2faerc..z2flib..z2fui.Context.Printf
0.62s 2.19% | runtime.mapassign
0.43s 1.52% | runtime.mapaccess2
0.20s 0.71% | runtime.newobject
0.19s 0.67% | runtime.callers (inline)
0.07s 0.25% | runtime.makeslice
0.07s 0.25% | runtime.mallocgc
----------------------------------------------------------+-------------
19.23s 100% | git.x2esr.x2eht..z2f..z7esircmpwn..z2faerc..z2fwidgets.Terminal.Draw
0 0% 99.94% 19.23s 56.03% | git.x2esr.x2eht..z2f..z7esircmpwn..z2faerc..z2fwidgets.Terminal.styleFromCell
19.21s 99.90% | github.x2ecom..z2fddevault..z2fgo..z2dlibvterm.ScreenCell.Attrs
*** After:
----------------------------------------------------------+-------------
flat flat% sum% cum cum% calls calls% + context
----------------------------------------------------------+-------------
0.31s 100% | git.x2esr.x2eht/~sircmpwn/aerc/widgets.Terminal.Draw
0 0% 99.87% 0.31s 1.33% | github.x2ecom/ddevault/go-libvterm.NewPos
0.25s 80.65% | runtime.callers (inline)
0.04s 12.90% | runtime.gomcache (inline)
----------------------------------------------------------+-------------
8.40s 100% | github.x2ecom/ddevault/go-libvterm.Screen.GetCellAt
0 0% 99.87% 8.40s 36.11% | github.x2ecom/ddevault/go-libvterm.Screen.GetCell
7.14s 85.00% | github.x2ecom/ddevault/go-libvterm._cgoCheckPointer
0.54s 6.43% | runtime.callers (inline)
0.35s 4.17% | runtime.exitsyscall
0.11s 1.31% | runtime.deferprocStack
0.07s 0.83% | doentersyscall
0.07s 0.83% | runtime.getg
0.05s 0.6% | runtime.casgstatus
0.03s 0.36% | _init
0.03s 0.36% | runtime.gomcache (inline)
----------------------------------------------------------+-------------
8.46s 100% | git.x2esr.x2eht/~sircmpwn/aerc/widgets.Terminal.Draw
0 0% 99.87% 8.46s 36.37% | github.x2ecom/ddevault/go-libvterm.Screen.GetCellAt
8.40s 99.29% | github.x2ecom/ddevault/go-libvterm.Screen.GetCell
0.06s 0.71% | runtime.callers (inline)
----------------------------------------------------------+-------------
0.31s 100% | git.x2esr.x2eht/~sircmpwn/aerc/widgets.Terminal.styleFromCell
0 0% 99.87% 0.31s 1.33% | github.x2ecom/ddevault/go-libvterm.ScreenCell.Attrs
)
bf0f72a533 ("template: add exec and wrap") introduced wrap which
allowed to chain wrapText. It also changed the aerc-templates man page
to document wrap instead of wrapText. The templates weren't updated
then, so update now.