help: introduce man.viewer = eman
PATCH 1/1 help: introduce man.viewer = eman
Corresponding to woman.
Signed-off-by Ramkumar Ramachandra <[email protected]>
--- Documentation/git-help.txt | 3 +++ builtin/help.c | 11 ++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-)
Documentation/git-help.txt +3 -0
@@ -104,6 +104,9 @@ The 'man.viewer' config variable will be checked if the 'man' format is chosen. The following values are currently supported: * "man": use the 'man' program as usual, +* "eman": use 'emacsclient' to launch the "man" mode in emacs +(this only works starting with emacsclient versions 22), on systems +with man, * "woman": use 'emacsclient' to launch the "woman" mode in emacs (this only works starting with emacsclient versions 22), * "konqueror": use 'kfmclient' to open the man page in a new konqueror
builtin/help.c +8 -3
@@ -120,7 +120,7 @@ static int check_emacsclient_version(void)return 0 ; } -static void exec_woman_emacs (const char *path,const char *page) +static void exec_woman_emacs (const char *path,const char *page,int eman) {if (!check_emacsclient_version ()) {/* This works only with emacsclient version >= 22. */
@@ -128,7 +128,10 @@ static void exec_woman_emacs(const char *path, const char *page)if (!path) path ="emacsclient" ; -strbuf_addf (&man_page,"(woman \"%s\")" , page); +if (eman) +strbuf_addf (&man_page,"(man \"%s\")" , page); +else +strbuf_addf (&man_page,"(woman \"%s\")" , page);execlp (path,"emacsclient" ,"-e" , man_page.buf, (char *)NULL );warning (_ ("failed to exec '%s': %s" ), path,strerror (errno)); }
@@ -341,8 +344,10 @@ static void exec_viewer(const char *name, const char *page)if (!strcasecmp (name,"man" ))exec_man_man (info, page); +else if (!strcasecmp (name,"eman" )) +exec_woman_emacs (info, page,1 );else if (!strcasecmp (name,"woman" )) -exec_woman_emacs (info, page); +exec_woman_emacs (info, page,0 );else if (!strcasecmp (name,"konqueror" ))exec_man_konqueror (info, page);else if (info)
Signature · 1 line
1.8.3.1.487.g3e7a5b4.dirty
Quoted 36 lines · Ramkumar Ramachandra
Corresponding to woman.
Signed-off-by Ramkumar Ramachandra <[email protected]>--- Documentation/git-help.txt | 3 +++ builtin/help.c | 11 ++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-)Documentation/git-help.txt +3
-0@@ -104,6 +104,9 @@ The 'man.viewer' config variable will be checked if the 'man' format is chosen. The following values are currently supported: * "man": use the 'man' program as usual, +* "eman": use 'emacsclient' to launch the "man" mode in emacs +(this only works starting with emacsclient versions 22), on systems +with man, * "woman": use 'emacsclient' to launch the "woman" mode in emacs (this only works starting with emacsclient versions 22), * "konqueror": use 'kfmclient' to open the man page in a new konquerorbuiltin/help.c +1
-1@@ -120,7 +120,7 @@ static int check_emacsclient_version(void)return 0 ; } -static void exec_woman_emacs (const char *path,const char *page) +static void exec_woman_emacs (const char *path,const char *page,int eman) {if (!check_emacsclient_version ()) {/* This works only with emacsclient version >= 22. */
builtin/help.c static void exec_woman_emacs(const char *path, const char *page) · line 134
Quoted 8 lines
builtin/help.c +4
-1@@ -128,7 +128,10 @@ static void exec_woman_emacs(const char *path, const char *page)if (!path) path ="emacsclient" ; -strbuf_addf (&man_page,"(woman \"%s\")" , page); +if (eman) +strbuf_addf (&man_page,"(man \"%s\")" , page); +else +strbuf_addf (&man_page,"(woman \"%s\")" , page);
Would it be nicer to pass a string in here instead of a flag? Then this becomes:
strbuf_addf(&man_page, "(%s \"%s\")", command, page);
You should probably also rename this function to "exec_emacsclient" or something as well now that it doesn't just launch woman.
Quoted 17 lines
builtin/help.c +3
-1execlp (path,"emacsclient" ,"-e" , man_page.buf, (char *)NULL );warning (_ ("failed to exec '%s': %s" ), path,strerror (errno)); }@@ -341,8 +344,10 @@ static void exec_viewer(const char *name, const char *page)if (!strcasecmp (name,"man" ))exec_man_man (info, page); +else if (!strcasecmp (name,"eman" )) +exec_woman_emacs (info, page,1 );else if (!strcasecmp (name,"woman" )) -exec_woman_emacs (info, page); +exec_woman_emacs (info, page,0 );else if (!strcasecmp (name,"konqueror" ))exec_man_konqueror (info, page);else if (info)Signature · 1 line
1.8.3.1.487.g3e7a5b4.dirty
Quoted 7 lines · John Keeping
Would it be nicer to pass a string in here instead of a flag? Then this becomes:
strbuf_addf(&man_page, "(%s \"%s\")", command, page);You should probably also rename this function to "
exec_emacsclient" or something as well now that it doesn't just launch woman.
Sure, will do both.