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

Re: Interpreting EDITOR/VISUAL environment variables.

From
David Kastrup <dak@gnu.org>
Date
Aug 2, 2007, 10:31 UTC
Message-ID
<86fy32kz2a.fsf@lola.quinscape.zz>
In-Reply-To
<20070802101056.GA31182@moooo.ath.cx>
Matthias Lederhofer <matled@gmx.net> writes:
Show 5 quoted lines
> David Kastrup <dak@gnu.org> wrote:
>> a) Using system and shell-quoting the filename.  Advantage: one can
>> set EDITOR='"/home/dak/My Programs/editor"' and have it work.
>> Disadvantage: shell-quoting a file name seems shell- and
>> system-dependent.

Actually I was talking C here, and the editor is never called from C in git but rather from the shell. So this problem is a non-problem for us.

Show 6 quoted lines
> What about this instead of quoting the argument?
>
>     sh -c '$EDITOR "$1" "$2"' editor +5 /path/to/file
>
> (i.e. for C execvp("/bin/sh", "-c", "$EDITOR \"$1\" \"$2\"", "editor",
>     "+5", "/path/to/file"))

It suffers from the fault that it does not work as far as I can see. -c does not set the positional parameters.

-- 
David Kastrup
Previous: Matthias Lederhofer
Message 16 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.