From 4275d352a8f588468b88e6719325de753d12ed62 Mon Sep 17 00:00:00 2001 From: Célestin Matte Date: Sat, 26 Apr 2014 17:53:18 +0200 Subject: Fix bugs when $EDITOR="emacs -nw" This patch fixes 2 problems at once in the default config, which prevent one from editing files when his $EDITOR variable is set to "emacs -nw": - $EDITOR variables consisting of "program name + options" are not handled correctly because of quotes around $EDITOR. As a result, if $EDITOR is not a simple program name (i.e. if it includes options, as in "emacs -nw"), the full string is taken as a program and fails to run. Error message: (/bin/sh: 1: emacs -nw: not found) Removing quotes fixes this problem. - emacs does not seems to handle the "--" correctly: it does not open any file when it is there. I don't know why it is there, but removing it does not prevent other editors (vim, nano) to run correctly, and makes emacs work. --- ranger/config/rifle.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ranger/config/rifle.conf b/ranger/config/rifle.conf index 364d7c28..1eaff9b8 100644 --- a/ranger/config/rifle.conf +++ b/ranger/config/rifle.conf @@ -79,9 +79,9 @@ ext x?html?, has w3m, terminal = w3m "$@" # Misc #------------------------------------------- # Define the "editor" for text files as first action -mime ^text, label editor = "$EDITOR" -- "$@" +mime ^text, label editor = $EDITOR "$@" mime ^text, label pager = "$PAGER" -- "$@" -!mime ^text, label editor, ext xml|csv|tex|py|pl|rb|sh|php = "$EDITOR" -- "$@" +!mime ^text, label editor, ext xml|csv|tex|py|pl|rb|sh|php = $EDITOR "$@" !mime ^text, label pager, ext xml|csv|tex|py|pl|rb|sh|php = "$PAGER" -- "$@" ext 1 = man "$1" @@ -184,5 +184,5 @@ label wallpaper, number 14, mime ^image, X = feh --bg-fill "$1" # Define the editor for non-text files + pager as last action !mime ^text, !ext xml|csv|tex|py|pl|rb|sh|php = ask -label editor, !mime ^text, !ext xml|csv|tex|py|pl|rb|sh|php = "$EDITOR" -- "$@" +label editor, !mime ^text, !ext xml|csv|tex|py|pl|rb|sh|php = $EDITOR "$@" label pager, !mime ^text, !ext xml|csv|tex|py|pl|rb|sh|php = "$PAGER" -- "$@" -- cgit 1.4.1-2-gfad0 From ea73951aa99594d666f968c99808655683fa8534 Mon Sep 17 00:00:00 2001 From: Célestin Matte Date: Mon, 28 Apr 2014 10:38:41 +0200 Subject: Revert "Fix bugs when $EDITOR="emacs -nw"" This reverts commit 4275d352a8f588468b88e6719325de753d12ed62. --- ranger/config/rifle.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ranger/config/rifle.conf b/ranger/config/rifle.conf index 1eaff9b8..364d7c28 100644 --- a/ranger/config/rifle.conf +++ b/ranger/config/rifle.conf @@ -79,9 +79,9 @@ ext x?html?, has w3m, terminal = w3m "$@" # Misc #------------------------------------------- # Define the "editor" for text files as first action -mime ^text, label editor = $EDITOR "$@" +mime ^text, label editor = "$EDITOR" -- "$@" mime ^text, label pager = "$PAGER" -- "$@" -!mime ^text, label editor, ext xml|csv|tex|py|pl|rb|sh|php = $EDITOR "$@" +!mime ^text, label editor, ext xml|csv|tex|py|pl|rb|sh|php = "$EDITOR" -- "$@" !mime ^text, label pager, ext xml|csv|tex|py|pl|rb|sh|php = "$PAGER" -- "$@" ext 1 = man "$1" @@ -184,5 +184,5 @@ label wallpaper, number 14, mime ^image, X = feh --bg-fill "$1" # Define the editor for non-text files + pager as last action !mime ^text, !ext xml|csv|tex|py|pl|rb|sh|php = ask -label editor, !mime ^text, !ext xml|csv|tex|py|pl|rb|sh|php = $EDITOR "$@" +label editor, !mime ^text, !ext xml|csv|tex|py|pl|rb|sh|php = "$EDITOR" -- "$@" label pager, !mime ^text, !ext xml|csv|tex|py|pl|rb|sh|php = "$PAGER" -- "$@" -- cgit 1.4.1-2-gfad0 From 6385e3a7df4fc434ce3c6449b1734a3db49a4b15 Mon Sep 17 00:00:00 2001 From: Célestin Matte Date: Mon, 28 Apr 2014 10:40:00 +0200 Subject: Allow $EDITOR to contain spaces $EDITOR variables consisting of "program name + options" are not handled correctly because of quotes around $EDITOR. As a result, if $EDITOR is not a simple program name (i.e. if it includes options, as in "emacs -nw"), the full string is taken as a program and fails to run. Error message: (/bin/sh: 1: emacs -nw: not found) Removing quotes fixes this problem. --- ranger/config/rifle.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ranger/config/rifle.conf b/ranger/config/rifle.conf index 364d7c28..68189cd7 100644 --- a/ranger/config/rifle.conf +++ b/ranger/config/rifle.conf @@ -79,9 +79,9 @@ ext x?html?, has w3m, terminal = w3m "$@" # Misc #------------------------------------------- # Define the "editor" for text files as first action -mime ^text, label editor = "$EDITOR" -- "$@" +mime ^text, label editor = $EDITOR -- "$@" mime ^text, label pager = "$PAGER" -- "$@" -!mime ^text, label editor, ext xml|csv|tex|py|pl|rb|sh|php = "$EDITOR" -- "$@" +!mime ^text, label editor, ext xml|csv|tex|py|pl|rb|sh|php = $EDITOR -- "$@" !mime ^text, label pager, ext xml|csv|tex|py|pl|rb|sh|php = "$PAGER" -- "$@" ext 1 = man "$1" @@ -184,5 +184,5 @@ label wallpaper, number 14, mime ^image, X = feh --bg-fill "$1" # Define the editor for non-text files + pager as last action !mime ^text, !ext xml|csv|tex|py|pl|rb|sh|php = ask -label editor, !mime ^text, !ext xml|csv|tex|py|pl|rb|sh|php = "$EDITOR" -- "$@" +label editor, !mime ^text, !ext xml|csv|tex|py|pl|rb|sh|php = $EDITOR -- "$@" label pager, !mime ^text, !ext xml|csv|tex|py|pl|rb|sh|php = "$PAGER" -- "$@" -- cgit 1.4.1-2-gfad0