]> git.eshelyaron.com Git - emacs.git/commitdiff
man.el: Fix links on hyphenated words (bug#23647)
authorStephen Berman <stephen.berman@gmx.net>
Sun, 5 Jun 2016 11:14:44 +0000 (13:14 +0200)
committerStephen Berman <stephen.berman@gmx.net>
Sun, 5 Jun 2016 11:14:44 +0000 (13:14 +0200)
* lisp/man.el (Man-bgproc-sentinel): Make links work on
hyphenated words.

lisp/man.el

index 5acf90baf2814e8296147d1aa9ce3c95c4190e26..0410626c6552949c7e23697fd53d33a6f84b4ea5 100644 (file)
@@ -1430,8 +1430,17 @@ manpage command."
                        (quit-restore-window
                         (get-buffer-window (current-buffer) t) 'kill)
                      (kill-buffer (current-buffer)))
-                   (message "Can't find the %s manpage"
-                            (Man-page-from-arguments args)))
+                    ;; Entries hyphenated due to the window's width
+                    ;; won't be found in the man database, so remove
+                    ;; the hyphenation -- assuming Groff hyphenates
+                    ;; either with hyphen-minus (ASCII 45, #x2d),
+                    ;; hyphen (#x2010) or soft hyphen (#xad) -- and
+                    ;; look again.
+                   (if (string-match "[-‐­]" args)
+                       (let ((str (replace-match "" nil nil args)))
+                         (Man-getpage-in-background str))
+                      (message "Can't find the %s manpage"
+                               (Man-page-from-arguments args))))
 
                (if Man-fontify-manpage-flag
                    (message "%s man page formatted"