Re: Multi-window Mutt

2011-07-26 Thread Cameron Simpson
On 24Jul2011 18:57, Marcelo Luiz de Laia marcelol...@gmail.com wrote:
| On Mon, 18 Jul 2011, Cameron Simpson wrote:
|  On 17Jul2011 11:24, Marcelo Luiz de Laia marcelol...@gmail.com wrote:
|  | I am looking for a way to spawn new windows for reading and writing
|  | e-mails with a mere click using mutt in X environment.
| (...)
|  It would be pretty easy to adapt it to spawn a new terminal window 
containing
|  the screen session I would think. I could put some effort into that if you
|  have trouble.
| 
| I have started to test your script. However, I am unsure how I set
| this variables: $EDITOR ('set editor=$EDITOR').
| 
| How I set it?

Ah, the script presumed this was already set to your preferred terminal
mode editor. I've updated the script to default to vi if $EDITOR isn't
present.

| Another issue: I have 3 profile. So, in this script I have only one
| seted (mutt -F $HOME/rc/mail/mutt). Is this?

Argh. That is a gratuitous Cameron-ism. I've removed it from the script
too; it now just says mutt, no -F option.

My apologies for the unportableness and thanks for the bug report.

You can refetch the updated script from:

  http://www.cskk.ezoshosting.com/cs/css/bin/muttedit

Please let me know if it behaves better for you.

Cheers,
-- 
Cameron Simpson c...@zip.com.au DoD#743
http://www.cskk.ezoshosting.com/cs/

The ship is cold -- and damp.  I complain -- but no one listens.
- Capt. Kirk, Star Trek XXIII: _So Very Tired_
  Jim Hill jimh...@uxh.cso.uiuc.edu


Re: Multi-window Mutt

2011-07-26 Thread Marcelo Luiz de Laia
On Tue, 26 Jul 2011, Cameron Simpson wrote:

 I've updated the script to default to vi if $EDITOR isn't
 present.

Yeah It worked fine! I have set it to emacs -nw and got it work
well.

But, I have a little troubles:

1. there are two signature in each message

my muttrc section:

unhook send-hook
send-hook . source ~/.mutt/profile.gmail\n
send-hook
^(offlineimap-proj...@lists.alioth.debian.org|mutt-users@mutt.org)
'set mime_forward signature=~/.mutt/sig.list')

2. If I was composing a message and press ctrl+a and d, I could
dettach and return to mutt (pager|index), but I don't could attach the
screen to compose again. If I press ctrl+a in mutt, it do other
things. I think that this is a issue from screen versus mutt
commands. I started here [1], but no progress.

1. http://www.rackaid.com/resources/linux-screen-tutorial-and-how-to/

 Argh. That is a gratuitous Cameron-ism. I've removed it from the script
 too; it now just says mutt, no -F option.
 
 My apologies for the unportableness and thanks for the bug report.

Don't worries! Your script is very nice!

Thank you very much!

-- 
Marcelo
Brazil
Linux user number 487797


Re: Multi-window Mutt

2011-07-26 Thread Cameron Simpson
On 26Jul2011 17:54, Marcelo Luiz de Laia marcelol...@gmail.com wrote:
| On Tue, 26 Jul 2011, Cameron Simpson wrote:
|  I've updated the script to default to vi if $EDITOR isn't
|  present.
| 
| Yeah It worked fine! I have set it to emacs -nw and got it work
| well.

Cool. (I presume you've set EDITOR in your shell environment, not the
muttedit script - the idea is that it will know its default from your
environment, not that it should need modification by every user who uses
it).

| But, I have a little troubles:
| 1. there are two signature in each message
| 
| my muttrc section:
| 
| unhook send-hook
| send-hook . source ~/.mutt/profile.gmail\n
| send-hook
| ^(offlineimap-proj...@lists.alioth.debian.org|mutt-users@mutt.org)
| 'set mime_forward signature=~/.mutt/sig.list')

Odd. The mutt invocation in muttedit actually turns off the signature
because it should have been applied when the compose mode was first
entered, just before muttedit itself was invoked by mutt.

Maybe muttedit needs to turn off mime_forward as well?

| 2. If I was composing a message and press ctrl+a and d, I could
| dettach and return to mutt (pager|index), but I don't could attach the
| screen to compose again. If I press ctrl+a in mutt, it do other
| things. I think that this is a issue from screen versus mutt
| commands. I started here [1], but no progress.
| 
| 1. http://www.rackaid.com/resources/linux-screen-tutorial-and-how-to/

