Re: Strange problem on new system with versus (or linefeed versus carriage return)

2024-05-09 Thread Chris Green
On Thu, May 09, 2024 at 05:59:39PM +0200, Dennis Preiser wrote:
> On Thu, May 09, 2024 at 04:24:56PM +0100, Chris Green wrote:
> > I have the following in muttrc so that hitting 'Enter' (the CR key) on
> > the keyboard sends an E-Mail after composing it:-
> >
> > bindcompose \n send-message # rather than 'y'
> >
> > This works as intended on the old system but not on the new system, it
> > would seem that mutt sees the 'Enter' key as CR (0x0d) on the new
> > system whereas on the old system it sees it as LF (0x0a).
> > Can anyone explain why this is and, more to the point, tell me how to
> 
> From the documentation:
> 
> | 6.2. Enter versus Return
> | 
> | Prior to version 2.2, Mutt used a default ncurses mode (“nl()”). This
> | mode maps keyboard input of either  or  to the same
> | value, which Mutt interpreted as  internally.
> | 
> | However, starting in version 2.2, this mode is turned off, allowing
> |  and  to be mapped separately, if desired. The default
> | keyboard mappings set both, but you can override this or create new
> | bindings with one or the other (or both).
> | 
> | Note that in terminal application, such as Mutt,  is the same as
> | “\n” and ^J; while  is the same as “\r” and ^M.
> 
Ah, that explains it perfectly, thank you!

> > fix it?
> 
> 
>      bindcompose \r send-message # rather than 'y'
> 
... and that fixes it, more thank you. :-)

-- 
Chris Green


Strange problem on new system with versus (or linefeed versus carriage return)

2024-05-09 Thread Chris Green
I am in the process of migrating from an old system running mutt 2.1.4
on xubuntu 22.04 to a new system running mutt 2.2.12 on xubuntu 24.04.

I have simply copied across all my muttrc configuration etc. without
change, it's all working pretty well except for (so far) one problem:-

I have the following in muttrc so that hitting 'Enter' (the CR key) on
the keyboard sends an E-Mail after composing it:-

bindcompose \n send-message # rather than 'y'

This works as intended on the old system but not on the new system, it
would seem that mutt sees the 'Enter' key as CR (0x0d) on the new
system whereas on the old system it sees it as LF (0x0a).

The Enter key works everywhere else on the system, why is mutt showing
this oddity?

On the new system the help line at the bottom shows:-

:Send  q:Abort  t:To  c:CC  s:Subj  a:Attach file  d:Descrip  ?:Help


Whereas on the old system it shows:-

:Send  q:Abort  t:To  c:CC  s:Subj  a:Attach file  d:Descrip  ?:Help

Can anyone explain why this is and, more to the point, tell me how to
fix it?

-- 
Chris Green


Re: How to abort sending a mail?

2023-06-26 Thread Chris Green
On Mon, Jun 26, 2023 at 08:43:29PM +0200, Matthias Apitz wrote:
> El día lunes, junio 26, 2023 a las 03:11:25p. m. +0100, Chris Green escribió:
> 
> > > I have sometimes the same issue using mutt on my Linux phone where the
> > > IP to my mobile carrier is not fully up. mutt sits there saying
> > > 
> > > Connecting to imap.1blu.de
> > > 
> > > and the only way is to kill the terminal app.
> > > 
> > Doesn't the sendmail_wait setting address this issue?  Or, if you're
> > using SMTP to send mail the  connect_timeout setting.
> 
> No. It is the initial IMAP connection to read the mail, not the sending
> connection w/ SMTP directly (i.e. w/o sendmail).
> 
Well connect_timeout is supposed to apply to IMAP connections as well
as SMTP.

-- 
Chris Green


Re: How to abort sending a mail?

2023-06-26 Thread Chris Green
On Mon, Jun 26, 2023 at 02:52:10PM +0200, Matthias Apitz wrote:
> El día lunes, junio 26, 2023 a las 12:55:08 +0200, Max Görner escribió:
> 
> > Hello all,
> > 
> > I have a Mutt window open which hangs at the "Connection to ... 
> > establishing"¹
> > step. This happens very rarely but is quite annoying. In general, I am able 
> > to
> > send mails reliably and without issues.
> > 
> > My only known option is to kill `mutt`, which I dislike. Is there a better 
> > way
> > to abort that process?
> > 
> > Best, Max
> > 
> > 1: Actually, it is "Verbindung zu subdomain.example.com wird aufgebaut …" 
> > but
> >the above translation should do the job.
> 
> I have sometimes the same issue using mutt on my Linux phone where the
> IP to my mobile carrier is not fully up. mutt sits there saying
> 
> Connecting to imap.1blu.de
> 
> and the only way is to kill the terminal app.
> 
Doesn't the sendmail_wait setting address this issue?  Or, if you're
using SMTP to send mail the  connect_timeout setting.

-- 
Chris Green


Re: Has the handling of my_hdr and send_hook changed between 1.10.x and 2.1.4?

2023-04-10 Thread Chris Green
On Mon, Apr 10, 2023 at 06:45:04PM +0100, Chris Green wrote:
> 
> I'll try to narrow this down further by trying a very short list of
> mailing list names.
> 
After a bit of chopping and changing the list of addresses in 'lists'
I finally spotted my problem.  Totally my fault, my program that
generates the list doesn't handle quoted addresses properly so there
was an unclosed quote in the list of addresses.  Not surprisingly that
stopped things working.

The source file for the lists on the old system running mutt 1.10.1
hadn't got the quoted address in it (yet) so the error didn't appear
there.

Sorry for the noise and thank you for being patient with me.  You
steadily nudged me in the right direction! :-)

-- 
Chris Green


Re: Has the handling of my_hdr and send_hook changed between 1.10.x and 2.1.4?

2023-04-10 Thread Chris Green
OK, I now know what was working (in 1.10.1) and now isn't working the
way it did.


If I put the following in my muttrc:-

lists mutt-users@mutt.org
subscribe mutt-users@mutt.org

Then my send-hooks setting a different From: for mutt-users@mutt.org
work as expected in both 1.10.1 and 2.1.4.


However, I'm on a lot of lists so my 'lists' and 'subscribe' commands
use program generated output to populate them:-

lists `~/.mutt/bin/getLists.py`  
subscribe `~/.mutt/bin/getLists.py` 

This used to work in 1.10.1 but doesn't work in 2.1.4.  The output of
~/.mutt/bin/getLists.py is a single long string containing all my
mailing list addresses separated by spaces.

So it would seem that 2.1.4 no longer likes the space separated
format, does it need a list with newline separators now?

I'll try to narrow this down further by trying a very short list of
mailing list names.

-- 
Chris Green


Re: Has the handling of my_hdr and send_hook changed between 1.10.x and 2.1.4?

2023-04-10 Thread Chris Green
On Sun, Apr 09, 2023 at 02:28:00PM -0700, Kevin J. McCarthy wrote:
> On Sun, Apr 09, 2023 at 08:23:55PM +0100, c...@isbd.net wrote:
> >I'm trying to sort out why something that used to work for me no
> >longer works.  I just went and tried out an older installation that
> >still runs mutt 1.10.4 and there my send-hook/my_hdr configuration
> >works. It doesn't work on my current mutt 2.1.4.
> 
> Not knowingly, but a lot of the sending code has been modified in that 
> period of time.
> 
> >I see the documentation now says "Also note that my_hdr commands which
> >modify recipient headers, or the message's subject, don't have any
> >effect on the current message when executed from a send-hook.".  Is
> >this a recent change?
> 
> That applies to a my_hdr that adds a recipient header, such as To, Cc, 
> Bcc.  It didn't change; the documentation for the behavior was just 
> added.
> 
> >This appears to no longer work.
> 
> It's working in my simple testing, so perhaps there is something more 
> involved.  Can you create a small reproducing muttrc file and a list of 
> exact instructions to trigger the change in behavior?
> 
OK, it's not taken as long as I feared.

If I send a message to the mutt mailing list from the old (version
1.10.1) mutt the headers I see are:-

From: Chris Green 
  To: mutt-users@mutt.org
  Cc: 
 Bcc: 
 Subject: test
Reply-To: 
 Fcc: ~/mail/Tm/sentmail
 Mix: 
    Security: None

If I send a message to mutt from version 2.1.4 of mutt I see:-


From: Chris Green 
  To: mutt-users@mutt.org
  Cc: 
 Bcc: 
 Subject: test
Reply-To: 
 Fcc: ~/mail/Tm/sentmail
 Mix: 
Security: None


Both the above are using the following muttrc (somewhat truncated but still
rather long I'm afraid but I have made the my_hdr and send-hook
settings very simple)  :-


#
#
# mutt configuration
#
#
#
# Mailboxes (where new mail can arrive), the important stuff hopefully
# arrives in ~/mail/inbox, then we check lists mail, then check other
# mailboxes in ~/mail/In.  I don't think anything will ever arrive in
# /var/mail/chris, it's there just in case.
#
mailboxes  /var/mail/chris ~/mail/In/inbox `echo ~/mail/Li/*` `echo 
~/mail/In/*`
#
#
# Mailing lists, see ~/.mutt/filter and ~/mutt/bin/filter.py for details.
#
lists mutt-users@mutt.org
subscribe mutt-users@mutt.org
#
#
# getAliases.py gets aliases for mailing lists from the filter file
#
source ~/.mutt/bin/getAliases.py|
source ~/.mutt/aliases
#
#
# Set my_addr (user variable) for esprimo or cheddar
#
set my_addr = 'ch...@isbd.co.uk'
#
#
# alternates - addresses that are 'me'
#
alternates $my_addr c...@isbd.net
    #
    #
# set default my_hdr according to which host we're on
#
send-hook . 'my_hdr From: Chris Green <$my_addr>'
#
#
# set From: address for mailing lists, not sure if it actually works on 
cheddar
#
send-hook ~l 'my_hdr From: Chris Green '
#
#
# I can't remember why this is necessary/useful
#
source ~/.mutt/gpg
#
#
# tell mutt not to use the .mailcap entry for application/octet-stream
#
mime_lookup application/octet-stream
#
#
# Key bindings and macros
#
bindcompose \n send-message # rather than 'y'
bindindex   n next-unread-mailbox   # replaces 
bindindex   N search-next   # so we can still search-next

#
#
# sidebar configuration
#
macro index in 
macro index io 
macro index ip 
macro index it 

set sidebar_new_mail_only = yes
set sidebar_short_path = yes
set sidebar_width = 15
#
#
# Colours
#
color header blue default .
color body magenta default [_a-z\.\$A-Z0-9-]+@[a-zA-Z0-9\./\-]+
color body magenta default (http|ftp)://[_a-zA-Z0-9\./~\-]+
color quoted blue default
color signature red default
color attachment magenta default
color tree red default
color indicator white cyan
color status brightwhite cyan
color tilde blue default
color normal default default
color message green default
#
#
# Header lines to ignore
#
ignore *
unignore to from date subject cc x-mailer X-source-folder
#
#
# Replies to messages for c...@isbd.net need to be from c...@isbd.net
#
reply-hook '~t c...@isbd.net' 'my_hdr From: Chris Green '
#
#
# Set sort to 'threads' except for sentmail
#
folder-hook . 'set sort=threads;set hostname=""'
folder-hook sentmail set sort=date-sent
#
#
# Mutt variable settings
#
set alias_file=~/.mutt/aliases
set arrow_cursor
set assumed_charset

Re: Copying IMAP folders with mutt

2022-10-16 Thread Chris Green
On Sun, Oct 16, 2022 at 03:25:32AM +0200, Angel M Alganza wrote:
> On Sat, Oct 15, 2022 at 10:27:29PM +0100, Chris Green wrote:
> 
> >> How do I get it into interactive mode?  I.e. run imapfilter with the
> >> /home/chris/.imapfilter/config.lua configuration and then allow me to
> >> run some commands to actually do things.
> 
> > All the examples I can find seem to actually put "things to run" in
> > the /home/chris/.imapfilter/config.lua file which seems rather odd.
> 
> > I've tried running 'imapfilter -i' and it gets me an imapfilter
> > command prompt but it seems to have forgotten everything in the
> > configuration file.
> 
> Working interactively isn't very confortable or easy, in my opinion,
> since the interactive prompt doesn't autocompletion or anything.  I
> place all the commands into the configuration file and run them from
> there.  I also have aditional configuration files for things I do at
> different times and I run them from cron at different intervals (hourly,
> daily, weekly) depending on what they actually do.
> 
I think that's what I was finding (it doesn't really want to be run
interactively), thanks.

Sorry about all the rather OT noise everyone.

-- 
Chris Green


Re: [SPAM] Copying IMAP folders with mutt

2022-10-15 Thread Chris Green
On Sat, Oct 15, 2022 at 09:04:37PM +0100, Chris Green wrote:
> On Sat, Oct 15, 2022 at 08:46:17PM +0100, Chris Green wrote:
> > Hmmm.
> > 
> > I've installed imapfilter on my xubuntu linux system and I've created
> > an imapfilter config file:-
> > 
> > cwebin  {
> > server = 'mail.gridhost.co.uk',
> > username = 'c...@isbd.co.uk',
> > password = '',
> > ssl = 'auto'
> > }
> > 
> > cwebout  {
> > server = 'x.y.zzz',
> > username = 'c...@isbd.co.uk',
> > password = '',
> > ssl = 'auto'
> > }
> > 
> > ... and when I run imapfilter it just says:-
> > 
> > chris$ imapfilter
> > imapfilter: /home/chris/.imapfilter/config.lua:1: attempt to call global 
> > 'cwebin' (a nil value) 
> > stack traceback:
> > [C]: in function 'cwebin'
> > /home/chris/.imapfilter/config.lua:1: in main chunk
> > chris$ 
> > 
> > Not being a lua guru I'm a bit stuck!
> > 
> OK, looking at some examples I've got a bit further, imapfilter is now:-
> 
> local cwebin = IMAP {
> server = 'mail.gridhost.co.uk',
> username = 'c...@isbd.co.uk',
> password = 'brzmibew',
> ssl = 'auto'
> }
> 
> local cwebout = IMAP {
> server = 'x.y.zzz',
> username = 'c...@isbd.co.uk',
> password = 'brzmibew',
> ssl = 'auto'
> }
> 
> It works, sort of.
> 
> How do I get it into interactive mode?  I.e. run imapfilter with the
> /home/chris/.imapfilter/config.lua configuration and then allow me to
> run some commands to actually do things.
> 
All the examples I can find seem to actually put "things to run" in
the /home/chris/.imapfilter/config.lua file which seems rather odd.

I've tried running 'imapfilter -i' and it gets me an imapfilter
command prompt but it seems to have forgotten everything in the
configuration file.



-- 
Chris Green


Re: [SPAM] Copying IMAP folders with mutt

