Git development
 help / color / mirror / Atom feed
From: Ramkumar Ramachandra <artagnon@gmail.com>
To: Git List <git@vger.kernel.org>
Cc: Matthieu Moy <Matthieu.Moy@imag.fr>, Junio C Hamano <gitster@pobox.com>
Subject: [PATCH] help: introduce man.viewer = eman
Date: Sat, 22 Jun 2013 17:13:29 +0530	[thread overview]
Message-ID: <1371901409-8319-1-git-send-email-artagnon@gmail.com> (raw)

Corresponding to woman.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 Documentation/git-help.txt |  3 +++
 builtin/help.c             | 11 ++++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-help.txt b/Documentation/git-help.txt
index b21e9d7..0cb4c46 100644
--- a/Documentation/git-help.txt
+++ b/Documentation/git-help.txt
@@ -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
diff --git a/builtin/help.c b/builtin/help.c
index 062957f..7cb44e0 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -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)
-- 
1.8.3.1.487.g3e7a5b4.dirty

             reply	other threads:[~2013-06-22 11:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-22 11:43 Ramkumar Ramachandra [this message]
2013-06-22 11:59 ` [PATCH] help: introduce man.viewer = eman John Keeping
2013-06-22 12:05   ` Ramkumar Ramachandra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1371901409-8319-1-git-send-email-artagnon@gmail.com \
    --to=artagnon@gmail.com \
    --cc=Matthieu.Moy@imag.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox