Bash Version: 3.2
Patch Level: 33
Release Status: release
Description:
When I execute edit-and-execute-command realdline command by typing C-xC-e,
it seems that bash always launch emacs whatever the setting of
FCEDIT env variable.
However man bash say the opposite.
Repeat-By:
$ export FCEDIT=vi
$ <C-xC-e>
<emacs is launched>
$ alias emacs=vi
$ <C-xC-e>
<vi si launched>
--
Francis
Good catch. The command executed is actually
fc -e "${VISUAL:-${EDITOR:-emacs}}"
It's the same command for vi and emacs editing modes, though the default
for vi editing mode is `vi' instead of `emacs'. The documentation needs
to be updated, and has for a while, since it's been this way since at
least bash-2.05. Seven years is a long time for this to go unnoticed.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
Chet Ramey, ITS, CWRU ch...@case.edu http://cnswww.cns.cwru.edu/~chet/
hmm why not fixing the command instead ?
VISUAL can be used to visualize a file, so can be set to 'less' for
example. It shouldn't be used if you wand to edit.
I think what is described in the man is fine. And I wanted to
customize FCEDIT to launch emacs in sh-mode, something I can't do with
current command setting.
--
Francis
It's not broken.
> VISUAL can be used to visualize a file, so can be set to 'less' for
> example. It shouldn't be used if you wand to edit.
That isn't the case. In fact, it's exactly the opposite.
The historic use of VISUAL was for the user to set it to his preferred
`visual' (screen-oriented) editor (note the similarity to `vi') while
leaving EDITOR set to, most often, `ed'. It can be set to `less', but
I'm not sure why you'd want to.
These days there's no practical difference between the two.
You might see what `man environ' on your system says. A random Ubuntu
system I have access to reflects the usage as I've described it.
> I think what is described in the man is fine. And I wanted to
> customize FCEDIT to launch emacs in sh-mode, something I can't do with
> current command setting.
I'll consider it as an enhancement request for a future version. You
can, of course, set `VISUAL' to a command that starts emacs in the
desired mode.
Well, if you consider the man page correct, the command is, isn't it ?
>> VISUAL can be used to visualize a file, so can be set to 'less' for
>> example. It shouldn't be used if you wand to edit.
>
> That isn't the case. In fact, it's exactly the opposite.
>
> The historic use of VISUAL was for the user to set it to his preferred
> `visual' (screen-oriented) editor (note the similarity to `vi') while
> leaving EDITOR set to, most often, `ed'. It can be set to `less', but
> I'm not sure why you'd want to.
>
> These days there's no practical difference between the two.
>
> You might see what `man environ' on your system says. A random Ubuntu
> system I have access to reflects the usage as I've described it.
>
Indeed thanks for the clarificaiton.
>> I think what is described in the man is fine. And I wanted to
>> customize FCEDIT to launch emacs in sh-mode, something I can't do with
>> current command setting.
>
> I'll consider it as an enhancement request for a future version. You
Thanks
> can, of course, set `VISUAL' to a command that starts emacs in the
> desired mode.
VISUAL is used by so many others programs where emacs in sh-mode by
default is not the right thing to do.
I think I won't use VISUAL but start emacs in sh-mode if the file name
argument matches "*bash-fc-*" pattern. It should be safe.
Could you point out the source code where the command you showed is
located ?
thanks
--
Francis
On Sat, 23 Aug 2008, Francis Moreau wrote:
> I think I won't use VISUAL but start emacs in sh-mode if the file name
> argument matches "*bash-fc-*" pattern. It should be safe.
>
adding the following in your .emacs should do the trick:
(add-to-list 'auto-mode-alist '("^/tmp/bash-fc" . sh-mode))
yep that's finally what I did.
--
Francis