You are expected to reattach from elsewhere (although i guess one could
map a special key in mutt). As you notice, when you detach you have left
screen. From another window you can reattach to resume editing.
The command:

  screen -ls

should show your editing session with a nice title.

Thoughts?
-- 
Cameron Simpson c...@zip.com.au DoD#743
http://www.cskk.ezoshosting.com/cs/

This morning I was writing an article containing some Perl.  My daughter Heidi
wandered in and said, What is that gobbledygook?  It looks like swearing.

Out of the mouths of babes...- Larry Wall, lw...@netlabs.com


Re: Multi-window Mutt

2011-07-26 Thread Marcelo Luiz de Laia
On Wed, 27 Jul 2011, Cameron Simpson wrote:

 (I presume you've set EDITOR in your shell environment

No. I have been set it in muttedit script. After you tell me, I test
it and got no success!

If I set it to : ${EDITOR=vi}, I got this:

(... there are somethings upper here that I don't see on the window)
E319: Sorry, the command is not available in this version: function!
MapToggle(key, opt)
line  216:
E319: Sorry, the command is not available in this version:   let cmd =
':set '.a:opt.'! \| set '.a:opt.?\CR
line  217:
E319: Sorry, the command is not available in this version:   exec
'nnoremap '.a:key.' '.cmd
line  218:
E319: Sorry, the command is not available in this version:   exec
'inoremap '.a:key. \C-O.cmd
line  219:
E319: Sorry, the command is not available in this version: endfunction
line  221:
E319: Sorry, the command is not available in this version: command!
-nargs=+ MapToggle call MapToggle(f-args)
line  223:
E492: Not an editor command: MapToggle F4 foldenable
line  224:
E492: Not an editor command: MapToggle F5 number
line  225:
E492: Not an editor command: MapToggle F6 spell
line  226:
E492: Not an editor command: MapToggle F7 paste
line  227:
E492: Not an editor command: MapToggle F8 hlsearch
line  228:
E492: Not an editor command: MapToggle F9 wrap
Press ENTER or type command to continue
E319: Sorry, the command is not available in this version: function!
MapToggle(key, opt)
line  216:
E319: Sorry, the command is not available in this version:   let cmd =
':set '.a:opt.'! \| set '.a:opt.?\CR
line  217:
E319: Sorry, the command is not available in this version:   exec
'nnoremap '.a:key.' '.cmd
line  218:
E319: Sorry, the command is not available in this version:   exec
'inoremap '.a:key. \C-O.cmd
line  219:
E319: Sorry, the command is not available in this version: endfunction
line  221:
E319: Sorry, the command is not available in this version: command!
-nargs=+ MapToggle call MapToggle(f-args)
line  223:
E492: Not an editor command: MapToggle F4 foldenable
line  224:
E492: Not an editor command: MapToggle F5 number
line  225:
E492: Not an editor command: MapToggle F6 spell
line  226:
E492: Not an editor command: MapToggle F7 paste
line  227:
E492: Not an editor command: MapToggle F8 hlsearch
line  228:
E492: Not an editor command: MapToggle F9 wrap
Press ENTER or type command to continue
E319: Sorry, the command is not available in this version: function!
MapToggle(key, opt)
line  216:
E319: Sorry, the command is not available in this version:   let cmd =
':set '.a:opt.'! \| set '.a:opt.?\CR
line  217:
E319: Sorry, the command is not available in this version:   exec
'nnoremap '.a:key.' '.cmd
line  218:
E319: Sorry, the command is not available in this version:   exec
'inoremap '.a:key. \C-O.cmd
line  219:
E319: Sorry, the command is not available in this version: endfunction
line  221:
E319: Sorry, the command is not available in this version: command!
-nargs=+ MapToggle call MapToggle(f-args)
line  223:
E492: Not an editor command: MapToggle F4 foldenable
line  224:
E492: Not an editor command: MapToggle F5 number
line  225:
E492: Not an editor command: MapToggle F6 spell
line  226:
E492: Not an editor command: MapToggle F7 paste
line  227:
E492: Not an editor command: MapToggle F8 hlsearch
line  228:
E492: Not an editor command: MapToggle F9 wrap
Press ENTER or type command to continue

If I comment the : ${EDITOR=vi}, like this #:${EDITOR=vi}, I got an
editor that tell me to end the message with a dot (.) in a blank
line

If I set the : ${EDITOR=emacs -nw}, it work well. The only issue is
the signature duplicated on the bottom.

My environment EDITOR is:

:~$ update-alternatives --config editor
Existem 5 escolhas para a alternativa editor (disponibiliza
/usr/bin/editor).

  Selecção   CaminhoPrioridade Estado

  0/bin/nano   40modo automático
  1/bin/ed-100   modo manual
  2/bin/nano   40modo manual
  3/usr/bin/dtemacs0 modo manual
* 4/usr/bin/emacs220 modo manual
  5/usr/bin/vim.tiny   10modo manual

Pressione enter para manter a escolha actual[*], ou digite o número da
selecção: 

Cheers

-- 
Marcelo
Brazil
Linux user number 487797


Re: Multi-window Mutt

2011-07-26 Thread Cameron Simpson
On 26Jul2011 22:09, Marcelo Luiz de Laia marcelol...@gmail.com wrote:
| On Wed, 27 Jul 2011, Cameron Simpson wrote:
|  (I presume you've set EDITOR in your shell environment
| 
| No. I have been set it in muttedit script. After you tell me, I test
| it and got no success!
[...]
| line  227:
| E492: Not an editor command: MapToggle F8 hlsearch
| line  228:
| E492: Not an editor command: MapToggle F9 wrap
| Press ENTER or type command to continue

That looks like q bunch of vim configuration stuff or something.
Probably you have vim-specific stuff in vi's configuration files and vi
isn't supporting those commands. But you're an emacs user, so let us not
waste time on that. Instead, we need to set you up so that muttedit runs
emacs for you.

In the muttedit script this line:

  : ${EDITOR:=vi}

is a slightly magic piece of shell to set the environment variable $EDITOR
to vi _if_ $EDITOR is not already present in your environment. The
idea is that an emacs user such as yourself will have:

  EDITOR='emacs -nw'

in your login shell environment already, and muttedit will quietly accept
that as your preference and use it.

What is your shell? In the examples below I will presume it is bash. If
not, say otherwise and we will adapt.

When you login (or, if you're using a GUI login, with luck when you open
a terminal window, such as to run mutt) the shell should be running its
own initialisation file. bash's login initialisation file is the file
~/.bash_profile and you would place at the bottom of it a line like
this:

  export EDITOR='emacs -nw'

This will sett the environment variable $EDITOR to your preferred
terminal mode editor. muttedit will then use it. You'll need to open a
new terminal window to see the effect. Type:

  echo $EDITOR

to the shell to check the value.

| My environment EDITOR is:
| :~$ update-alternatives --config editor
| Existem 5 escolhas para a alternativa editor (disponibiliza
| /usr/bin/editor).
| 
|   Selecção   CaminhoPrioridade Estado
| 
|   0/bin/nano   40modo automático
|   1/bin/ed-100   modo manual
|   2/bin/nano   40modo manual
|   3/usr/bin/dtemacs0 modo manual
| * 4/usr/bin/emacs220 modo manual
|   5/usr/bin/vim.tiny   10modo manual

Ok, I gather you're running a Ubuntu system in Portuguese. The
command you're running there chooses the edit invoked by the command
/usr/bin/editor, which is intended as a placeholder command so
system scripts can invoke something without making an editor decision
themselves. However, it has two issues.

First, it doesn't affect anything using the wider convention of
honouring $EDITOR to suggest the caller's editor.

Second, while you may be the only user of your Ubuntu system, setting
the systemwide isn't really an appropriate thing to do; set it in you
own environment. That way if you share the system you haven't imposed on
someone else and also if you copy you account to another system you get
to take your $EDITOR preference with you!

Please try setting $EDITOR in your .bash_profile and see if it works
with the unchanged muttedit script.

| The only issue is
| the signature duplicated on the bottom.

I think for this you need tweak your .muttrc - not sure how yet. When
are send-hooks applied? Do you see two signatures in the file that gets
edited, or in the email after it is sent?

Cheers,
-- 
Cameron Simpson c...@zip.com.au DoD#743
http://www.cskk.ezoshosting.com/cs/

Yes, sometimes Perl looks like line-noise to the uninitiated, but to the
seasoned Perl programmer, it looks like checksummed line-noise with a mission
in life.- The Llama Book


Re: Multi-window Mutt

2011-07-24 Thread Marcelo Luiz de Laia
On Mon, 18 Jul 2011, Cameron Simpson wrote:

 On 17Jul2011 11:24, Marcelo Luiz de Laia marcelol...@gmail.com wrote:
 | I am looking for a way to spawn new windows for reading and writing
 | e-mails with a mere click using mutt in X environment.
(...)
 It would be pretty easy to adapt it to spawn a new terminal window containing
 the screen session I would think. I could put some effort into that if you
 have trouble.

Hi Cameron,

I have started to test your script. However, I am unsure how I set
this variables: $EDITOR ('set editor=$EDITOR').

How I set it?

Another issue: I have 3 profile. So, in this script I have only one
seted (mutt -F $HOME/rc/mail/mutt). Is this?

Thank you very much!

Marcelo




Re: Multi-window Mutt

2011-07-18 Thread Jostein Berntsen
On 18.07.11,11:01, Cameron Simpson wrote:
 On 17Jul2011 11:24, Marcelo Luiz de Laia marcelol...@gmail.com wrote:
 | I am looking for a way to spawn new windows for reading and writing
 | e-mails with a mere click using mutt in X environment.
 | 
 | I have googled and found this solution
 | http://op-co.de/blog/posts/mulit-window_mutt/ and this question
 | (without answer) http://marc.info/?l=mutt-usersm=114347881514912
 | 
 | This thread was very usefull, too
 | http://www.mail-archive.com/screen-users@gnu.org/msg00566.html
 | 
 | But, I ask you:
 | 
 | Have you any suggestion/tips here?
 
 I spawn detachable screen sessions for mutt email replies. Details here:
 
  http://www.mail-archive.com/mutt-users@mutt.org/msg40856.html
 
 It would be pretty easy to adapt it to spawn a new terminal window containing
 the screen session I would think. I could put some effort into that if you
 have trouble.
 
 The above scheme has the advantage that one can detach from the screen
 session before completing the reply and reattach later. By spawning a
 terminal window you could get that (reply session survives window close)
 and immediate return to your mutt reading (because the reply is off in
 another window).
 
 Let me know if you'd like me to suggest modifications to the existing
 scripts I use.
 

This looks like a nice way to use screen with mutt for these functionality. Will
check out this.


Jostein




Multi-window Mutt

2011-07-17 Thread Marcelo Luiz de Laia
Hi,

I am looking for a way to spawn new windows for reading and writing
e-mails with a mere click using mutt in X environment.

I have googled and found this solution
http://op-co.de/blog/posts/mulit-window_mutt/ and this question
(without answer) http://marc.info/?l=mutt-usersm=114347881514912

This thread was very usefull, too
http://www.mail-archive.com/screen-users@gnu.org/msg00566.html

But, I ask you:

Have you any suggestion/tips here?

Thank you very much!

Marcelo


Re: Multi-window Mutt

2011-07-17 Thread Cameron Simpson
On 17Jul2011 11:24, Marcelo Luiz de Laia marcelol...@gmail.com wrote:
| I am looking for a way to spawn new windows for reading and writing
| e-mails with a mere click using mutt in X environment.
| 
| I have googled and found this solution
| http://op-co.de/blog/posts/mulit-window_mutt/ and this question
| (without answer) http://marc.info/?l=mutt-usersm=114347881514912
| 
| This thread was very usefull, too
| http://www.mail-archive.com/screen-users@gnu.org/msg00566.html
| 
| But, I ask you:
| 
| Have you any suggestion/tips here?

I spawn detachable screen sessions for mutt email replies. Details here:

 http://www.mail-archive.com/mutt-users@mutt.org/msg40856.html

It would be pretty easy to adapt it to spawn a new terminal window containing
the screen session I would think. I could put some effort into that if you
have trouble.

The above scheme has the advantage that one can detach from the screen
session before completing the reply and reattach later. By spawning a
terminal window you could get that (reply session survives window close)
and immediate return to your mutt reading (because the reply is off in
another window).

Let me know if you'd like me to suggest modifications to the existing
scripts I use.

Cheers,
-- 
Cameron Simpson c...@zip.com.au DoD#743
http://www.cskk.ezoshosting.com/cs/

Never attribute to malice that which can be attributed to stupidity.
- Hanlon's Razor