2022-10-15 Thread Chris Green
On Sat, Oct 15, 2022 at 08:46:17PM +0100, Chris Green wrote:
> Hmmm.
> 
> I've installed imapfilter on my xubuntu linux system and I've created
> an imapfilter config file:-
> 
> cwebin  {
> server = 'mail.gridhost.co.uk',
> username = 'c...@isbd.co.uk',
> password = '',
> ssl = 'auto'
> }
> 
> cwebout  {
> server = 'x.y.zzz',
> username = 'c...@isbd.co.uk',
> password = '',
> ssl = 'auto'
> }
> 
> ... and when I run imapfilter it just says:-
> 
> chris$ imapfilter
> imapfilter: /home/chris/.imapfilter/config.lua:1: attempt to call global 
> 'cwebin' (a nil value) 
> stack traceback:
> [C]: in function 'cwebin'
> /home/chris/.imapfilter/config.lua:1: in main chunk
> chris$ 
> 
> Not being a lua guru I'm a bit stuck!
> 
OK, looking at some examples I've got a bit further, imapfilter is now:-

local cwebin = IMAP {
server = 'mail.gridhost.co.uk',
username = 'c...@isbd.co.uk',
password = 'brzmibew',
ssl = 'auto'
}

local cwebout = IMAP {
server = 'x.y.zzz',
username = 'c...@isbd.co.uk',
password = 'brzmibew',
ssl = 'auto'
}

It works, sort of.

How do I get it into interactive mode?  I.e. run imapfilter with the
/home/chris/.imapfilter/config.lua configuration and then allow me to
run some commands to actually do things.

-- 
Chris Green


Re: [SPAM] Copying IMAP folders with mutt

2022-10-15 Thread Chris Green
On Sat, Oct 15, 2022 at 08:10:03PM +0200, Angel M Alganza wrote:
> Hi Chris,
> 
> On Sat, Oct 15, 2022 at 06:29:37PM +0100, Chris Green wrote:
> 
> > I'm now considering using mutt to move some IMAP folders from one
> > server to another, both IMAP servers will be remote.  Is this a
> > sensible idea or should I look for a specialised tool?
> 
> I have ocasionally used Mutt with more than one IMAP server at the same
> time, so I'm quite confident that could be done with just Mutt.
> 
> I would use Imapfilter, though, which I believe would be a more
> appropriate tool for that.  It would take very minimal configuration,
> just the servers configuration (account1 and account2) and a couple of
> lines for the origin and destination folders, something like:
> 
> messages = account1["INBOX"]:select_all()
> messages:copy_messages(account2["INBOX"])
> 
> to copy everything to the new server, or to move it, replacing the
> second line with something like this one:
> 
> messages:move_messages(account2["INBOX"])
> 
Hmmm.

I've installed imapfilter on my xubuntu linux system and I've created
an imapfilter config file:-

cwebin  {
server = 'mail.gridhost.co.uk',
username = 'c...@isbd.co.uk',
password = '',
ssl = 'auto'
}

cwebout  {
server = 'x.y.zzz',
username = 'c...@isbd.co.uk',
password = '',
ssl = 'auto'
}

... and when I run imapfilter it just says:-

chris$ imapfilter
imapfilter: /home/chris/.imapfilter/config.lua:1: attempt to call global 
'cwebin' (a nil value)
stack traceback:
[C]: in function 'cwebin'
    /home/chris/.imapfilter/config.lua:1: in main chunk
chris$ 

Not being a lua guru I'm a bit stuck!


-- 
Chris Green


Copying IMAP folders with mutt

2022-10-15 Thread Chris Green
I am a long time user of mutt (many, many years). I use it with mail
delivered directly to a maildir hierarchy.

I have occasionally tried it with IMAP4 but it never seemed to be
ideal to me.  However I'm now considering using mutt to move some IMAP
folders from one server to another, both IMAP servers will be remote.
Is this a sensible idea or should I look for a specialised tool?  It's
only a one off requirement, once it's done I won't be using mutt with
IMAP again.  It just seems that as I'm fairly familiar with mutt it
might be the easiest way to do this.  It's only five or six accounts I
want to move, with only a few (mostly just the default ones) IMAP
folders.

So, to a couple of specific questions:-

Can mutt handle folders on more than one IMAP4 server?

Can I use a numeric IP for a server?

Is there a 'move folder' command which can have a different IMAP
server for 'from' and 'to'?

-- 
Chris Green


Re: Viewing HTML message with Firefox

2022-10-09 Thread Chris Green
On Sun, Oct 09, 2022 at 08:18:12AM +1100, Cameron Simpson wrote:
> On 08Oct2022 21:55, Jan Eden via Mutt-users  wrote:
> >Thank you! This works well with Epiphany, but Firefox still fails 
> >(which
> >I do not care about, as long as I have a working browser option).
> 
> My recollection is that this is a timing issue. To run the viewer mutt 
> goes:
> - make a temp file containing the message or html
> - run the mailcap command
> - remove the temp file
> 
Ah, yes, that's the fundamental issue isn't it.  The file has
disappeared before Firefox (or whatever) manages to grab it.

-- 
Chris Green


Re: Re: Viewing HTML message with Firefox

2022-10-08 Thread Chris Green
On Sat, Oct 08, 2022 at 12:06:52PM +0200, Jan Eden via Mutt-users wrote:
> On 2022-10-08 09:34, Chris Green wrote:
> > On Sat, Oct 08, 2022 at 10:25:29AM +0200, Jan Eden via Mutt-users wrote:
> > > Hi,
> > > 
> > > I recently configured mutt on a Linux system, and cannot display HTML
> > > messages in the default browser. mailcap contains the following lines:
> > > 
> > > text/html; open %s;
> > > text/html; w3m -I %{charset} -T text/html; copiousoutput
> > > application/pdf; open %s; copiousoutput
> > > 
> > > w3m is used automatically (auto_view text/html), and PDF documents are
> > > opened correctly in evince.
> > > 
> > > But when I try to open an HTML message manually, Firefox displays either
> > > a permission denied error (with AppArmor enabled), or a file not found
> > > error – both pointing to the message's filename.
> > > 
> > > How can I allow Firefox to access and display the message?
> > > 
> > I no longer use Firefox on my xubuntu system (I've moved to Vivaldi)
> > but I seem to remember that Firefox's security paranoia means that you
> > now have to explicitly configure to allow access to files on the local
> > system.
> 
> With AppArmor disabled, Firefox tries to display the message, but cannot
> find the message file in /var/tmp/ – %s seems to point to that
> directory.
> 
> In Firefox' settings, I did not find any parameter to keep the browser
> from accessing local files.
> 
> > By 'manually' I presume you mean v[iew] the message parts and then
> > m[view-mailcap] the html.
> 
> Yes.
> 
When I view an HTML message like this the address is like:-

file:///srv/mutt/mutt-esprimo-1000-151542-10027422769961820949.html

I use a script (called via mailcap) to store the HTML message in that
directory.

So, in mailcap I have:-

text/html; /home/chris/bin/muttview %s html

... and muttview is:-

!/bin/bash
#
#
# muttview:  script called by mutt via mailcap to view attachments
# and HTML e-mail (where lynx isn't good enough).
#
# The temporary file to be viewed is copied to directory
# /srv/mutt on esprimo if running locally or to the same place on the
# remote system if running via ssh.  The copy to the remote system is
# done using rsync to an rsync daemon on t470 via a reverse tunnel
# set up when the ssh connection is made.
#
dir=/srv/mutt
fn=$1
if [ "$2" == "html" ]
then
mv $fn $fn.html
fn=$fn.html
fi
#
#
# if there's no DISPLAY variable then the viewer can't run, so skip the 
whole thing
#
if [ -n "$DISPLAY" ]
then
if [ -n "$SSH_CLIENT" ]; then
#
#
# view on t470, files dropped into /srv/mutt there are 
automatically displayed
#
export RSYNC_PASSWORD=brzmi
rsync $fn rsync://chris@localhost:50873/tv/$(basename $fn)
else
#
#
# running locally, copy to /srv/mutt and then select viewer on file 
type
#
dest=$dir/$(basename $fn)
cp $fn $dest
 
shopt -s nocasematch
case $fn in
*.html)
$BROWSER file://$dest
;;
*.pdf)
atril $dest &
;;
*)
nomacs $dest >/dev/null 2>&1 &
;;
esac
fi
fi
#
#
    # Clear out any old files left on esprimo by this script, doing it here
# saves adding a special crontab task (but a crontab task is needed on t470)
#
find $dir -mtime +7 -exec rm {} \;

You don't need the bit for remote viewing from my laptop, just the "running 
locally"
bit.

-- 
Chris Green


Re: Viewing HTML message with Firefox

2022-10-08 Thread Chris Green
On Sat, Oct 08, 2022 at 10:25:29AM +0200, Jan Eden via Mutt-users wrote:
> Hi,
> 
> I recently configured mutt on a Linux system, and cannot display HTML
> messages in the default browser. mailcap contains the following lines:
> 
> text/html; open %s;
> text/html; w3m -I %{charset} -T text/html; copiousoutput
> application/pdf; open %s; copiousoutput
> 
> w3m is used automatically (auto_view text/html), and PDF documents are
> opened correctly in evince.
> 
> But when I try to open an HTML message manually, Firefox displays either
> a permission denied error (with AppArmor enabled), or a file not found
> error – both pointing to the message's filename.
> 
> How can I allow Firefox to access and display the message?
> 
I no longer use Firefox on my xubuntu system (I've moved to Vivaldi)
but I seem to remember that Firefox's security paranoia means that you
now have to explicitly configure to allow access to files on the local
system.

By 'manually' I presume you mean v[iew] the message parts and then
m[view-mailcap] the html.

-- 
Chris Green


Re: The way mutt handles long lines, seems odd/wrong to me

2022-10-02 Thread Chris Green
On Sun, Oct 02, 2022 at 09:43:47AM +1100, Cameron Simpson wrote:
> On 01Oct2022 09:33, Chris Green  wrote:
> >As I said though it seems odd that only mutt suffers from the problem
> >(on my xubuntu systems anyway).  Presumably both 'less' and my editor
> >'vile' use ncurses too and they just wrap long lines if you tell them
> >to do so.
> 
> I'm pretty sure that less does not use curses (of whatever 
> implementation).  Termcap/terminfo, sure.  But not curses, which 
> maintains a model of the whole screen.
> 
Maybe not but my editor vile certainly does and it wraps the way I
want/expect.

> I have a (vague) recollection that some terminals keep track of whether 
> a line was terminates with a newline or not, and that it affects how 
> copy/paste was done, in that a newline causes a break in the string. But 
> the memory is vague.
> 
> 1) is your long string using the full width of the terminal? i.e. is 
> there a character in the rightmost column?
> 
A long line wrapped in the mutt pager looks exactly the same as a long
line wrapped in less or vile.  I.e. there are no added spaces or other
characters.  In fact if a browser address bar works correctly you can
select the multiple lines and paste them into the browser address bar
as the NLs are ignored.  However it's still messier than if the NLs
weren't there as you have to manually select the whole URL rather than
just right clicking on it.


> 2) if the text does go to the rightmost column, but you have a break in 
> the copied text, what's in that break? eg if you paste into an editor, 
> what gets inserted there?
> 
As noted above, I'm pretty sure it's a NL (i.e. a linefeed), I'll check.

Yes, it's a linefeed.  I.e. if you select the two halves of a 'broken'
line displayed in mutt's pager and paste them somewhere else there's a
0x0a character in the middle.

> Just curious, not sure this information would lead to a fix/workaround.
> 
As I said I'm discussing this with the maintainer of ncurses, if
anything comes of this I'll report back here.

-- 
Chris Green


Re: The way mutt handles long lines, seems odd/wrong to me

2022-10-01 Thread Chris Green
On Sat, Oct 01, 2022 at 01:11:10PM +, Sam Kuper wrote:
> On Sat, Oct 01, 2022 at 09:33:16AM +0100, Chris Green wrote:
> > On Sat, Oct 01, 2022 at 01:24:37PM +0800, Kevin J. McCarthy wrote:
> >> In [the] past, I've tried a few things to see if it has an effect on
> >> the output of long lines, but haven't found anything that makes a
> >> difference.  In the end, I believe it's a side effect of how ncurses
> >> works.
> >
> > Yes, I realise this issue has been looked into before, and no solution
> > found. [...] I'll have a talk with Tom Dickey who is the maintainer of
> > both vile and ncurses, he may be able to throw some light on this.
> 
> Workaround: while viewing an affected email in Mutt, press the vertical
> bar key (`|`) and then type `less`.  This will pipe the email to Less -
> which, as you've noted, is unaffected by the issue.  You can then select
> URLs or other long whitespace-free text strings per your terminal's
> normal behaviour.
> 
> (You probably already knew this!  But I'm mentioning it in case not, or
> in case helpful for anyone else reading this thread.)
> 
I actually have a macro implemented to do this, single key ('l') pipes
the message into less.  It's a reasonable workaround but one does have
to hit 'q' twice to get back out of less.

-- 
Chris Green


Re: The way mutt handles long lines, seems odd/wrong to me

2022-10-01 Thread Chris Green
On Sat, Oct 01, 2022 at 01:24:37PM +0800, Kevin J. McCarthy wrote:
> On Fri, Sep 30, 2022 at 02:42:09PM +0100, Chris Green wrote:
> >I'm am also pretty sure that it's the mutt pager doing this as other 
> >programs (i.e. less) wrap long lines in a terminal window but don't 
> >chop them into pieces like mutt's pager.
> 
> Mutt uses ncurses to draw on the screen, which is a layer of 
> indirection.  Mutt is telling ncurses where to put things, but when Mutt 
> refreshes the screen, ncurses actually sends the needed commands and 
> contents to the terminal.
> 
> In that past, I've tried a few things to see if it has an effect on the 
> output of long lines, but haven't found anything that makes a 
> difference.  In the end, I believe it's a side effect of how ncurses 
> works.
> 
Yes, I realise this issue has been looked into before, and no solution
found.

As I said though it seems odd that only mutt suffers from the problem
(on my xubuntu systems anyway).  Presumably both 'less' and my editor
'vile' use ncurses too and they just wrap long lines if you tell them
to do so.

I'll have a talk with Tom Dickey who is the maintainer of both vile
and ncurses, he may be able to throw some light on this.

-- 
Chris Green


Re: The way mutt handles long lines, seems odd/wrong to me

2022-09-30 Thread Chris Green
On Fri, Sep 30, 2022 at 08:55:28PM +0200, Marcus C. Gottwald wrote:
> 
> Chris Green wrote (Fri 2022-Sep-30 14:42:09 +0100):
> 
> > So, when there is a long string of text in a message that is longer
> > than the width of the terminal and has no spaces in it mutt *always*
> > breaks the line at the RHS of the terminal window and displays the
> > rest of the line on separate continuation lines.
> ..
> > Have I missed a setting somwhere that affects this or is it just a
> > bug/feature?  Can I ask if it might be fixed because it's one of the
> > few things i find really annoying about mutt - not being able to
> > easily select and use long URLs.
> 
> Is the configuration variable called "markers" what you're looking
> for? Quoting from the manual:
> 
>markers
>Type: boolean
>Default: yes
> 
>Controls the display of wrapped lines in the internal pager.
>If set, a “+” marker is displayed at the beginning of wrapped
>lines.
> 
I don't think this is it, I get no "+" marker but the lines are still
broken at the screen width.  (I have "set nomarkers" in muttrc)

