git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Interpreting EDITOR/VISUAL environment variables.

From
David Kastrup <dak@gnu.org>
Date
Aug 1, 2007, 13:36 UTC
Message-ID
<86abtbnzpr.fsf@lola.quinscape.zz>

Whatever I have been able to Google, is completely silent on this matter. If anybody has an idea where to find authoritative information, holler.

In the meantime, in the Emacs manual there is the following bit of information:

(info "(emacs) Invoking Emacsclient")
       The option `-a COMMAND' or `--alternate-editor=COMMAND' specifies a
    command to run if `emacsclient' fails to contact Emacs.  This is useful
    when running `emacsclient' in a script.  For example, the following
    setting for the `EDITOR' environment variable will always give you an
    editor, even if no Emacs server is running:
         EDITOR="emacsclient --alternate-editor emacs +%d %s"

That makes it likely that the way to call an editor should be via system. However, there are certainly programs around which will not interpret the +%d and %s thingies. My current setting is

         EDITOR="emacsclient --alternate-editor vi"

and this seems to do the trick with most applications. Not so with git-commit and other git scripts. The easiest way out will be to create something like ~/bin/myemacsclient which does the respective argument splicing. I am just not sure this is the "canonically correct way" of interpreting $EDITOR.

Actually, splicing $EDITOR into a system command is a nuisance because it means having to shell-quote its arguments. So the current interpretation is likely easier to maintain.

Is it the correct one?
-- 
David Kastrup
Next: Junio C Hamano
Message 1 of 16 in “Interpreting EDITOR/VISUAL environment variables.”
  1. David KastrupAug 1, 2007
  2. Junio C HamanoAug 1, 2007
  3. Yann DirsonAug 1, 2007
  4. David KastrupAug 1, 2007
  5. David KastrupAug 1, 2007
  6. Junio C HamanoAug 1, 2007
  7. git-sh-setup.sh: make GIT_EDITOR/core.editor/VISUAL/EDITOR accept commandsDavid Kastrup, Aug 1, 2007
  8. David KastrupAug 1, 2007
  9. git-sh-setup.sh: make GIT_EDITOR/core.editor/VISUAL/EDITOR accept commandsDavid Kastrup, Aug 1, 2007
  10. Junio C HamanoAug 1, 2007
  11. Junio C HamanoAug 1, 2007
  12. David KastrupAug 1, 2007
  13. Junio C HamanoAug 2, 2007
  14. David KastrupAug 1, 2007
  15. Matthias LederhoferAug 2, 2007
  16. David KastrupAug 2, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.