Subject: Re: bug#27833: 25.2; Add support for manpath command to woman.el

From: Reuben Thomas <[email-masked]>
Date: Wed, 26 Jul 2017 09:43:22 +0100

On 26 July 2017 at 00:40, Mark Oteiza <[email-masked]> wrote:

>
> Reuben Thomas <[email-masked]> writes:
> > +       (woman-parse-colon-path (condition-case nil
> > +                                   (chomp (with-output-to-string
> > +                                            (with-current-buffer
> > +                                                standard-output
> > +                                              (call-process "manpath"
> nil t nil))))
> > +                                 (error nil))))
> > +      (woman-manpath-add-locales
>
> I suspect your chomp is analogous to string-trim-right in subr-x.el
>

​Thanks! I'd had chomp in my Emacs init for so long I had forgotten it
wasn't part of Emacs, and didn't know about string-trim-right. Updated
patch attached (and that function purged from my init, and my personal uses
of it replaced by string-trim-right).

-- 
https://rrt.sc3d.org <http://rrt.sc3d.org>
From 20b8b7be22910454e6c151f3655bdd39f6e32c94 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <[email-masked]>
Date: Tue, 25 Jul 2017 23:37:17 +0100
Subject: [PATCH] Try to set woman-manpath from output of manpath command

* lisp/woman.el (woman-manpath): Try running manpath, provided by
recent man-db, to get man page paths.
---
 lisp/woman.el | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lisp/woman.el b/lisp/woman.el
index aa856c3..06d01bb 100644
--- a/lisp/woman.el
+++ b/lisp/woman.el
@@ -633,6 +633,13 @@ woman-manpath-add-locales
 (defcustom woman-manpath
   ;; Locales could also be added in woman-expand-directory-path.
   (or (woman-manpath-add-locales
+       (woman-parse-colon-path (condition-case nil
+                                   (string-trim-right (with-output-to-string
+                                                        (with-current-buffer
+                                                            standard-output
+                                                          (call-process "manpath" nil t nil))))
+                                 (error nil))))
+      (woman-manpath-add-locales
        (woman-parse-colon-path (getenv "MANPATH")))
       '("/usr/man" "/usr/share/man" "/usr/local/man"))
   "List of DIRECTORY TREES to search for UN*X manual files.
-- 
2.7.4