-- 
Chris Green


The way mutt handles long lines, seems odd/wrong to me

2022-09-30 Thread Chris Green
I have been playing with the various mutt settings which affect how
long lines are managed (in the pager in particular).

By 'long lines' I mean strings of text which have no spaces in them
and which are longer than the width of the terminal window.  The
handling of text made up of words with spaces between them seems
perfectly OK.

So, when there is a long string of text in a message that is longer
than the width of the terminal and has no spaces in it mutt *always*
breaks the line at the RHS of the terminal window and displays the
rest of the line on separate continuation lines.

This seems wrong to me, a very long string of text should be left
intact and simply wrapped onto multiple lines.  

I have tried all the sensible combinations of $wrap, $reflow_wrap and
$reflow_text that I can think of and, though they do exactly what
they're supposed to do with 'words' separated by spaces, they never
change the truncation of long strings of text at the right margin.

I'm am also pretty sure that it's the mutt pager doing this as other
programs (i.e. less) wrap long lines in a terminal window but don't
chop them into pieces like mutt's pager.

Have I missed a setting somwhere that affects this or is it just a
bug/feature?  Can I ask if it might be fixed because it's one of the
few things i find really annoying about mutt - not being able to
easily select and use long URLs.

-- 
Chris Green


Re: Mailcap selectively applying settings

2022-05-12 Thread Chris Green
On Thu, May 12, 2022 at 03:38:23PM -0400, Christopher Conforti wrote:
> Hi list, I'm having a bit of a weird one, at least for me. I can't get mutt to
> read my entire mailcap file properly, it seems. For example, I have the
> following line in my mailcap:
> 
> images/*; eog %s
> 
> It handles this just fine; all image attachments are opened with eog. However,
> another line:
> 
> text/html lynx -dump %s | more
> 
I think you need:-

text/html; lynx -dump %s; copiousoutput; nametemplate=%s.html


> is seemingly ignored, even when there are no other options given for handling
> HTML. No matter which browser I set, no matter what combination of options I
> use, I cannot seem to get mutt to use this entry in any way. By all clues in 
> the
> documentation, my personal mailcap file (~/.mailcap) should take priority, but
> it only seems to want to set for certain types.
> 
> What the heck is going on? Where can I learn how to fix it?

I think the 'copiousoutput' is explained somewhere on the Mutt web site.

-- 
Chris Green


Re: Can one get at the current mailbox name (directory)?

2022-01-27 Thread Chris Green
On Thu, Jan 27, 2022 at 10:46:53PM +0300, Oleg A. Mamontov wrote:
> I successfully use the below approach for syncing current folder with
> the same on IMAP:
> ---
> folder-hook . "source ~/.mutt/on-folder-change.muttrc"
> ---
> 
> where on-folder-change.muttrc is:
> ---
> set record = ^
> set my_folder = `echo $record | sed 's#.*/##'`
> macro index,pager o ":unset wait_keyclear; printf 
> '# syncing =$my_folder\\n\\n'; mbsync $my_folder:set wait_key" 
> "sync current folder" 
> ---
> 
> Hope this helps.
> 
Yes, thank you.  I have another possible approach now but the above
could well be a better way.

-- 
Chris Green


Re: Can one get at the current mailbox name (directory)?

2022-01-27 Thread Chris Green
On Thu, Jan 27, 2022 at 06:07:39PM +, Sam Kuper wrote:
> On Thu, Jan 27, 2022 at 05:31:01PM +0000, Chris Green wrote:
> > Is there a way of accessing the current mailbox name (i.e. for maildir
> > the directory name) in mutt?
> 
> IIRC, the caret symbol (^) can be used as a shortcut for the current
> mailbox.
> 
> Possibly relevant sections of the manual:
> 
> http://www.mutt.org/doc/manual/#shortcuts
> 
> http://www.mutt.org/doc/manual/#folder-hook
> 
> http://www.mutt.org/doc/manual/#mailbox-hook
> 
> 
> > This is so I can put it in things like a 'set editor='
> > command to pass to the 'editor'.
> 
> Haven't tried using a caret in such a command myself.  Let us know how
> you get on.
> 
I tried 'set my_xxx=^' and it just set the variable to ^ which wasn't
very helpful!

-- 
Chris Green


Can one get at the current mailbox name (directory)?

2022-01-27 Thread Chris Green
Is there a way of accessing the current mailbox name (i.e. for maildir
the directory name) in mutt?

This is so I can put it in things like a 'set editor='
command to pass to the 'editor'.

-- 
Chris Green


Re: Problem with mailcap, did it work? Am I confused (yes)?

2022-01-26 Thread Chris Green
On Wed, Jan 26, 2022 at 03:40:22PM +, Chris Green wrote:
> I'm sure that once upon a time I could read MS Word documents via
> mailcap without problems.
> 
> Now I just get "No matching mailcap entry found.  Viewing as text."
> 
> There is a matching mailcap entry in /etc/mailcap, I do have a local
> ~/.mailcap though.  Does having a local .mailcap prevent mutt from
> looking in /etc/mailcap as well?
> 
> If not then where should I be looking for problems?
> 
Sorry, silly me, I forgot I had added a hook changing the mailcap_path
and it needs to be reset to the *full* path when "unhooked".

Sorry for the noise.

-- 
Chris Green


Problem with mailcap, did it work? Am I confused (yes)?

2022-01-26 Thread Chris Green
I'm sure that once upon a time I could read MS Word documents via
mailcap without problems.

Now I just get "No matching mailcap entry found.  Viewing as text."

There is a matching mailcap entry in /etc/mailcap, I do have a local
~/.mailcap though.  Does having a local .mailcap prevent mutt from
looking in /etc/mailcap as well?

If not then where should I be looking for problems?

-- 
Chris Green


Re: Slightly OT: I'm looking for a tool to merge maildirs

2022-01-25 Thread Chris Green
On Tue, Jan 25, 2022 at 12:02:34PM +0100, Marcus C. Gottwald wrote:
> 
> Chris Green wrote (Sun 2022-Jan-23 10:46:33 +):
> 
> > Both hierarchies will be on the same computer so it isn't an IMAP
> > synchronisation tool I'm looking for.  These are just directory trees
> > full of maildir mailboxes.
> 
> How about copying files on disk?
> 
> You could use "find" and/or "grep" to find the messages (= files);
> use hardlinks if you're sure that no message will be modified; use
> reflinks if the filesystem supports them; or simply copy from your
> current area to the archive again and again, if it's not too much
> data; use "fdupes" to remove duplicates (= identical content in
> differently named files) if there's a chance for duplicates being
> created.
> 
That's a point!

If I simply use rsync to copy my 'current' maildir hierarchy to the
'archive' hierarchy then only the newer files get copied, all the
older ones will already be there.  It might be worth running fdupes on
the archive occasionally but I don't think duplicates would be a big
problem, the occasional one won't matter anyway.

All I need to do then is delete files older than whatever date I
decide to 'archive' and the job's done!

-- 
Chris Green


Re: Slightly OT: I'm looking for a tool to merge maildirs

2022-01-24 Thread Chris Green
On Mon, Jan 24, 2022 at 10:34:39AM +1100, raf wrote:
> On Mon, Jan 24, 2022 at 10:24:41AM +1100, Cameron Simpson  
> wrote:
> 
> > On 23Jan2022 10:46, Chris Green  wrote:
> > >This is a bit off topic for mutt specifically but it's about doing
> > >things to the mail I read using mutt, so it's not *very* OT.  :-)
> > 
> > Had you considered a shell script which invokes mutt with -e to copy 
> > messages tagged by criteria from a mail folder to your archive folder?
> > 
> > Cheers,
> > Cameron Simpson 
> 
> That sounds clever and simple. I was thinking of
> https://github.com/lefcha/imapfilter but you'd need to
> know lua, and have imap access (rather than just file
> system access) to both sets of messages.
> 
Yes, there's quite a few similar imap/maildir utilities but they mostly
seem aimed at pulling stuff off a [remote] IMAP server to an archive
locally.  I've looked at several in my search.

-- 
Chris Green


Re: Slightly OT: I'm looking for a tool to merge maildirs

2022-01-24 Thread Chris Green
On Mon, Jan 24, 2022 at 10:24:41AM +1100, Cameron Simpson wrote:
> On 23Jan2022 10:46, Chris Green  wrote:
> >This is a bit off topic for mutt specifically but it's about doing
> >things to the mail I read using mutt, so it's not *very* OT.  :-)
> 
> Had you considered a shell script which invokes mutt with -e to copy 
> messages tagged by criteria from a mail folder to your archive folder?
> 
That's a good idea, thank you.  I have done things like this before
(i.e. an mbox to maildir script using mutt), not very fast but who
cares, it can take some hours for all I care.

I think it may need a separate process to de-duplicate the destination
but that's OK.

-- 
Chris Green


Slightly OT: I'm looking for a tool to merge maildirs

2022-01-23 Thread Chris Green
This is a bit off topic for mutt specifically but it's about doing
things to the mail I read using mutt, so it's not *very* OT.  :-)

I'm looking for a way to keep an archive (as in a maildir hierarchy)
of *all* my mail into which I can merge my current (S[aved] in to
using mutt) maildir hierarchy.

This isn't just a straight copy of everything as there will be some
(quite a lot of) overlap.  I.e. I will keep mail dating back to (say)
2010 in my current, seen directly by mutt, mail hierarchy and I will
want to merge this into the archive at (say) monthly intervals so
there will be some years of E-Mails that are in both hierarchies.

Both hierarchies will be on the same computer so it isn't an IMAP
synchronisation tool I'm looking for.  These are just directory trees
full of maildir mailboxes.

I will, if necessary, write it myself, probably in Python but I don't
want to reinvent the wheel if I don't have to.

-- 
Chris Green


Is there any access to header values in muttrc file?

2022-01-22 Thread Chris Green
Is there any way to 'see' header values from send-hook?

I want to be able to manipulate the To: address in an external program
so I want to do something like:-

send-hook 'barges.org/discussion-forum' 'source myscript.sh $to|'

I.e. I want the To: address fed into myscript.sh.


-- 
Chris Green


Can one access aliases (the alias 'name' that is) in muttrc file?

2022-01-22 Thread Chris Green
Is there any way to get at the alias 'name' in muttrc?

I'm trying to use send-hook (or send2-hook, or anything really) in
muttrc to change actions/configuration based on the alias which has
been expanded to the destination address.

I have a number of different aliases which expand to the same
destination and I want to do different things according to which alias
was used to send the E-Mail.

I.e. I have aliases (generated dynamically, but that doesn't matter
really) as follows:-

alias dbablife fo...@barges.org
alias dbabarges fo...@barges.org
alias dbabrexit fo...@barges.org
alias dbaeur fo...@barges.org
alias dbagbi fo...@barges.org
alias dbaeutravel fo...@barges.org
alias dbaforum fo...@barges.org

I want to to be able to change things in the message according to the
alias that was used.  I can't add anything extra to the
fo...@barges.org because that's used to match some header information
in received messages.

-- 
Chris Green


Re: Set variable depending on environment (or similar)

2022-01-20 Thread Chris Green
On Thu, Jan 20, 2022 at 12:30:24PM +0100, Jakub Jindra wrote:
> source `echo .muttrc-$HOSTNAME`
> 
> allows you to have all hostname specific for all hosts in a single directory
> 
Yes, *exactly* what I'm doing sat the moment, I was just trying to
avoid two extra, very short. files.

-- 
Chris Green


Re: Set variable depending on environment (or similar)

2022-01-20 Thread Chris Green
On Thu, Jan 20, 2022 at 12:26:40PM +0100, Jens John wrote:
> On Thu, 20 Jan 2022, at 10:52, Chris Green wrote:
> > The first one is easy (I think?!) but how can I do the second one
> > where my_hdr bears no relation to the hostname?
> 
> According to the mutt man page:
> 
> > It is also possible to substitute the output of a Unix command in an 
> initialization file. This is accomplished by enclosing the command in 
> backticks 
> (`command`). 
> 
> In a very simple case, setting From: based on shell logic:
> 
> my_hdr From: `case "$(hostname --fqdn)" in zbmc.eu) echo 'Chris Green 
> ' 
> ;; *) echo 'Chris Green ' ;;` 
> 
> If you're always running from a shell that guarantees $HOSTNAME to be set, 
> you could remove the subshell $(). You can also freely adjust the shell 
> expression. 
> 
Ah, thank you, that's the sort of thing I needed.  I was thinking I
might need to use muttLisp but using backquotes for shell execution
makes more sense for my particular case.

-- 
Chris Green


Re: Set variable depending on environment (or similar)

2022-01-20 Thread Chris Green
On Thu, Jan 20, 2022 at 01:07:59PM +0200, Tapani Tarvainen wrote:
> On Thu, Jan 20, 2022 at 09:52:08AM +0000, Chris Green (c...@isbd.net) wrote:
> > 
> > I run mutt on two systems with near identical muttrc files, it would
> > be very handy to be able to make the muttrc files identical to
> > simplify maintenance.
> > 
> > Essentially the *only* difference between the two muttrc files is my
> > E-Mail address used in alternates and my_hdr commands.
> > 
> > On one system I can use the system's hostname to form my address but
> > not on the other.  Is there a way to set a variable according to the
> > value of another variable (or command output)?
> 
> How about something like
> 
> source .muttrc-local
> 
> with the host-specific settings in the .muttrc-local file?
> 
Yes, that's how I do it at the moment actually, I was just trying to
avoid maintaining two more files! :-)

-- 
Chris Green


Set variable depending on environment (or similar)

2022-01-20 Thread Chris Green
I run mutt on two systems with near identical muttrc files, it would
be very handy to be able to make the muttrc files identical to
simplify maintenance.

Essentially the *only* difference between the two muttrc files is my
E-Mail address used in alternates and my_hdr commands.

On one system I can use the system's hostname to form my address but
not on the other.  Is there a way to set a variable according to the
value of another variable (or command output)?

I.e.  if mutt is running on host halon.org.uk I want to set 'my_hdr
From:  Chris Green ' but if mutt is running on
host zbmc.eu I want to set 'my_hdr From:  Chris Green
'.

The first one is easy (I think?!) but how can I do the second one
where my_hdr bears no relation to the hostname?

-- 
Chris Green


send-hook and send2-hook, when are they called relative to creating a new message?

2022-01-19 Thread Chris Green
If I am composing a new message, I fill in the To: and Subject: fields
and then I'm dropped into my editor to actually write the message.

If I understand the description in the mutt documentation send-hook
will have been called *before* my editor is called, do I have this
right?  ... and send2-hook is called *after* composing the message in
the editor.

Is there any hook that's called after hitting the Send command to
actually fire the message off at sendmail (or whatever)?  ... or at
least a the same time?

I want to do some GUI manipulation (i.e. move to another desktop)
after composing and sending messages to a particular address.  I guess
I could use a wrapper program and use $sendmail to call it.

-- 
Chris Green


Can one suppress the '[-- Autoview using ....--] message?

2022-01-18 Thread Chris Green
Is there any way to suppress the Autoview message when messages come
via a .mailcap entry?

-- 
Chris Green


Re: How to 'hook' different programs to view text/html?

