Re: My print command cannot use "read -p"

2016-04-21 Thread Jon LaBadie
On Thu, Apr 21, 2016 at 10:00:08PM -0700, David Champion wrote:
> * On 21 Apr 2016, Xu Wang wrote: 
> > Hi,
> > 
> > I would like to have a print command that takes input from the user.
> > But mutt pipes the message to the print command so I guess I cannot
> > use something like
> > read -p "where to save?" filename
> > 
> > because read looks on STDIN and mutt already piped to STDIN.
> 
> You've analyzed it right. Solution: read  
>   #!/bin/bash
>   ## WARNING UNCHECKED INPUT
>   ## JUST A PROOF OF CONCEPT
>   read -p 'Save to: ' fncat >"$fn"

Unless it has changed recently, bash runs redirected read
commands in a sub-process.  Thus the variable fn would not
get set in the main process.

jl
-- 
Jon H. LaBadie j...@jgcomp.com
 11226 South Shore Rd.  (703) 787-0688 (H)
 Reston, VA  20190  (703) 935-6720 (C)


Re: My print command cannot use "read -p"

2016-04-21 Thread David Champion
* On 21 Apr 2016, Xu Wang wrote: 
> Hi,
> 
> I would like to have a print command that takes input from the user.
> But mutt pipes the message to the print command so I guess I cannot
> use something like
> read -p "where to save?" filename
> 
> because read looks on STDIN and mutt already piped to STDIN.

You've analyzed it right. Solution: read "$fn"

-- 
David Champion • d...@bikeshed.us


Re: My print command cannot use "read -p"

2016-04-21 Thread Jon LaBadie
On Fri, Apr 22, 2016 at 12:47:45AM -0400, Xu Wang wrote:
> Hi,
> 
> I would like to have a print command that takes input from the user.
> But mutt pipes the message to the print command so I guess I cannot
> use something like
> read -p "where to save?" filename
> 
> because read looks on STDIN and mutt already piped to STDIN.
> 
> I am using bash.
> 
> Any idea?
> 

exec 22< /dev/tty

read -u 22 -p "where to save" filename


-- 
Jon H. LaBadie j...@jgcomp.com
 11226 South Shore Rd.  (703) 787-0688 (H)
 Reston, VA  20190  (703) 935-6720 (C)


My print command cannot use "read -p"

2016-04-21 Thread Xu Wang
Hi,

I would like to have a print command that takes input from the user.
But mutt pipes the message to the print command so I guess I cannot
use something like
read -p "where to save?" filename

because read looks on STDIN and mutt already piped to STDIN.

I am using bash.

Any idea?

Kind regards,

Xu


Re: Show output (and place for extra input) from sendmail command

2016-04-21 Thread Xu Wang
On Wed, Apr 20, 2016 at 6:03 AM,   wrote:
> On 19Apr2016 20:30, Xu Wang  wrote:
>>
>> I use a custom sendmail command. I would like to have my script (that
>> I set to 'sendmail' muttrc variable) ask some questions from to the
>> user and also give feedback to the user directly. But mutt does not
>> run the process in the foreground so it seems impossible.
>>
>> Is there an approach?
>
>
> Could it pop up a separate terminal window to run the commands? For example,
> untested, make your $sendmail setting point at a shell script like this:
>
>  #!/bin/sh
>  set -ue
>  tmpf=${TMPDIR:-/tmp}/sendmail.$$
>  cat >"$tmpf"
>  xterm -e script-to-ask-questions-and-then-send.sh "$tmpf"
>  rm "$tmpf"
>
> You see we pass in the temp file to your ask-questions-and-send script so it
> can feed the message to sendmail (or whatever), and then remove it after
> xterm returns (which will be after your innner script has finished).
>
> Just one idea.
>
> Cheers,
> Cameron Simpson 

Thank you for this idea.

It is a possibility. However I would like to use mutt through ssh. I
think thus I cannot do this.

Thank you for your time!

Kind regards,

Xu


Re: Do not spellcheck quoted parts of email

2016-04-21 Thread Xu Wang
On Wed, Apr 20, 2016 at 4:55 PM, Mike K.  wrote:
> * Xu Wang wrote on 2016-02-20 05:56 +:
>>>
>>> I use aspell (`aspell -e -d it -c`) and it ignores quoted parts.
>>
>>
>> Thank you for your helps. I now use what follows:
>> set ispell='aspell -e -c'
>
>
> Thanks very much for this --- worked a treat for me too!

The only issue I have with this is that it spellchecks the part
"Xu Wang wrote on 2016-02-20 05:56 +"
which I would prefer not to spellcheck, because many names seem as
misspelled words.

Kind regards,

Xu


Re: Mark threads as read for the future

2016-04-21 Thread Andreas Doll
On 2016-04-14 at 18:15, Francesco Ariis wrote:
> I wrote a small folder-hook pattern which accomplishes a similar task
> (deletes instead 'mark as read') [1]. I suspect it can be modified to
> suit your needs (tag-pattern + tag-prefix maybe?).
> Fire again if you need help
> [1] http://ariis.it/static/articles/mutt-ml/page.html

Thanks! 
Your deleting approach is even better than marking them as read, because I
like my inboxes as empty as possible. No need to keep uninteresting threads in
my mailing list inboxes ...


Best regards,
Andreas