summaryrefslogtreecommitdiff
path: root/lisp/man.el
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2019-02-20 12:07:22 -0800
committerGlenn Morris <rgm@gnu.org>2019-02-20 12:07:22 -0800
commit83a9133e35827c1edbd8bf24a17ffa3b4bfb7be3 (patch)
tree11d2812db4a9ee4e66976b3a5f1e5ecbe52b4955 /lisp/man.el
parentae77728d14e58054bdaee3c6965979947c778208 (diff)
parentff9c9620794e5fe5692cfd3badd207aac78921cb (diff)
downloademacs-83a9133e35827c1edbd8bf24a17ffa3b4bfb7be3.tar.gz
Merge from origin/emacs-26
ff9c962 ; * lisp/ldefs-boot.el: Update. b4a251c * ; ChangeLog.3 update d3104e3 * etc/AUTHORS: Update. a19bfb7 Remove .art from the default list of ImageMagick extensions 6985caa Fix input after setting x-wait-for-event-timeout nil 715388a Fix two warnings in eshell.texi d49cdd9 * lisp/minibuffer.el (completion-table-dynamic): Improve docs... 5dc4e51 * lisp/emacs-lisp/debug.el (debug-on-variable-change): Doc fi... 76ef805 Fix a typo in ELisp manual b5e66f4 Update citations of Internet RFCs 57ece2a Fix handling of manpage references divided by hyphenation 7ad0cd6 * doc/misc/eshell.texi: Fix some @ref's. 12b7940 Fix a typo in lispref/syntax.texi # Conflicts: # lisp/gnus/nnrss.el # lisp/mail/ietf-drums.el
Diffstat (limited to 'lisp/man.el')
-rw-r--r--lisp/man.el21
1 files changed, 16 insertions, 5 deletions
diff --git a/lisp/man.el b/lisp/man.el
index 767e8622b8e..b1d0fd3d17c 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -318,7 +318,7 @@ This regular expression should start with a `^' character.")
(defvar Man-reference-regexp
(concat "\\(" Man-name-regexp
- "\\(‐?\n[ \t]+" Man-name-regexp "\\)*\\)[ \t]*(\\("
+ "\\(\\([-‐]\n\\)?[ \t]+" Man-name-regexp "\\)*\\)[ \t]*(\\("
Man-section-regexp "\\))")
"Regular expression describing a reference to another manpage.")
@@ -664,7 +664,7 @@ and the `Man-section-translations-alist' variables)."
;; "chmod(2V)" case ?
((string-match (concat "^" Man-reference-regexp "$") ref)
(setq name (replace-regexp-in-string "[\n\t ]" "" (match-string 1 ref))
- section (match-string 3 ref)))
+ section (match-string 4 ref)))
;; "2v chmod" case ?
((string-match (concat "^\\(" Man-section-regexp
"\\) +\\(" Man-name-regexp "\\)$") ref)
@@ -783,11 +783,22 @@ POS defaults to `point'."
;; see this-
;; command-here(1)
;; Note: This code gets executed iff our entry is after POS.
- (when (looking-at "‐?[ \t\r\n]+\\([-a-zA-Z0-9._+:]+\\)([0-9])")
- (setq word (concat word (match-string-no-properties 1)))
+ (when (looking-at
+ (concat
+ "‐?[ \t\r\n]+\\([-a-zA-Z0-9._+:]+\\)(" Man-section-regexp ")"))
+ (let ((1st-part word))
+ (setq word (concat word (match-string-no-properties 1)))
+ ;; If they use -Tascii, we cannot know whether a hyphen at
+ ;; EOL is or isn't part of the referenced manpage name.
+ ;; Heuristics: if the part of the manpage before the hyphen
+ ;; doesn't include a hyphen, we consider the hyphen to be
+ ;; added by troff, and remove it.
+ (or (not (eq (string-to-char (substring 1st-part -1)) ?-))
+ (string-match-p "-" (substring 1st-part 0 -1))
+ (setq word (replace-regexp-in-string "-" "" word))))
;; Make sure the section number gets included by the code below.
(goto-char (match-end 1)))
- (when (string-match "[-._]+$" word)
+ (when (string-match "[-._‐]+$" word)
(setq word (substring word 0 (match-beginning 0))))
;; The following was commented out since the preceding code
;; should not produce a leading "*" in the first place.