2022-01-18 Thread Chris Green
On Tue, Jan 18, 2022 at 08:34:18PM +, Chris Green wrote:
> On Tue, Jan 18, 2022 at 12:28:42PM -0800, Kevin J. McCarthy wrote:
> > On Tue, Jan 18, 2022 at 05:44:04PM +0000, Chris Green wrote:
> > > Is there a straightforward way to do this?  It's easy enough to use a
> > > message hook to catch the messages from the site but what do I need to
> > > do then to convert the messages and feed them into the pager?
> > 
> > You could use the mailcap 'test=' field combined with an environment
> > variable set/unset by the hook.
> > 
> > message-hook ~A 'unsetenv MUTT_USE_ALT_VIEWER'
> > message-hook ~C 'your-l...@example.com' 'setenv MUTT_USE_ALT_VIEWER yes'
> > 
> > In .mailcap:
> > 
> > text/html; altviewer %s; test=[ -n "$MUTT_USE_ALT_VIEWER" ]; copiousoutput; 
> > nametemplate=%s.html
> > text/html; lynx -dump %s; copiousoutput; nametemplate=%s.html
> > 
> > Another idea might be to swap $mailcap_path to use another mailcap file for
> > that mailing list.
> > 
> Thanks, yes, those are possibilities.  I'll experiment. :-)
> 
The .mailcap switching works perfectly, thank you.  My alternative
'lynx -dump' is just a wrapper for lynx so slots very nicely into a
.mailcap.

Thank you.

-- 
Chris Green


Re: How to 'hook' different programs to view text/html?

2022-01-18 Thread Chris Green
On Tue, Jan 18, 2022 at 12:28:42PM -0800, Kevin J. McCarthy wrote:
> On Tue, Jan 18, 2022 at 05:44:04PM +0000, Chris Green wrote:
> > Is there a straightforward way to do this?  It's easy enough to use a
> > message hook to catch the messages from the site but what do I need to
> > do then to convert the messages and feed them into the pager?
> 
> You could use the mailcap 'test=' field combined with an environment
> variable set/unset by the hook.
> 
> message-hook ~A 'unsetenv MUTT_USE_ALT_VIEWER'
> message-hook ~C 'your-l...@example.com' 'setenv MUTT_USE_ALT_VIEWER yes'
> 
> In .mailcap:
> 
> text/html; altviewer %s; test=[ -n "$MUTT_USE_ALT_VIEWER" ]; copiousoutput; 
> nametemplate=%s.html
> text/html; lynx -dump %s; copiousoutput; nametemplate=%s.html
> 
> Another idea might be to swap $mailcap_path to use another mailcap file for
> that mailing list.
> 
Thanks, yes, those are possibilities.  I'll experiment. :-)

-- 
Chris Green


Re: How to 'hook' different programs to view text/html?

2022-01-18 Thread Chris Green
On Tue, Jan 18, 2022 at 11:04:40PM +0300, Jean Louis wrote:
> * Chris Green  [2022-01-18 20:45]:
> > I have the fairly standard setup for viewing HTML messages in mutt:-
> > 
> > auto_view text/html
> > unalternative_order *
> > message-hook ~A "alternative_order text/html text/plain text"
> > 
> > (The unalternative_order is because I have one special case where I
> > switch the order of text/html text/plain)
> > 
> > ... and in ~/.mailcap:-
> > 
> > text/html; lynx -dump %s; copiousoutput; nametemplate=%s.html
> > 
> > 
> > 
> > However I now have a requirement where I want to run HTML messages
> > from one particular mailing list (well, it's a forum actually, but I
> > get the messages by E-Mail) through a program other than lynx.
> > 
> > Is there a straightforward way to do this?  It's easy enough to use a
> > message hook to catch the messages from the site but what do I need to
> > do then to convert the messages and feed them into the pager?
> 
> I am sure you can, instead of individual program, run a dmenu or other
> similar menu in console, maybe such as fzf, or console dialogs and
> then choose by which program to open the html files.
> 
I don't want to have to interact with things at all, I just want
messages from one particular address to be filtered through a
different HTML parser than the default lynx.  The messages should just
appear in my mutt pager automatically like all other messages.

-- 
Chris Green


Re: How to 'hook' different programs to view text/html?

2022-01-18 Thread Chris Green
On Tue, Jan 18, 2022 at 05:44:04PM +, Chris Green wrote:
> I have the fairly standard setup for viewing HTML messages in mutt:-
> 
> auto_view text/html
> unalternative_order *
> message-hook ~A "alternative_order text/html text/plain text"
> 
> (The unalternative_order is because I have one special case where I
> switch the order of text/html text/plain)
> 
> ... and in ~/.mailcap:-
> 
> text/html; lynx -dump %s; copiousoutput; nametemplate=%s.html
> 
> 
> 
> However I now have a requirement where I want to run HTML messages
> from one particular mailing list (well, it's a forum actually, but I
> get the messages by E-Mail) through a program other than lynx.
> 
> Is there a straightforward way to do this?  It's easy enough to use a
> message hook to catch the messages from the site but what do I need to
> do then to convert the messages and feed them into the pager?
> 
Could display_filter help?  I.e. can I use a message_hook to set
display_filter when the message is from the list in question and unset
display_filter by default (i.e. for all other messages)?

-- 
Chris Green


How to 'hook' different programs to view text/html?

2022-01-18 Thread Chris Green
I have the fairly standard setup for viewing HTML messages in mutt:-

auto_view text/html
unalternative_order *
message-hook ~A "alternative_order text/html text/plain text"

(The unalternative_order is because I have one special case where I
switch the order of text/html text/plain)

... and in ~/.mailcap:-

text/html; lynx -dump %s; copiousoutput; nametemplate=%s.html



However I now have a requirement where I want to run HTML messages
from one particular mailing list (well, it's a forum actually, but I
get the messages by E-Mail) through a program other than lynx.

Is there a straightforward way to do this?  It's easy enough to use a
message hook to catch the messages from the site but what do I need to
do then to convert the messages and feed them into the pager?

-- 
Chris Green


Re: NeoMutt Opinions

2021-12-29 Thread Chris Green
On Wed, Dec 29, 2021 at 12:57:12PM -0500, Dan Ritter wrote:
> Jeff Abrahamson wrote: 
> > On Mon, Dec 27, 2021 at 12:33:09PM +, isdtor wrote:
> > > 
> > > > I fear the days where my dayjob requires me to use something else (than
> > > > neo/mutt).
> > > 
> > > After a corp takeover, my dayjob is fully MS-centric. Yet, I am 
> > > continuing 
> to use mutt for everything that is required, including S/MIME, and LDAP/AD 
> based address completion. Davmail+tb also works fine for the calendaring 
> aspect. 
> > 
> > I'm curious how you manage this, or maybe it's just a strong-willed 
> > eccentricity. ;-)
> > 
> > Interacting with an HTML and mobile-first world has pushed my mutt usage 
> to (mostly) interacting with developers. 
> 
> I'm not isdtor, but my approach is:
> 
> - read plaintext first, then look at HTML via w3m if it's not
>   clear.
> 
I tend to automatically run lynx on HTML messages and look at the
lynxed HTML version (if there is one) in preference to the plain text,
it often actually has more in it the plain text version just being a
sort of afterthought.

If the lynxed version isn't any good then I fire the HTML version at
my web browser.

I have some exceptions, one list in particular adds *vast* amounts of
junk to the HTML whereas the plain text version just has the actual
information I want so I have a message-hook giving me plain text for
that list.


> - have a vcal to text filter conveniently at hand -- a
>   ridiculously large number of people send calendar invites that
>   have no mention in the text of when they want to meet.
> 
Fortunately I get very few of these.


> - have a webmail client available if necessary -- I use this at
>   least once a week, but not every day.
> 
Yes, I occasionally use webmail too.


> - mail on my phone (K9) is solely for interrupts and
>   emergencies. I only sync my inbox.
> 
I just run termux on my phone and connect via ssh to my desktop where
I read the mail using mutt.  :-)

> Mutt is by far the best client for dealing with large amounts of
> mail that can't be autosorted.
> 
... and much, much faster at deleting junk than a GUI.

-- 
Chris Green


Re: Tagging attachments - works but no indicator

2021-12-01 Thread Chris Green
On Wed, Dec 01, 2021 at 09:44:47AM -0800, Kevin J. McCarthy wrote:
> On Wed, Dec 01, 2021 at 04:02:15PM +0000, Chris Green wrote:
> > But, unlike in the index view, tagging doesn't mark the tagged
> > attachments in any way so with a long list and/or if you only want to
> > attach some files from a long list it's a bit awkward.
> 
> $folder_format by default contains the %t expando to indicate tagged
> entries.  Perhaps you've changed the value of that variable?
> 
Ah, yes, obvious really.  I have folder_format set and it hasn't got
%t in it.  It was changed many moons ago to make it briefer than the
default and I left out the %t (for no good reason except ignorance).

Thank you!

-- 
Chris Green


Tagging attachments - works but no indicator

2021-12-01 Thread Chris Green
I was about to ask how one could select a series of (for example)
pictures in a directory as attachments rather than having to 'a' each
one.

However, on trying it, I discovered that tagging the attachments and
then hitting Return on the last tagged attachment does attach all the
files selected with 't'.  Good! :-)

But, unlike in the index view, tagging doesn't mark the tagged
attachments in any way so with a long list and/or if you only want to
attach some files from a long list it's a bit awkward.

Is this a bug or an enhancement request?

I'm running mutt version 2.0.5 on xubuntu 21.10.

-- 
Chris Green


Re: Search program that can find an E-Mail with an exact Date: match

2021-11-30 Thread Chris Green
On Tue, Nov 30, 2021 at 10:24:10AM -0500, John Hawkinson wrote:
> I find this discussion a bit…surprising? It seems like "mboxgrep" 
> (https://datatipp.se/mboxgrep/) 
> does this just fine. E.g. 
> 
>   mboxgrep -rH -m maildir 'Date: Sun, 17 Mar 2019 21:24:26 -0700' dir
> 
> recursively searches the headers of all mailboxes within 'dir' for the 
> pattern specified. I don't know that "-m maildir" is necessary, but it 
> works. 

I installed and tried mboxgrep, it failed miserably on my 'real'
maildir hierarchy.  It probably was tested (and works) on a maildir++
hierarchy that is all at one level with long rows of  indicating
the 'depth'.

-- 
Chris Green


Re: Search program that can find an E-Mail with an exact Date: match

2021-11-30 Thread Chris Green
On Tue, Nov 30, 2021 at 11:20:10AM +0100, Bastian wrote:
> On 29Nov21 17:36+0000, Chris Green wrote:
> > On Mon, Nov 29, 2021 at 09:45:17AM -0500, Ofer Inbar wrote:
> > But does it do it recursively down a hierarchy of folders?  That's
> > what I need.
> 
> Afaik, no. Mutt search/limits work on the current opened mailbox.
> 
> What you are trying to achieve is from my perspective a corner case and 
> make me a bit curious about it. Currently, I cannot think of a situation 
> where the Date Header is the only piece of information available to 
> search for a specific email; also in a strict string and not like on Tue 
> three weeks ago. Keep in mind, the Date field is set by the sender [0]. 
> I am not sure which instance actually adds it, mutt (as MUA) or sendmail 
> (as MTA).
> 
>   0: https://datatracker.ietf.org/doc/html/rfc2822#section-3.6.1
> 
> Anyways, just because I cannot imagine the situation, does not mean 
> there isn't one. From what I understood so far, I would have solved that 
> with `grep -r`, too. Mutt and the mail indexers I am familiar with do 
> not seem to provide what you are asking for.
> 
Yes, it is rather an odd requirement and driven by history, a typical
"if I did that now I wouldn't do it that way"! :-)

I have a personal wiki (Dokuwiki) where I keep lots of information,
mostly for my own use but also for family and friends.

A long time ago (2009/2010) we were buying a boat and I had long,
complex E-Mail conversations with the boat hire company in France who
were selling the boat.  I wrote a Doukwiki plugin to show the E-mails
in Dokuwiki, it used a ZendFramework library and the E-Mails were
referenced by folder and the Date: header as that was short and unique.

The ZendFramework has gone away to become Laminas and the PHP version
has upped a long way since 2010.  I didn't want to lose the ability to
see these conversations still so I was looking for a quick and dirty
way to do it.

As I said I've found mblaze which is in the Ubuntu repositories and I
have a bash script:-

dir="/home/chris/mail/folder/$1"
mdirs "$dir" | mlist | magrep 'Date:'"$2" | mshow

... which, given a sub-folder and a date/time string, outputs the body
of the E-Mail.  This is called using popen() from my Dokuwiki plugin,
and it works!  The 'mshow' in particular simplifies the Dokuwiki PHP
code considerably because it does all the nasty stuff of parsing the
E-Mail and working out what is most likely the wanted text.

I don't have to change the Dokuwiki pages at all as they were already
set up to call the plugin code with folder name and Date: string as
parameters.

(We didn't buy the boat by the way, the survey showed up problems, we
bought a much cheaper privately owned boat a few months later)

-- 
Chris Green


Re: Search program that can find an E-Mail with an exact Date: match

2021-11-29 Thread Chris Green
On Mon, Nov 29, 2021 at 09:45:17AM -0500, Ofer Inbar wrote:
> On Mon, Nov 29, 2021 at 12:03:31PM +,
> Chris Green  wrote:
> > From: Chris Green 
> > Sender: Mutt-users 
> > To: mutt-users@mutt.org
> > Date: Mon, 29 Nov 2021 12:03:31 +
> > Subject: Search program that can find an E-Mail with an exact Date: match
> 
> > I'm looking for a way to find (and display) an E-Mail when I know the
> > exact value of the Date: header.
> 
> You know mutt can do that, right?
> 
> It lets you search for any header you want, by regex - which can of
> course just be a string, if you escape any regex metacharacters.
> 
> I just used mutt's limit command to seach for:
>   ~h'Date: Mon, 29 Nov 2021 12:03:31'
> 
> ... and it filtered to this message from you, and no others.

But does it do it recursively down a hierarchy of folders?  That's
what I need.

-- 
Chris Green


Re: [Mutt] Search program that can find an E-Mail with an exact Date: match

2021-11-29 Thread Chris Green
On Mon, Nov 29, 2021 at 02:28:30PM +0100, Mihai Lazarescu wrote:
> On Monday, November 29, 2021 at 12:03:31 +0000, Chris Green wrote:
> 
> > I'm looking for a way to find (and display) an E-Mail when I know the
> > exact value of the Date: header.
> 
> notmuch appears to match specific date/times:
> 
>date:.. or date:
> 
> DATE AND TIME SEARCH
>notmuch understands a variety of standard and
>natural ways of expressing dates and times, both in
>absolute terms ("2012-10-24") and in relative terms
>("yesterday"). Any number of relative terms can be
>combined ("1 hour 25 minutes") and an absolute date/time
>can be combined with relative terms to further adjust it.
> 
>The range expression
>[...]
>If specifying a time range using timestamps in
>conjunction with the date prefix, each timestamp must be
>preceded by @ (ASCII hex 40). As above, each timestamp
>is a number representing the number of seconds since
>1970-01-01 00:00:00 UTC. For example:
>   date:@..@
>[...]
> 
>Single expression
>date: works as a shorthand for date:...
>For example, date:monday matches from the beginning of
>Monday until the end of Monday.
> 
But the 'Single expression' means (as it says) 'from the beginning of
 until the end of that '.

