Hi Johannes,

* Johannes Weißl on Tuesday, November 30, 2010 at 15:18:10 +0100
> Yes, I think Jostein has a setup where he opens one mutt for each
> mailbox in advance! I tried to check in screen if a window exists and
> if not start mutt, but I couldn't find out how that is possible...

But don't you have the logic in place already:

$SCREEN "${screen_op...@]}" -p "$screen_window_name" -X eval "select 
'$screen_window_name'" "stuff \"$jump_cmd\""
if [ $? != 0 ] ; then
    # instead of dying:
    # 1) check $STY
    # 2) check screen -ls
    # if ok; then screen -X ...
    # else launch term or die
fi

But I probably still haven't understood Jostein's setup ;-)

> I renamed MUTT_USE_SCREEN to MUTTJUMP_MULTI_SCREEN_MODE for clarity.

Great.

> Ok, I uploaded a new version which uses $STY. The setting
> MUTT_USE_SCREEN can be "yes", "no" or "auto". If is is "auto",
> screen is only used when $STY is set. If it is "yes", screen is always
> used (a new screen session might be started), and with "no", the
> terminal hack is always applied.
> 
> How do you like it?

Perfect. For me at least, hehe.

>> P.S. wrt is_callable: if you do not use the full path, you don't
>> need the -p option for type.
> 
> I used it as a way to silence stderr. But maybe it would be cleaner to
> just use `type $1 >/dev/null 2>&1`.

Or use the full executable path:

MUTT=`type -p mutt`
if [ -z "$MUTT" ]; then
    die "$MUTT is not in PATH, set MUTT variable"
fi

While we are at it:

diff --git a/muttjump b/muttjump
index cb7e4fb..f2b7ec7 100755
--- a/muttjump
+++ b/muttjump
@@ -40,7 +40,7 @@ MUTTJUMP_MULTI_SCREEN_MODE=${MUTTJUMP_MULTI_SCREEN_MODE:-no}
 MUTTJUMP_SCREEN_SESSION=${MUTTJUMP_SCREEN_SESSION:-}
 
 # function to create the screen window name from the full path of the mailbox
-if ! type MUTTJUMP_SCREEN_WINDOW_NAME_MANGLE >/dev/null 2>&1 ; then
+if ! type $MUTTJUMP_SCREEN_WINDOW_NAME_MANGLE >/dev/null 2>&1 ; then
     function MUTTJUMP_SCREEN_WINDOW_NAME_MANGLE () {
         basename "$1"
     }


...

btw: Does the <enter><enter> in the Mutt macro work for you? For
me the second one seems to have no effect.

c
-- 
\black\trash movie           _COWBOY  CANOE  COMA_
            Ein deutscher Western/A German Western

--->> http://www.blacktrash.org/underdogma/ccc.php

Reply via email to