Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

running command different ways produces different results

7 views
Skip to first unread message

Haines Brown

unread,
Mar 7, 2013, 10:09:48 AM3/7/13
to
I have a ~/.emacs-utility initialization file for running emacs, but when
called in different ways it produces different results.

More specifically I have an executable script with the line:

emacs -q -l /home/haines/.emacs-utility /tmp/file

If I run that line in a terminal, emacs opens /tmp/file in Text mode,
which is what I want.

However, if I call this script by means of a shortcut defined in
~/fluxbox/keys:

Control Mod1 e :ExecCommand emacs-utility &

The file /tmp/file is not opened, and instead I get a scratch buffer in
Lisp mode.

What am I missing?

J G Miller

unread,
Mar 7, 2013, 10:36:05 AM3/7/13
to
Missing? Hmmm... ???? ;) ;) ;)

It may be that fluxbox has a parsing bug. I vaguely or possibly incorrectly
am misremembering something with icewem that did not work properly when
a bare "-" was used in one of the configuration files.

So could you do two tests please?

1) copy your exectutable script "emacs-utility" to "myscript"
The name is not important, just that it must not contain "-"
or possibly underscore

2) In your keys file, add another definition

Control Mod1 f :ExecCommand myscript &

or any other lettter that is not being used, perhaps t for test

and also change your "e" key definition to

Control Mod1 e :ExecCommand "emacs-utility" &

Then restart fluxbox, and try <CTL><MOD1><e> and <CTL><MOD1><f>
and see if now the script is being executed to start emacs with /tmp/file buffer

Also, I do hope that you have your exectuable script located in the
${PATH} that fluxbox is using, otherwise the executable script will
never be executed by fluxbox.

If the "e" key sequence now works okay because of the added quotes,
you can then delete myscript and the "f" key sequence definition.

If the "e" key sequence does not work, but the "f" key does, then
you will just have to name your script without the "-" character.

If neither work, then probably you have not put your executable script
on the ${PATH} that fluxbox is using, and you need to specify the
full path in the key definition.

The fact that the thing being executed is a shell script is not a problem,
because fluxbox can just fire up shell scripts directly without a reference
to /bin/sh, because I have

Mod1 x :ExecCommand ${SH}/xt

where xt is a Bourne shell script and that has always worked without
problem, even ${SH} being an environmental variable defined as
/usr/local/share/sh [ xt fires up an X terminal emulator
according to what is available in preferential order urxvt, rxvt,
xterm with appropriate command line flags including title shewing
user@host and path.]

Haines Brown

unread,
Mar 7, 2013, 1:34:16 PM3/7/13
to
It seems you spotted my problem, which was that the script being called
with a fluxbox key was not in fluxbox's path. I did a temporary fix by
supplying the full path to the script in fluxbox keys file. I added a
PATH= to the scripts in my ~/.profile, but don't know if that will do
the job, for I can't afford to shut things down at present because of
work.

Haines

Alastair Black

unread,
Mar 7, 2013, 4:34:04 PM3/7/13
to
--- minus ---

> Control Mod1 e :ExecCommand emacs-utility &

--- equals ---

emacs <--- this (the named executable) is missing!
/tmp/file <--- this (the target) file name is missing!

Don't you want to call your 'script' (whatever its name is) from
fluxbox?

Alastair

Haines Brown

unread,
Mar 8, 2013, 6:19:05 AM3/8/13
to
Alastair Black <abqab...@example.net> writes:

> On 03/07/2013 08:09 AM, Haines Brown wrote:
>> I have a ~/.emacs-utility initialization file for running emacs, but when
>> called in different ways it produces different results.

>> What am I missing?
>
>> emacs -q -l /home/haines/.emacs-utility /tmp/file
>
> --- minus ---
>
>> Control Mod1 e :ExecCommand emacs-utility &
>
> --- equals ---
>
> emacs <--- this (the named executable) is missing!
> /tmp/file <--- this (the target) file name is missing!

I fear I did not adquately explain the situation. "emacs-utility" is an
executable script called by the fluxbox key "e". It is the script that
calls emacs and uses ".emacs-utility" for its intitialization file.

There does not exist a file named "/tmp/file". When I run emacs-utility
script it is created, but when I save it to another name, it disappears
and so emacs-utility always starts with a blank slate. It functions like
the scratch buffer but instead starts in Text Fill mode rather than lisp.

> Don't you want to call your 'script' (whatever its name is) from
> fluxbox?

I suppose I could have done:

Control Mod1 e :ExecCommand emacs -q -l .emacs-utility /tmp/file &

but I'm in the habit of assembling executable scripts in one handy
place, and also I can modify them without having to restart fluxbox for
scripts called by fluxbox keys.

My original problem turned out to be that my scripts were not in my PATH
(for some reason this had not been a problem until I renamed the
script), and so I've added the path in ~/.profile, where I also define
paths for LaTeX. Maybe a fluxbox update changed things and it has been a
while since I restarted fluxbox. This may also be the reason why this
key:

Control Mod1 r :Restart &

now crashes my X server (does not do it if I restart fluxbox from menu).

Haines

J G Miller

unread,
Mar 8, 2013, 7:20:52 AM3/8/13
to
On Friday, March 8th, 2013, at 06:19:05h -0500, Haines Brown suggested:

> I suppose I could have done:
>
> Control Mod1 e :ExecCommand emacs -q -l .emacs-utility /tmp/file &

You could have, but what you did, keeping all the parameter together
in the executable script file was the *better* solution.

A few window managers do have problems parsing their configuration files
and execing commands more than just the name of the executable.

> but I'm in the habit of assembling executable scripts in one handy
> place, and also I can modify them without having to restart fluxbox for
> scripts called by fluxbox keys.

Exactly. A practice to be commended and recommended to others.

>
> Control Mod1 r :Restart &
>
> now crashes my X server (does not do it if I restart fluxbox from menu).

A couple of important points to note --

1) Restart is an internal command to fluxbox -- so I assume you are not
using an external shell script with the same name

2) A quick check of my Fluxbox keys script has something almost the same

Mod1 r :Restart

Note that there is no "&"

In fact none of the entries in my keys file have a trailing ampersand
even for external programs, just as I showed in my posting yesterday

Mod1 x :ExecCommand ${SH}/xt

The manual page for fluxbox-keys also shews something similar

Mod1 x :ExecCommand $TERM

and makes no mention of using a trailing & on any key action commands.

I therefore recommend that you *remove* all trailing & from your
fluxbox key definitions, which is probably why the Mod1 r is
causing fluxbox to stop but not restart and the X11 server to exit.

Incidentally some older window managers (twm, ctwm, mwm, fvwm) do need
the trailing & in their configuration files to exec and fork a command,
so this may be why you have possibly erroneously adopted the same style
for the fluxbox key definitions.
0 new messages