I want to match something like '29 Jan 2010 11:34:13'.


Some further searching in the Ubuntu repositories has found mblaze
which includes various bits and pieces that can be piped together to
do what I want:-

mdirs ~/mail | mlist | magrep 'Date:29 Jan 2010 11:34:13' | mshow



-- 
Chris Green


Search program that can find an E-Mail with an exact Date: match

2021-11-29 Thread Chris Green
I'm looking for a way to find (and display) an E-Mail when I know the
exact value of the Date: header.

The 'usual' search programs such as Mairix can't do this as they all
expect a date range and also expect it to be at least a day long.

I've also tried grepmail but that seems not to be able to search
maildir E-Mails.

Is there anything out there that can do this?

I can grep for the E-Mail but then I'm left with the issue of
extracting the body/text which is what I actually want.  Can I 'pipe'
the mailbox (found by grep) into mutt and then get the output on
stdout, that's what I'd need.

-- 
Chris Green


Re: The (old) linewrap issue with URLs etc.

2021-11-14 Thread Chris Green
On Sun, Nov 14, 2021 at 11:55:31AM +1100, raf wrote:
> On Fri, Nov 12, 2021 at 01:53:31PM +0000, Chris Green  wrote:
> 
> > I have a reasonable workaround, add a pager macro:-
> > 
> > macro pager l "|less
> > 
> > I can then right click on the URL in 'less' and select the whole URL.
> > It would be nice to be able to bypass the "Press any key to continue..." 
> > but I can live with that.  (there isn't a prompt_after setting for |
> > is there?).
> > 
> 
> You can suppress that. Use less's -e option (to
> automatically  exit the second time it reaches
> end-of-file), or -E option (to automatically exit the
> first time it reaches end-of-file). If you always
> that behaviour, set the environment variable (e.g.) LESS=-e
> 
Thanks, that sounds like it will make using less an even better
solution.

-- 
Chris Green


Re: The (old) linewrap issue with URLs etc.

2021-11-12 Thread Chris Green
On Fri, Nov 12, 2021 at 10:15:59AM -0500, José María Mateos wrote:
> On Fri, Nov 12, 2021 at 09:25:47AM +0000, Chris Green wrote:
> > I know this has been discussed before but I can't immediately find the
> > discussion or a solution.
> 
> Probably not the solution you're looking for, but what I do (and I guess
> more people here do) is to let go of the mouse entirely and have some
> external program that understands URLs and we then pipe the message to that
> program and select the URL we want to open.
> 
> In my case:
> 
> macro pager e 'urlscan' 'Follow links with urlscan'
> 
> Then I just press 'e' when reading a message (or CTRL + b for 'urlview',
> which is a bit simpler), select the URL I want to open and exit that
> program. Overall it's faster than relying on the mouse, I must say, though
> it forces you to scan through the list of links until you've found the one
> you're looking for.
> 
That's very much the sort of solution I was looking for, it's quite
similar to my workaround.  I'll need to compare the different
workarounds and see which suits me best.

Thank you.

-- 
Chris Green


Re: The (old) linewrap issue with URLs etc.

2021-11-12 Thread Chris Green
On Fri, Nov 12, 2021 at 11:56:31AM +, Chris Green wrote:
> On Fri, Nov 12, 2021 at 09:25:47AM +0000, Chris Green wrote:
> > I know this has been discussed before but I can't immediately find the
> > discussion or a solution.
> > 
> > I'm running Mutt 2.0.5 (2021-01-21) on xubuntu 21.10.
> > 
> > I use Lynx to handle HTML E-Mails through into mutt's viewer, as a
> > result I get a numbered list of URLs at the bottom of the message and
> > these are very often long and thus wrap over multiple lines.
> > 
> > This causes a couple of issues:-
> > 
> > You can't right click on the URL to 'Open Link' or 'Copy link
> > address', you only get the first line.
> > 
> > Even if you select the whole URL with the mouse it then has
> > embedded 'white space' and (some) browsers don't handle this
> > correctly if you paste the URL into the address bar.
> > 
> > As I say I'm sure this has been discussed before so, sorry if there's
> > an answer already.  Anyway I'd like to know if there is an answer or
> > workaround.
> > 
> > (This issue has just worsened for me because I've moved from Firefox
> > to Vivaldi.  Firefox ignores the embedded white space OK but Vivaldi
> > doesn't)
> > 
> If smart_wrap did what the description seems to say:-
> 
> Controls the display of lines longer than the screen width in the
> internal pager. If set, long lines are wrapped at a word boundary. If
> unset, lines are simply wrapped at the screen edge. Also see the
> $markers variable.
> 
> Then all would be well, there are no word boundaries in URLs so, if
> one has smart_wrap=yes (which I do) then long URLs shouldn't be
> wrapped, but they are.
> 
> As a quick check I tried setting pager=less and then long URLs worked
> perfectly, the mouse selects the whole multi-line URL, but using an
> external pager has its downsides unfortunately.
> 
Keep talking to myself :-)

I have a reasonable workaround, add a pager macro:-

macro pager l "|less

I can then right click on the URL in 'less' and select the whole URL.
It would be nice to be able to bypass the "Press any key to continue..." 
but I can live with that.  (there isn't a prompt_after setting for |
is there?).


-- 
Chris Green


Re: The (old) linewrap issue with URLs etc.

2021-11-12 Thread Chris Green
On Fri, Nov 12, 2021 at 09:25:47AM +, Chris Green wrote:
> I know this has been discussed before but I can't immediately find the
> discussion or a solution.
> 
> I'm running Mutt 2.0.5 (2021-01-21) on xubuntu 21.10.
> 
> I use Lynx to handle HTML E-Mails through into mutt's viewer, as a
> result I get a numbered list of URLs at the bottom of the message and
> these are very often long and thus wrap over multiple lines.
> 
> This causes a couple of issues:-
> 
> You can't right click on the URL to 'Open Link' or 'Copy link
> address', you only get the first line.
> 
> Even if you select the whole URL with the mouse it then has
> embedded 'white space' and (some) browsers don't handle this
> correctly if you paste the URL into the address bar.
> 
> As I say I'm sure this has been discussed before so, sorry if there's
> an answer already.  Anyway I'd like to know if there is an answer or
> workaround.
> 
> (This issue has just worsened for me because I've moved from Firefox
> to Vivaldi.  Firefox ignores the embedded white space OK but Vivaldi
> doesn't)
> 
If smart_wrap did what the description seems to say:-

Controls the display of lines longer than the screen width in the
internal pager. If set, long lines are wrapped at a word boundary. If
unset, lines are simply wrapped at the screen edge. Also see the
$markers variable.

Then all would be well, there are no word boundaries in URLs so, if
one has smart_wrap=yes (which I do) then long URLs shouldn't be
wrapped, but they are.

As a quick check I tried setting pager=less and then long URLs worked
perfectly, the mouse selects the whole multi-line URL, but using an
external pager has its downsides unfortunately.

-- 
Chris Green


The (old) linewrap issue with URLs etc.

2021-11-12 Thread Chris Green
I know this has been discussed before but I can't immediately find the
discussion or a solution.

I'm running Mutt 2.0.5 (2021-01-21) on xubuntu 21.10.

I use Lynx to handle HTML E-Mails through into mutt's viewer, as a
result I get a numbered list of URLs at the bottom of the message and
these are very often long and thus wrap over multiple lines.

This causes a couple of issues:-

You can't right click on the URL to 'Open Link' or 'Copy link
address', you only get the first line.

Even if you select the whole URL with the mouse it then has
embedded 'white space' and (some) browsers don't handle this
correctly if you paste the URL into the address bar.

As I say I'm sure this has been discussed before so, sorry if there's
an answer already.  Anyway I'd like to know if there is an answer or
workaround.

(This issue has just worsened for me because I've moved from Firefox
to Vivaldi.  Firefox ignores the embedded white space OK but Vivaldi
doesn't)

-- 
Chris Green


Re: I can't seem to make a message-hook work, what am I doing wrong?

2021-10-31 Thread Chris Green
On Sun, Oct 31, 2021 at 09:19:47AM +, Chris Green wrote:
> On Sat, Oct 30, 2021 at 09:05:18PM +0100, Chris Green wrote:
> Well I now have:-
> 
> auto_view text/html
> unalternative_order
> message-hook ~A "alternative_order text/html text/plain text"
> 
> message-hook '~f ilovefreegle.org' 'unalternative_order'
> message-hook '~f ilovefreegle.org' 'alternative_order text/plain 
> text/html'
> 
> ... and it's still not working.  Obviously I'm still misunderstanding
> something!
> 
Got it!  It should be:-

auto_view text/html
unalternative_order *
message-hook ~A "alternative_order text/html text/plain text"

message-hook '~f ilovefreegle.org' 'unalternative_order *'
message-hook '~f ilovefreegle.org' 'alternative_order text/plain text/html'

Now I can actually see the messages I get from Freegle! :-)

Thanks all.

-- 
Chris Green


Re: I can't seem to make a message-hook work, what am I doing wrong?

2021-10-31 Thread Chris Green
On Sat, Oct 30, 2021 at 09:05:18PM +0100, Chris Green wrote:
> On Sat, Oct 30, 2021 at 10:06:41AM -0700, Kevin J. McCarthy wrote:
> > On Sat, Oct 30, 2021 at 10:56:12AM +0100, Chris Green wrote:
> > > So, I have the following lines in my muttrc file:-
> > > 
> > >auto_view text/html
> > >alternative_order text/html text/plain text
> > >message-hook '~f .*ilovefreegle.org.*' 'alternative_order text/plain 
> > > text/html'
> > 
> > Each invocation of alternative_order appends to the list - it doesn't erase
> > and reset the values.  You'll want to use 'unalternative_order *' to clear
> > out the list.
> > 
> That would explain it! Thank you.
> 
> 
> > Also, don't forget the message-hook you have above will affect that message
> > and all subsequent messages, unless you have a default message-hook to reset
> > values back.
> > 
> Yes, I was aware that I hadn't done that as required.
> 
Well I now have:-

auto_view text/html
unalternative_order
message-hook ~A "alternative_order text/html text/plain text"

message-hook '~f ilovefreegle.org' 'unalternative_order'
message-hook '~f ilovefreegle.org' 'alternative_order text/plain text/html' 
   

... and it's still not working.  Obviously I'm still misunderstanding
something!

Here's the relevant bit of the header of a message I'm trying to match
and use the text/plain part:-

From: Chris 
To: Chris 

... and just to prove there is a text/plain part to view:-

->   I 1
[multipa/alternativ, 7bit, 29K]
 I 2 ├─>  [text/plain, 
quoted, utf-8, 0.2K]
     I 3 └─>[text/html, 
base64, utf-8, 28K]

(you can see why I prefer the text/plain version!)


-- 
Chris Green


Re: I can't seem to make a message-hook work, what am I doing wrong?

2021-10-30 Thread Chris Green
On Sat, Oct 30, 2021 at 10:06:41AM -0700, Kevin J. McCarthy wrote:
> On Sat, Oct 30, 2021 at 10:56:12AM +0100, Chris Green wrote:
> > So, I have the following lines in my muttrc file:-
> > 
> >auto_view text/html
> >alternative_order text/html text/plain text
> >message-hook '~f .*ilovefreegle.org.*' 'alternative_order text/plain 
> > text/html'
> 
> Each invocation of alternative_order appends to the list - it doesn't erase
> and reset the values.  You'll want to use 'unalternative_order *' to clear
> out the list.
> 
That would explain it! Thank you.


> Also, don't forget the message-hook you have above will affect that message
> and all subsequent messages, unless you have a default message-hook to reset
> values back.
> 
Yes, I was aware that I hadn't done that as required.


-- 
Chris Green


I can't seem to make a message-hook work, what am I doing wrong?

2021-10-30 Thread Chris Green
I am trying to match messages in a mailing list with a message-hook so
that I can change the alternative_order setting to prioritise plain
text for this one mailing list.


So, I have the following lines in my muttrc file:-

auto_view text/html
alternative_order text/html text/plain text
message-hook '~f .*ilovefreegle.org.*' 'alternative_order text/plain 
text/html'

But it's not working, messages from addresses with ilovefreegle.org in
the From: are still getting fed through my html viewer.

Here's the header from a message which *isn't* getting matched:-

Date: Wed, 27 Oct 2021 19:18:19 +0100
From: Chris 
To: Chris 
Subject: OFFER: HP Envy 4527 All-in-one printer (IP12) ~-~~~-~-~



Have I got the matching expression wrong?  ... or have I misunderstood
how message-hook works, I'm expecting to be able to look at saved
messages and have them matched by message-hook before viewing them.

... oh, yes, I have checked that there is a text/plain part in these
messages! :-)


-- 
Chris Green


Re: using mutt with postfix and localhost:25

2021-09-11 Thread Chris Green
On Sat, Sep 11, 2021 at 05:24:21PM +1000, raf wrote:
> On Sat, Sep 11, 2021 at 05:31:13AM +, Globe Trotter via Mutt-users 
>  wrote: 
> 
> > Hi,
> > 
> > I have an account where I need to send email through localhost
> > (with port 25). I am using postfix currently, but I do not know
> > much. Anyway, on sylpheed, I used to say: localhost:25 as the SMTP
> > server and life was good. So, my question is how do I set it up for
> > this account to use SMTP server localhost:25? (The other accounts are
> > personal and will use gmx, etc, SMTP settings). I have been using
> > postfix because my work email uses postfix as given by my sysadmin (I
> > think that it changes the relayhost name) and perhps the same can be
> > done with something like msmtp but i do not know.
> > 
> > Thanks!
> 
> The typical way to submit mail locally is via
> /usr/sbin/sendmail. That's the default in mutt (and
> probably all other MUAs). The explicit default is:
> 
>   set sendmail="/usr/sbin/sendmail -oem -oi"
> 
> You shouldn't have to do anything to make this happen.
> It's the default.
> 
That's how I run mutt with postfix on my xubuntu system.

-- 
Chris Green


Re: Can index lines be wrapped?

2021-08-14 Thread Chris Green
On Sat, Aug 14, 2021 at 09:05:17AM +0100, Nuno Silva wrote:
> 
> While changing formats will help mitigating the problem, I expect it to
> resurface occasionally. I wonder if there's anything that could be done
> in general to avoid truncated lines or to make these readable - either
> allowing left-right scroll or having a "line-wrap mode" for indices?
> 
> (Or is one of these a mutt feature I haven't learned about yet?)
> 
Yes, that's what I was originally hoping for, a line-wrap for the
index would be the ideal solution.

-- 
Chris Green


Re: Can index lines be wrapped?

2021-08-14 Thread Chris Green
On Sat, Aug 14, 2021 at 08:56:37AM +1000, Cameron Simpson wrote:
> On 13Aug2021 08:17, Chris Green  wrote:
> >On Fri, Aug 13, 2021 at 08:15:26AM +0200, Alexander Dahl wrote:
> >> On Thu, Aug 12, 2021 at 08:30:11AM +0100, Chris Green wrote:
> >> > I read my mail (via ssh) on quite a variety of devices, one is an
> >> > Android phone running termux which has rather short lines which
> >> > truncate much of the subject in index view.
> >> >
> >> > I could rearrange the index_format but that would change it for all my
> >> > viewing devices and I don't really want to do that, and anyway I'd
> >> > still lose some information.
> >>
> >> What about a macro or shortcut to toggle between different settings?
> >>
> >That's possible but it's just one more thing that one has to to
> >manually which isn't really necessary.
> 
> I always invoke via a script (named "+") which has assorted 
> figure-it-out logic before invoking mutt. You could sniff the terminal 
> size and choose a narrower index_format for narrow terminals. (_And_ 
> bind that to a keyboard toggle macro as well if you wanted.)
> 
> I've got a ttysize script which does this:
> 
> stty -a  | sed -n '
>   s/.* rows \([0-9][0-9]*\); columns \([0-9][0-9]*\).*/\2 \1/p
>   t
>   s/.*; *\([0-9][0-9]*\) rows; *\([0-9][0-9]*\) columns.*/\2 \1/p
>   t'
> 
> but I'm sure there must be a more direct way.
> 
> Anyway, given the tty width you could make a choice about index_format.
> 
Yes, of course some sort of wrapper could handle it.  "stty -a" works
perfectly well in termux on Android, gives me 48 columns by default.

Thanks

-- 
Chris Green


Re: Can index lines be wrapped?

2021-08-13 Thread Chris Green
On Fri, Aug 13, 2021 at 08:15:26AM +0200, Alexander Dahl wrote:
> Hello Chris,
> 
> On Thu, Aug 12, 2021 at 08:30:11AM +0100, Chris Green wrote:
> > I read my mail (via ssh) on quite a variety of devices, one is an
> > Android phone running termux which has rather short lines which
> > truncate much of the subject in index view.
> > 
> > I could rearrange the index_format but that would change it for all my
> > viewing devices and I don't really want to do that, and anyway I'd
> > still lose some information.
> 
> What about a macro or shortcut to toggle between different settings?
> 
That's possible but it's just one more thing that one has to to
manually which isn't really necessary.

-- 
Chris Green


Can index lines be wrapped?

2021-08-12 Thread Chris Green
I read my mail (via ssh) on quite a variety of devices, one is an
Android phone running termux which has rather short lines which
truncate much of the subject in index view.

I could rearrange the index_format but that would change it for all my
viewing devices and I don't really want to do that, and anyway I'd
still lose some information.

Is there any way to wrap the lines in index view?

-- 
Chris Green


Is there any programmatic way of changing message recipients (specifically To:)?

2021-07-01 Thread Chris Green
The subject says it all really. :-)

Is there any way that mutt can change the To: header of a message?
This could be either on its way to 'compose' or on its way out from
'compose'.

Basically I want to automate changing To: when replying to certain
messages where To: (and probably some other headers) match a
particular expression.

-- 
Chris Green


Re: How to execute command (as opposed to function) from the command prompt

2021-06-29 Thread Chris Green
On Tue, Jun 29, 2021 at 01:39:04PM -0400, John Hawkinson wrote:
> Chris Green  wrote on Tue, 29 Jun 2021
> at 13:31:49 EDT in :
> 
> > How do you execute a *command* from the mutt command prompt?
> > 
> > So, for example, having hit : to get to the command prompt how can I
> > do  to show/hide the sidebar?
> 
> :exec sidebar-toggle-visible
> 
Ah, thank you!

-- 
Chris Green


How to execute command (as opposed to function) from the command prompt

2021-06-29 Thread Chris Green
This sounds as if it should be obvious but I can't find (in the
documentationa) how to do it.

How do you execute a *command* from the mutt command prompt?

So, for example, having hit : to get to the command prompt how can I
do  to show/hide the sidebar?

By default the command prompt is expecting muttrc configuration
commands, not things like sidebar-toggle-visible.

-- 
Chris Green


Re: Can folder-hook refer to a sub-directory mailbox?

2021-06-24 Thread Chris Green
On Thu, Jun 24, 2021 at 09:18:25PM +0100, Chris Green wrote:
> On Thu, Jun 24, 2021 at 09:15:06PM +0100, Chris Green wrote:
> > On Thu, Jun 24, 2021 at 12:30:35PM -0400, Patrick Shanahan wrote:
> > > * Chris Green  [06-24-21 12:16]:
> > > > It's a bit difficult to explain this.
> > > > 
> > > > Is it possible for a folder-hook RE to apply to all mailboxes in a
> > > > sub-directory?
> > > > 
> > > > E.g. can one produce an RE for all the sub-directories of ~/mail/folder?
> > > > All my actual mailboxes are two levels further down:-
> > > > 
> > > > ./folder/france
> > > > ./folder/france/jobs
> > > > ./folder/france/healthcare
> > > > ./folder/france/healthcare/tmp
> > > > ./folder/france/healthcare/new
> > > > ./folder/france/healthcare/cur
> > > > ./folder/france/healthcare/cur/1601033995.01.mbox:2,
> > > > ./folder/france/healthcare/cur/1601033995.04.mbox:2,
> > > > ./folder/france/healthcare/cur/1601033995.02.mbox:2,
> > > > ./folder/france/healthcare/cur/1601033995.07.mbox:2,
> > > > ./folder/france/healthcare/cur/1601033995.03.mbox:2,
> > > > ./folder/france/healthcare/cur/1601033995.05.mbox:2,
> > > > ./folder/france/healthcare/cur/1601033995.00.mbox:2,
> > > > ./folder/france/healthcare/cur/1601033995.06.mbox:2,
> > > > ./folder/france/houseSitting
> > > > ./folder/france/houseSitting/tmp
> > > > ./folder/france/houseSitting/new
> > > > ./folder/france/houseSitting/cur
> > > > ./folder/france/houseSitting/cur/1601033995.00.mbox:2,RS
> > > > 
> > > > The mailboxes are jobs (though it's empty), healthcare and housesitting.
> > > > Obviously I actually have lots more mailboxes in lots more
> > > > sub-directories below ./folder.  Can a folder-hook RE select them all?
> > > > 
> > > > I.e. does 'folder/.*/.*' work?
> > > 
> > > 
> > > did you consider seting it and then trying?
> > > 
> > Well I have now and it doesn't appear to work.
> > 
> > I have put the following in my muttrc file:-
> > 
> > folder-hook . set mbox_type=maildir
> > folder-hook 'folder/.*' set mbox_type=mbox
> > 
> > ... and when I save mail in the folder hierarchy it's still in maildir
> > format.
> > 
> ... and I have also tried:-
> 
> folder-hook . set mbox_type=maildir
> folder-hook '~/mail/folder/.*' set mbox_type=mbox
> 
> It still doesn't work.
> 
On thinking about it this isn't likely to work as folder-hook gets
actioned when reading the mailbox.  I'm not reading the mailbox, I'm
saving to it.  What I want is a save-hook that allows me to set the
mbox_type.

-- 
Chris Green


Re: Can folder-hook refer to a sub-directory mailbox?

2021-06-24 Thread Chris Green
On Thu, Jun 24, 2021 at 09:15:06PM +0100, Chris Green wrote:
> On Thu, Jun 24, 2021 at 12:30:35PM -0400, Patrick Shanahan wrote:
> > * Chris Green  [06-24-21 12:16]:
> > > It's a bit difficult to explain this.
> > > 
> > > Is it possible for a folder-hook RE to apply to all mailboxes in a
> > > sub-directory?
> > > 
> > > E.g. can one produce an RE for all the sub-directories of ~/mail/folder?
> > > All my actual mailboxes are two levels further down:-
> > > 
> > > ./folder/france
> > > ./folder/france/jobs
> > > ./folder/france/healthcare
> > > ./folder/france/healthcare/tmp
> > > ./folder/france/healthcare/new
> > > ./folder/france/healthcare/cur
> > > ./folder/france/healthcare/cur/1601033995.01.mbox:2,
> > > ./folder/france/healthcare/cur/1601033995.04.mbox:2,
> > > ./folder/france/healthcare/cur/1601033995.02.mbox:2,
> > > ./folder/france/healthcare/cur/1601033995.07.mbox:2,
> > > ./folder/france/healthcare/cur/1601033995.03.mbox:2,
> > > ./folder/france/healthcare/cur/1601033995.05.mbox:2,
> > > ./folder/france/healthcare/cur/1601033995.00.mbox:2,
> > > ./folder/france/healthcare/cur/1601033995.06.mbox:2,
> > > ./folder/france/houseSitting
> > > ./folder/france/houseSitting/tmp
> > > ./folder/france/houseSitting/new
> > > ./folder/france/houseSitting/cur
> > > ./folder/france/houseSitting/cur/1601033995.00.mbox:2,RS
> > > 
> > > The mailboxes are jobs (though it's empty), healthcare and housesitting.
> > > Obviously I actually have lots more mailboxes in lots more
> > > sub-directories below ./folder.  Can a folder-hook RE select them all?
> > > 
> > > I.e. does 'folder/.*/.*' work?
> > 
> > 
> > did you consider seting it and then trying?
> > 
> Well I have now and it doesn't appear to work.
> 
> I have put the following in my muttrc file:-
> 
> folder-hook . set mbox_type=maildir
> folder-hook 'folder/.*' set mbox_type=mbox
> 
> ... and when I save mail in the folder hierarchy it's still in maildir
> format.
> 
... and I have also tried:-

folder-hook . set mbox_type=maildir
folder-hook '~/mail/folder/.*' set mbox_type=mbox

It still doesn't work.

-- 
Chris Green


Re: Can folder-hook refer to a sub-directory mailbox?

2021-06-24 Thread Chris Green
On Thu, Jun 24, 2021 at 12:30:35PM -0400, Patrick Shanahan wrote:
> * Chris Green  [06-24-21 12:16]:
> > It's a bit difficult to explain this.
> > 
> > Is it possible for a folder-hook RE to apply to all mailboxes in a
> > sub-directory?
> > 
> > E.g. can one produce an RE for all the sub-directories of ~/mail/folder?
> > All my actual mailboxes are two levels further down:-
> > 
> > ./folder/france
> > ./folder/france/jobs
> > ./folder/france/healthcare
> > ./folder/france/healthcare/tmp
> > ./folder/france/healthcare/new
> > ./folder/france/healthcare/cur
> > ./folder/france/healthcare/cur/1601033995.01.mbox:2,
> > ./folder/france/healthcare/cur/1601033995.04.mbox:2,
> > ./folder/france/healthcare/cur/1601033995.02.mbox:2,
> > ./folder/france/healthcare/cur/1601033995.07.mbox:2,
> > ./folder/france/healthcare/cur/1601033995.03.mbox:2,
> > ./folder/france/healthcare/cur/1601033995.05.mbox:2,
> > ./folder/france/healthcare/cur/1601033995.00.mbox:2,
> > ./folder/france/healthcare/cur/1601033995.06.mbox:2,
> > ./folder/france/houseSitting
> > ./folder/france/houseSitting/tmp
> > ./folder/france/houseSitting/new
> > ./folder/france/houseSitting/cur
> > ./folder/france/houseSitting/cur/1601033995.00.mbox:2,RS
> > 
> > The mailboxes are jobs (though it's empty), healthcare and housesitting.
> > Obviously I actually have lots more mailboxes in lots more
> > sub-directories below ./folder.  Can a folder-hook RE select them all?
> > 
> > I.e. does 'folder/.*/.*' work?
> 
> 
> did you consider seting it and then trying?
> 
Well I have now and it doesn't appear to work.

I have put the following in my muttrc file:-

folder-hook . set mbox_type=maildir
folder-hook 'folder/.*' set mbox_type=mbox

... and when I save mail in the folder hierarchy it's still in maildir
format.

-- 
Chris Green


Re: Sorting of folders

2021-06-24 Thread Chris Green
On Thu, Jun 24, 2021 at 02:54:29PM -0400, Jon LaBadie wrote:
> On Thu, Jun 24, 2021 at 11:06:25AM +0100, Chris Green wrote:
> > Is there any way that one can overcome this major disadvantage of
> > maildir?
> > 
> > Since maildir messages are saved in sub-directories of the named
> > 'maildir directory' there seems to be no practical way to do sorting
> > of maildirs on anything but name.
> > 
> > What I'd really like to be able to do is to sort on date of last
> > message.
> > 
> > For example I have a 'shopping/diy' directory which has lots of
> > sub-directories like 'glue', 'grease', 'lynchpins', etc.  It would be
> > really handy if I could sort the directories within 'diy' by date as
> > then the most used ones (or the most recently used ones) would be at
> > the top of the listing and quicker to get to.  However, as far as I
> > understand things, this isn't possible with maildir as the date on the
> > *directory* (e.g. the date on 'glue' or 'lynchpin') is the date of
> > creation of the directory which might be years ago when I first bought
> > some glue.
> > 
> > If these were mbox mailboxes then they'd be a file whose date would
> > reflect the last entry which would be exactly what I want.
> > 
> 
> The date you see with an "ls -l" is called "mtime", time of last
> modification of the entries data.  If it happens to match your
> directories time of creation (which is not stored) it is coincidence.
> 
> For a directory, its data is the list of files it contains.  So mtime
> should change whenever an entry is added or removed.  Note, renaming
> and entry is typically add an entry, the new name as a link, then
> unlink the old name.
> 
> Try sorting the directories according to mtime with ls -lt (or -ltr
> for reverse order).
> 
You've missed the point (I think), in a maildir the directories whose
mtime dates change are the cur, new and tmp directories.  The parent
directory whose name is the mailbox name never changes mtime (unless
you do something other than adding or removing messages).  The maildir
directory doesn't contain any files that change, only cur, new and tmp
directories.

-- 
Chris Green


Re: Can folder-hook refer to a sub-directory mailbox?

2021-06-24 Thread Chris Green
On Thu, Jun 24, 2021 at 12:30:35PM -0400, Patrick Shanahan wrote:
> * Chris Green  [06-24-21 12:16]:
> > It's a bit difficult to explain this.
> > 
> > Is it possible for a folder-hook RE to apply to all mailboxes in a
> > sub-directory?
> > 
> > E.g. can one produce an RE for all the sub-directories of ~/mail/folder?
> > All my actual mailboxes are two levels further down:-
> > 
> > ./folder/france
> > ./folder/france/jobs
> > ./folder/france/healthcare
> > ./folder/france/healthcare/tmp
> > ./folder/france/healthcare/new
> > ./folder/france/healthcare/cur
> > ./folder/france/healthcare/cur/1601033995.01.mbox:2,
> > ./folder/france/healthcare/cur/1601033995.04.mbox:2,
> > ./folder/france/healthcare/cur/1601033995.02.mbox:2,
> > ./folder/france/healthcare/cur/1601033995.07.mbox:2,
> > ./folder/france/healthcare/cur/1601033995.03.mbox:2,
> > ./folder/france/healthcare/cur/1601033995.05.mbox:2,
> > ./folder/france/healthcare/cur/1601033995.00.mbox:2,
> > ./folder/france/healthcare/cur/1601033995.06.mbox:2,
> > ./folder/france/houseSitting
> > ./folder/france/houseSitting/tmp
> > ./folder/france/houseSitting/new
> > ./folder/france/houseSitting/cur
> > ./folder/france/houseSitting/cur/1601033995.00.mbox:2,RS
> > 
> > The mailboxes are jobs (though it's empty), healthcare and housesitting.
> > Obviously I actually have lots more mailboxes in lots more
> > sub-directories below ./folder.  Can a folder-hook RE select them all?
> > 
> > I.e. does 'folder/.*/.*' work?
> 
> 
> did you consider seting it and then trying?
> 
It's not that straightforward though is it?!  I'd have to have
something that changes very obviously with the folder-hook setting.

I was just hoping someone would simply know the answer and say 'yes'
or 'no'.

OK, if no one has tried such a thing previously I'm quite happy to try.

-- 
Chris Green


Can folder-hook refer to a sub-directory mailbox?

2021-06-24 Thread Chris Green
It's a bit difficult to explain this.

Is it possible for a folder-hook RE to apply to all mailboxes in a
sub-directory?

E.g. can one produce an RE for all the sub-directories of ~/mail/folder?
All my actual mailboxes are two levels further down:-

./folder/france
./folder/france/jobs
./folder/france/healthcare
./folder/france/healthcare/tmp
./folder/france/healthcare/new
./folder/france/healthcare/cur
./folder/france/healthcare/cur/1601033995.01.mbox:2,
./folder/france/healthcare/cur/1601033995.04.mbox:2,
./folder/france/healthcare/cur/1601033995.02.mbox:2,
./folder/france/healthcare/cur/1601033995.07.mbox:2,
./folder/france/healthcare/cur/1601033995.03.mbox:2,
./folder/france/healthcare/cur/1601033995.05.mbox:2,
./folder/france/healthcare/cur/1601033995.00.mbox:2,
./folder/france/healthcare/cur/1601033995.06.mbox:2,
./folder/france/houseSitting
./folder/france/houseSitting/tmp
./folder/france/houseSitting/new
./folder/france/houseSitting/cur
./folder/france/houseSitting/cur/1601033995.00.mbox:2,RS

The mailboxes are jobs (though it's empty), healthcare and housesitting.
Obviously I actually have lots more mailboxes in lots more
sub-directories below ./folder.  Can a folder-hook RE select them all?

I.e. does 'folder/.*/.*' work?

-- 
Chris Green


Sorting of folders

2021-06-24 Thread Chris Green
Is there any way that one can overcome this major disadvantage of
maildir?

Since maildir messages are saved in sub-directories of the named
'maildir directory' there seems to be no practical way to do sorting
of maildirs on anything but name.

What I'd really like to be able to do is to sort on date of last
message.

For example I have a 'shopping/diy' directory which has lots of
sub-directories like 'glue', 'grease', 'lynchpins', etc.  It would be
really handy if I could sort the directories within 'diy' by date as
then the most used ones (or the most recently used ones) would be at
the top of the listing and quicker to get to.  However, as far as I
understand things, this isn't possible with maildir as the date on the
*directory* (e.g. the date on 'glue' or 'lynchpin') is the date of
creation of the directory which might be years ago when I first bought
some glue.

If these were mbox mailboxes then they'd be a file whose date would
reflect the last entry which would be exactly what I want.


I'm wondering if it's possible to keep my saved files (i.e. those in
'shopping/diy' etc.) as mbox and just use maildir for the live
incoming mail (i.e. those in my 'mailboxes' list).  It's only in the
incoming mailboxes that the 'no locking needed' abilities of maildir
are useful.

Is there some incatation of folder-hook I can use to set mbox_type to
different things for different places?

-- 
Chris Green


Re: Odd quirk in folder_format display

2021-06-22 Thread Chris Green
On Mon, Jun 21, 2021 at 10:15:45PM +0100, Chris Green wrote:
> I have quite a few levels of directories below my ~/mail directory.
> 
> For some reason when I navigate through some of them the numbers of
> messages are displayed whereas in others they aren't.
> 
... and of course I've now spotted the reason:-

%m, %n, and %N only work for monitored mailboxes.

-- 
Chris Green


Re: Can one to a non-mail folder?

2021-06-22 Thread Chris Green
On Mon, Jun 21, 2021 at 02:15:30PM -0700, Kevin J. McCarthy wrote:
> On Mon, Jun 21, 2021 at 09:56:17PM +0100, Chris Green wrote:
> > While I'm here what's the difference between  and
> > ?
> 
> A good place to look when writing macros are the tables at:
> <http://www.mutt.org/doc/manual/#functions>
> 
> Breaking down the parts of the macro:
> 
>  - the change folder prompt in the index menu
> ?   - starts the file browser (the browser menu)
> - changes the current listed directory in the browser menu
> 
Yes, sorry, I wasn't meaning I couldn't understand the macro sequence.

I was just wondering why the comands for changing directory in the
browser menu and index menu have different names.

-- 
Chris Green


Odd quirk in folder_format display

2021-06-21 Thread Chris Green
I have quite a few levels of directories below my ~/mail directory.

For some reason when I navigate through some of them the numbers of
messages are displayed whereas in others they aren't.

Here is my Ju (junk) folder as displayed in mutt:-

-- Mutt: Directory [Ju], File mask: !^\.[^.]
->   ../
 canals/
 digikam/
 dokuwiki/
 leafnode/
 postponed/
 rsync/
 xfce/


... and here is my In (inboxes) folder:-

-- Mutt: Directory [In], File mask: !^\.[^.]
->   ../
 cl/190
 default/   852
 freegle/40
 inbox/ 300
 odin/   30
 tinnews/00



... and here are (some of) their contents:-

chris@esprimo$ cd ~/mail/In
/home/chris/mail/In
chris@esprimo$ ls -l
total 24
drwx-- 5 chris chris 4096 Feb 26 18:10 cl
drwx-- 5 chris chris 4096 Sep 25  2020 default
drwx-- 5 chris chris 4096 Feb 19 13:53 freegle
drwx-- 5 chris chris 4096 Sep 25  2020 inbox
drwx-- 5 chris chris 4096 Sep 25  2020 odin
drwx-- 5 chris chris 4096 Feb 27 00:25 tinnews
chris@esprimo$ ls -l cl
total 12
drwx-- 2 chris chris 4096 Jun 15 09:14 cur
drwx-- 2 chris chris 4096 Jun 21 10:18 new
drwx-- 2 chris chris 4096 Jun 21 05:01 tmp
chris@esprimo$ cd ~/mail/Ju
/home/chris/mail/Ju
chris@esprimo$ ls -l
total 28
drwx-- 5 chris chris 4096 Apr 17 20:38 canals
drwx-- 5 chris chris 4096 Nov 24  2020 digikam
drwx-- 5 chris chris 4096 Nov 18  2020 dokuwiki
drwx-- 5 chris chris 4096 Apr 10 12:03 leafnode
drwx-- 5 chris chris 4096 Jun 21 19:39 postponed
drwx-- 5 chris chris 4096 Nov 18  2020 rsync
drwx-- 5 chris chris 4096 Nov 19  2020 xfce
chris@esprimo$ ls -l canals
total 12
drwx-- 2 chris chris 4096 Jun 21 19:36 cur
drwx-- 2 chris chris 4096 Jun 21 19:36 new
drwx-- 2 chris chris 4096 Jun 21 17:49 tmp




I don't understand why I'm not seeing message counts in the Ju folder.
There are similar 'some work, some don't work' folders elsewhere in my
mail folders.

-- 
Chris Green


Re: Can one to a non-mail folder?

2021-06-21 Thread Chris Green
On Mon, Jun 21, 2021 at 01:42:46PM -0700, Kevin J. McCarthy wrote:
> On Mon, Jun 21, 2021 at 08:54:08PM +0100, Chris Green wrote:
> > I want to create a macro to navigate to my "shopping" folder which holds
> > directories where I save E-Mails about shopping.
> 
> Something like this seems to work for me:
> macro index ,cs 
> "?~/mail/shopping"
> 
Thank you, that's perfect!

While I'm here what's the difference between  and
?

-- 
Chris Green


Can one to a non-mail folder?

2021-06-21 Thread Chris Green
I want to create a macro to navigate to my "shopping" folder which
holds directories where I save E-Mails about shopping.

I can't do this directly because the shopping directory doesn't
actually have any mail in it, it's all in sub-directories of shopping.
I get the error "/home/chris/mail/shopping is not a mailbox".

Is there any way of creating a macro to do this?
 
-- 
Chris Green


Re: Is there any way to print attachments such as PDF files?

2021-04-16 Thread Chris Green
On Fri, Apr 16, 2021 at 09:07:39PM +0200, Anders Damsgaard wrote:
> * Chris Green  [2021-04-16 19:28:17 +0100]:
> 
> > As per subject, is there any easy way to print attachments such as PDF
> > files?  Hitting 'p' against an attachment just says "I don't know how
> > to print that".  Is there any way to tell mutt how to print it which
> > will also allow printing of plain text as normal.
> > 
> Hi Chris,
> 
> Just pipe the file to 'lpr -P PDF'.  Optionally, add a keybind to do so.
> If you want to get fancy, you can make a shell script which detects the
> mime type, e.g. using `file -ib`, and takes action accordingly.
> 
Of course, obvious really, thank you.

-- 
Chris Green


Is there any way to print attachments such as PDF files?

2021-04-16 Thread Chris Green
As per subject, is there any easy way to print attachments such as PDF
files?  Hitting 'p' against an attachment just says "I don't know how
to print that".  Is there any way to tell mutt how to print it which
will also allow printing of plain text as normal.

-- 
Chris Green


Re: Are there any good maildir manipulation utilities out there?

2021-04-09 Thread Chris Green
On Fri, Apr 09, 2021 at 07:58:12AM +1000, Cameron Simpson wrote:
> On 08Apr2021 08:40, Chris Green  wrote:
> >On Thu, Apr 08, 2021 at 08:43:48AM +1000, Cameron Simpson wrote:
> >> It's also not particularly well suited
> >> to Chris' requirement, which includes preserving the source tree shape
> >> in the archiving process.
> >>
> >Yes, that was just one typical requirement.  The other major
> >requirement is rather different.  I have (for example) lots of
> >messages about orders from Screwfix which are currently spread around
> >in various sub-directories of 'shopping'.  For suppliers like Screwfix
> >from whom I buy a lot of rather mixed up sort of items it now makes
> >sense to me to keep them all in a Screwfix directory.  So the
> >requirement is to find all messages from Screwfix and put them in one
> >directory.
> 
> Note that there's no fundamental reason you can't link the same message 
> into many Maildirs. So link them all into a screwfix folder, and also 
> where they naturally land courtesy of other filing rules.
> 
That's very true, even if I copy the messages and have several copies
of the same message it doesn't really matter all that much.


> Also, didn't you put some work into tagging messages. A search on 
> tag=screwfix might go well.
> 
I don't think that was me.

[snip further useful comments and ideas]

-- 
Chris Green


Re: Is there any way to customise sorting of directories in the index?

2021-04-08 Thread Chris Green
On Thu, Apr 08, 2021 at 11:31:34AM +0100, Chris Green wrote:
> On Thu, Apr 08, 2021 at 11:23:26AM +0100, Chris Green wrote:
> > I have a about 40 or so folders where I save mails I want to keep,
> > with names such as 'shopping', 'motorcycle' and so on.  By default
> > these are sorted alphabetically in the index which is not ideal.  I
> > save things in 'shopping' far more frequently than elsewhere so it
> > would be really handy if that was at the top or at least near the top. 
> > 
> > Is there any way to customise the sort order?  I suppose the ideal
> > would be 'most recently used' at the top but even reverse alphabetical
> > would improve things.
> > 
> > I *could* rename 'shopping' to 'Shopping' to fix that one but I'd
> > really like a more generally applicable solution.
> > 
> Ah, oops, I've just discovered the sort_browser setting which
> addresses this issue to some extent.  However some explanation of the
> settings might be useful:-
> 
> count - does this mean the count of messages in the directory,
> what about if it contains further subdirectories?
> 
> date - date of what?  If it's just the date of the directory it's
> not terribly useful!  
> 
> size - does it work or mean anything with maildir?
> 
> unread - what does this mean?
> 
Sorry, talking to myself here so much!

Anything other than alphabatical sorting is pretty useless with a long
list of directories, especially as it often puts .. somewhere other
than at the top.  If you have many directories at one level (my
top level directory has 32) finding anything in it other than by an
alphabetical sort is painful!  (I tried 'date' to see what it did).

I think my solution of changing shopping to Shopping may be the most
sensible one.

-- 
Chris Green


Re: Are there any good maildir manipulation utilities out there?

2021-04-08 Thread Chris Green
On Thu, Apr 08, 2021 at 09:55:52AM -0400, Dan Ritter wrote:
> Chris Green wrote: 
> > On Thu, Apr 08, 2021 at 08:43:48AM +1000, Cameron Simpson wrote:
> > > On 07Apr2021 18:34, Kurt Hackenberg  wrote:
> > > >On 2021/04/07 18:16, Kurt Hackenberg wrote:
> > > >>On 2021/04/07 17:01, Chris Green wrote:
> > > >>>I'm looking for a tool which will allow me to search through a large
> > > >>>hierarchy of maildir messages and then provide actions to take on the
> > > >>>matched messages.
> 
> ...
> 
> 
> > Yes, that was just one typical requirement.  The other major
> > requirement is rather different.  I have (for example) lots of
> > messages about orders from Screwfix which are currently spread around
> > in various sub-directories of 'shopping'.  For suppliers like Screwfix
> > from whom I buy a lot of rather mixed up sort of items it now makes
> > sense to me to keep them all in a Screwfix directory.  So the
> > requirement is to find all messages from Screwfix and put them in one
> > directory.
> > 
> > 
> > > I suspect Chris may need to roll his own. I'd imagine something like:
> > > 
> > > find message paths using mairix \
> > > | move message files sideways, making sure there's no conflicts
> > > 
> > Yes, I think it may have to be a roll my own something like this.
> > It's just that mairix doesn't provide a very good 'handle' to use.
> 
> Have you added a mairix search => maildir integration in your
> muttrc?
> 
> The Screwfix case would be:
> 
> macro index  "set my_cmd = 
> \`/usr/local/bin/mairixsearch\`push 
> \$my_cmd" "search messages" 
> 
> macro index  "~/results." 
> "display search results" 
> 
> F8 f screwfix
> F9
> # tag or untag or whatever until you've got the right ones
> ;s =screwfix
> 
> Would that work for you?
> 
Yes, on digging a bit further into this using mairix isn't too
difficult:-

Search with mairix producing a maildir full of symbolic links to
the hits.

Move the *target* of the symbolic links to the new directory as
required.

Delete the target of the symbolic links.

Job done!  Since there are already readlink and/or readpath commands
for finding the target of a symbolic link this is rather easy.

-- 
Chris Green


Re: Is there any way to customise sorting of directories in the index?

2021-04-08 Thread Chris Green
On Thu, Apr 08, 2021 at 11:23:26AM +0100, Chris Green wrote:
> I have a about 40 or so folders where I save mails I want to keep,
> with names such as 'shopping', 'motorcycle' and so on.  By default
> these are sorted alphabetically in the index which is not ideal.  I
> save things in 'shopping' far more frequently than elsewhere so it
> would be really handy if that was at the top or at least near the top. 
> 
> Is there any way to customise the sort order?  I suppose the ideal
> would be 'most recently used' at the top but even reverse alphabetical
> would improve things.
> 
> I *could* rename 'shopping' to 'Shopping' to fix that one but I'd
> really like a more generally applicable solution.
> 
Ah, oops, I've just discovered the sort_browser setting which
addresses this issue to some extent.  However some explanation of the
settings might be useful:-

count - does this mean the count of messages in the directory,
what about if it contains further subdirectories?

date - date of what?  If it's just the date of the directory it's
not terribly useful!  

size - does it work or mean anything with maildir?

unread - what does this mean?

-- 
Chris Green


Is there any way to customise sorting of directories in the index?

2021-04-08 Thread Chris Green
I have a about 40 or so folders where I save mails I want to keep,
with names such as 'shopping', 'motorcycle' and so on.  By default
these are sorted alphabetically in the index which is not ideal.  I
save things in 'shopping' far more frequently than elsewhere so it
would be really handy if that was at the top or at least near the top. 

Is there any way to customise the sort order?  I suppose the ideal
would be 'most recently used' at the top but even reverse alphabetical
would improve things.

I *could* rename 'shopping' to 'Shopping' to fix that one but I'd
really like a more generally applicable solution.

-- 
Chris Green


Re: Are there any good maildir manipulation utilities out there?

2021-04-08 Thread Chris Green
On Wed, Apr 07, 2021 at 08:16:32PM -0700, N.J. Thomas wrote:
> * Chris Green  [2021-04-07 22:01:22+0100]:
> > I'm looking for a tool which will allow me to search through a large
> > hierarchy of maildir messages and then provide actions to take on the
> > matched messages.
> 
> You could do this pretty easily with Python, using the mailbox library.
> 
Yes, I guess so.  I already have a Python script (run from .forward)
which routes my incoming messages into appropriate places so I am
a bit familiar with Python's mail handling.

It just seems a pity not to use mairix (or other) to do the searching
bit.

-- 
Chris Green


Re: Are there any good maildir manipulation utilities out there?

2021-04-08 Thread Chris Green
On Thu, Apr 08, 2021 at 08:43:48AM +1000, Cameron Simpson wrote:
> On 07Apr2021 18:34, Kurt Hackenberg  wrote:
> >On 2021/04/07 18:16, Kurt Hackenberg wrote:
> >>On 2021/04/07 17:01, Chris Green wrote:
> >>>I'm looking for a tool which will allow me to search through a large
> >>>hierarchy of maildir messages and then provide actions to take on the
> >>>matched messages.
> >>
> >>
> >>fdm?
> >><https://github.com/nicm/fdm/blob/master/MANUAL>
> >>
> >>Or some other filter-and-deliver program -- but not procmail, 
> >>because it's a zombie, abandoned by its last maintainers, last 
> >>release 20 years ago.
> >
> >
> >Maybe Cameron Simpson's filer, if he publishes it.
> 
> It's got some dependencies on some stuff I need to weed out before it is 
> easy for someone-not-me to use. It's also not particularly well suited 
> to Chris' requirement, which includes preserving the source tree shape 
> in the archiving process.
> 
Yes, that was just one typical requirement.  The other major
requirement is rather different.  I have (for example) lots of
messages about orders from Screwfix which are currently spread around
in various sub-directories of 'shopping'.  For suppliers like Screwfix
from whom I buy a lot of rather mixed up sort of items it now makes
sense to me to keep them all in a Screwfix directory.  So the
requirement is to find all messages from Screwfix and put them in one
directory.


> I suspect Chris may need to roll his own. I'd imagine something like:
> 
> find message paths using mairix \
> | move message files sideways, making sure there's no conflicts
> 
Yes, I think it may have to be a roll my own something like this.
It's just that mairix doesn't provide a very good 'handle' to use.

-- 
Chris Green


Re: Are there any good maildir manipulation utilities out there?

2021-04-08 Thread Chris Green
On Wed, Apr 07, 2021 at 06:16:31PM -0400, Kurt Hackenberg wrote:
> On 2021/04/07 17:01, Chris Green wrote:
> 
> > I'm looking for a tool which will allow me to search through a large
> > hierarchy of maildir messages and then provide actions to take on the
> > matched messages.
> 
> 
> fdm?
> <https://github.com/nicm/fdm/blob/master/MANUAL>
> 
> Or some other filter-and-deliver program -- but not procmail, because it's a
> zombie, abandoned by its last maintainers, last release 20 years ago.

Ah, I maybe wasn't clear, I want to manage E-Mails which have been
delivered already.  All the maildir messages I want to move around are
already in ~/mail as maildirs.  I want to rearrange them.

-- 
Chris Green


Are there any good maildir manipulation utilities out there?

2021-04-07 Thread Chris Green
I'm looking for a tool which will allow me to search through a large
hierarchy of maildir messages and then provide actions to take on the
matched messages.

E.g. I might want to archive all messages older than a certain date
but archive them into a similar hierarchy rather than to just a single
archive directory.

Or I might want to search for all messages from a certain person (or
business) and move them into a single folder.

I already use mairix for searching for messages but it doesn't offer
the actions function I'm after.  

Before I start creating something for myself is there anything out
there which can do this sort of thing?

-- 
Chris Green


Re: Strange error with mairix and a maildir stored by mutt

2021-03-26 Thread Chris Green
On Thu, Mar 25, 2021 at 05:08:58PM -0400, Kurt Hackenberg wrote:
> On 2021/03/25 16:37, Chris Green wrote:
> 
> > Brilliant! :-)  That was it.  I've not seen an error like that before
> > but I guess it must be because of when I did something to that message
> > relative to when the mairix index was built.
> 
> You replied to that message. That's what the R in the filename means. See
> Wikipedia on maildir: <https://en.wikipedia.org/wiki/Maildir>
> 
> Apparently you use mairix on a live set of messages. If so, this will be an
> ongoing problem. You might want to rebuild mairix's index automatically,
> perhaps nightly.

OK, thanks, I hadn't hit this little wrinkle before even though I'd
been using mairix with maildir for several months.

I re-index with mairix randomly when I need to at the moment, I can
easily set up a cron job to run overnight, still won't handle the case
where I'm looking for something I saved the same day (and forgot where
I put it!) but it'll handle most.

Plus, now I know what causes the problem I can simply re-index if I
see it.

-- 
Chris Green


Re: Strange error with mairix and a maildir stored by mutt

2021-03-25 Thread Chris Green
On Thu, Mar 25, 2021 at 03:56:41PM -0400, Kurt Hackenberg wrote:
> On 2021/03/25 14:19, Chris Green wrote:
> 
> > However I'm now getting a rather odd error on one particular message
> > when I search using mairix:-
> > 
> >  chris@esprimo$ mairix 183493
> > stat 
> > '/home/chris/mail/folder/shopping/food/wine/cur/1612869077.1202519_3.esprimo:2,S':
> >  
> No such file or directory 
> >  Matched 2 messages
> >  chris@esprimo$
> > 
> > ... and there's only one mail message stored in mairix's "found"
> > destination.
> > 
> > Looking at /home/chris/mail/folder/shopping/food/wine/cur I see
> > there's a file 1612869077.1202519_3.esprimo:2,RS which should be the
> > one that mairix finds.
> 
> 
> Looks like you replied to that message, which would change the filename from
> :2,S to :2,RS, and you didn't rebuild mairix's index.
> 
> I don't know for sure that mairix's index stores those exact filenames, but
> it might. Try rebuilding the index, and see if that clears it up.

Brilliant! :-)  That was it.  I've not seen an error like that before
but I guess it must be because of when I did something to that message
relative to when the mairix index was built.

Thank you!

-- 
Chris Green


Strange error with mairix and a maildir stored by mutt

2021-03-25 Thread Chris Green
I use maildir with mutt and mairix, I changed from mbox several months
ago.

It has been working reliably for all these months.

However I'm now getting a rather odd error on one particular message
when I search using mairix:-

chris@esprimo$ mairix 183493
stat 
'/home/chris/mail/folder/shopping/food/wine/cur/1612869077.1202519_3.esprimo:2,S':
 No such file or directory
Matched 2 messages
chris@esprimo$ 

... and there's only one mail message stored in mairix's "found"
destination.

Looking at /home/chris/mail/folder/shopping/food/wine/cur I see
there's a file 1612869077.1202519_3.esprimo:2,RS which should be the
one that mairix finds.

So can anyone suggest what's going wrong?  Is it simply a bug in
mairix (in which case I'd better go off and ask in that direction) or
is there something more subtle going on to do with the ,S versus .RS
suffix on the filename?

-- 
Chris Green


Re: almost got Maildir working

2021-03-04 Thread Chris Green
On Thu, Mar 04, 2021 at 11:08:09AM +0100, Orm Finnendahl wrote:
> Am Donnerstag, den 04. März 2021 um 10:03:47 Uhr (+) schrieb Chris Green:
> > You also, of course, need to exit and restart mutt.  Obvious, but I
> > often forget to do this after making changes to .muttrc.
> 
> or, without restarting: ":source ~/.muttrc"
> 
That depends on what the changes are surely.  If you just remove the
setting of something it won't revert to default by itself will it?

-- 
Chris Green


Re: almost got Maildir working

2021-03-04 Thread Chris Green
On Thu, Mar 04, 2021 at 09:55:38AM +0100, Herbert J. Skuhra wrote:
> On Thu, Mar 04, 2021 at 03:13:01AM -0500, Jude DaShiell wrote:
> > Yes, and that had no effect.
> 
> Try to add:
> 
> set spoolfile="~/.Maildir/"
> set mbox_type=Maildir
> 
You also, of course, need to exit and restart mutt.  Obvious, but I
often forget to do this after making changes to .muttrc.

-- 
Chris Green


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Chris Green
On Mon, Feb 15, 2021 at 08:51:35PM +0100, Angel M Alganza wrote:
> On Mon, Feb 15, 2021 at 07:40:58PM +0000, Chris Green wrote:
> 
> > Where does mutt keep these header caches then?
> 
> I have 'set header_cache=~/.mutt/cache/'.
> 
> > I don't have set header_cache set for the good reason that mutt doesn't
> > download mail from anywhere, it's all here on my desktop.
> 
> The cache is for the headers, so that Mutt loads even local maildirs much
> faster.  So, I think even it might not be an issue, everybody might benefit
> from the cache.  Perhaps if you have small maildirs and/or a very powerful
> computer it doesn't make much a difference?
> 
I have (for example) about 6000 messages in my sentmail folder, it
loads in less than a second.  It is a *lot* faster since I installed
an NVME SSD.

-- 
Chris Green


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Chris Green
On Mon, Feb 15, 2021 at 11:17:42AM -0800, Kevin J. McCarthy wrote:
> On Mon, Feb 15, 2021 at 06:03:20PM +0000, Chris Green wrote:
> > Is that mutt's header caches?
> 
> Yes, that's what I meant to say. :)
> 
> > If so I don't tend to leave mutt running all the time, I assume it
> > refreshes things whenever it's started does it?
> 
> Unfortunately, for header caches, "refreshing" doesn't include removing no
> longer existing messages from the cache.  It just means the header cache
> will slowly grow, even though you are trimming the mailbox externally.  Not
> the end of the world, but at a certain point the cache will lose some
> efficiency by sheer size.
> 
Where does mutt keep these header caches then?  

Ah, just a minute, I don't have set header_cache set for the good
reason that mutt doesn't download mail from anywhere, it's all here on
my desktop.  When I read mail remotely I simply ssh to my desktop
machine and run mutt.

So I don't think this is an issue for me.

-- 
Chris Green


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Chris Green
On Mon, Feb 15, 2021 at 09:54:06AM -0800, Kevin J. McCarthy wrote:
> On Mon, Feb 15, 2021 at 04:21:11PM +0000, Chris Green wrote:
> > I currently have the following two lines in my crontab to delete old
> > mails in my junk catching directories, is it OK/safe to do it like
> > this?
> > 
> >20 02 * * * find /home/chris/mail/Ju/*/cur -type f -mtime +7 -exec rm {} 
> > \;
> >30 02 * * * find /home/chris/mail/Ju/*/new -type f -mtime +7 -exec rm {} 
> > \;
> 
> That should be fine.  The only caveat is header caching.  If you delete
> messages outside of mutt, those messages won't be removed from the header
> cache.  Probably not a big deal for "junk catching" folders, but once in a
> while you may want to regenerate your header caches.
> 
Is that mutt's header caches?  If so I don't tend to leave mutt
running all the time, I assume it refreshes things whenever it's
started does it?

-- 
Chris Green (ch...@halon.org.uk)


Re: Deleting old maildir messages, is what I'm doing OK?

2021-02-15 Thread Chris Green
On Mon, Feb 15, 2021 at 05:39:26PM +, Sam Kuper wrote:
> On Mon, Feb 15, 2021 at 04:21:11PM +0000, Chris Green wrote:
> > This isn't specifically mutt but it's definitely to do with managing
> > mail and there's lots of knowledgeable people here.
> > 
> > I currently have the following two lines in my crontab to delete old
> > mails in my junk catching directories, is it OK/safe to do it like
> > this? 
> > 
> > 20 02 * * * find /home/chris/mail/Ju/*/cur -type f -mtime +7 -exec rm 
> > {} \;
> > 30 02 * * * find /home/chris/mail/Ju/*/new -type f -mtime +7 -exec rm 
> > {} \;
> 
> If you have software expecting to be able to read or write to the files
> affected by the above commands, then if that software is not able to
> handle the sudden disappearance of those files, it may throw errors or
> otherwise misbehave.  Software designed to work with Maildirs should
> not have problems, though.
> 
Almost certainly only me using mutt to read them, and that's pretty
unlikely since they're in my junk directory. I might occasionally look
in there to check something but it's very rare, if ever.


> Also, unless I am mistaken, `find ... -exec rm () \;` is not atomic, so
> a race condition exists: `find` could find a matching file, but then
> some other piece of software could delete or rename it before `rm` does.
> 
> (If I am mistaken, someone please correct me!)
> 
Yes, true, but all that will happen is that I'll get an error sent to
me so it's not really a problem.


> Finally, I suppose that to be technically correct, you perhaps ought to
> first move the files from "new" to "cur", and then delete them from
> "cur".  A true mail guru may be able to shed light on this.
> 
I suppose deleting a file sort of counts as reading it.


> IMO, the likelihood is low that any of these issues will bite you.
> 
Yes, thank you, I *thought* this was so but just wanted to make sure I
wasn't doing something very obviously wrong/risky.


It's odd that none of the "maildir works like this" descriptions I
could find had anything about deleting mails.

-- 
Chris Green (ch...@halon.org.uk)


  1   2   3   4   5   6   7   >