aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2021-12-01 20:31:14 +0100
committerLars Ingebrigtsen2021-12-01 23:27:19 +0100
commited7591c9055d4c90d2f59ffbd90aff45da2dc102 (patch)
treee438e7c215b661be054f5d706070172e6509b5cc
parentfd86829e6648338282632b9e97b11f1e76299193 (diff)
downloademacs-ed7591c9055d4c90d2f59ffbd90aff45da2dc102.tar.gz
emacs-ed7591c9055d4c90d2f59ffbd90aff45da2dc102.zip
Fix "SEE ALSO" buttons in some man pages
* lisp/man.el (Man-highlight-references0): Don't include "and" in the links (bug#52229).
-rw-r--r--lisp/man.el32
1 files changed, 19 insertions, 13 deletions
diff --git a/lisp/man.el b/lisp/man.el
index 2bde1fc7fb2..fff31baa5f3 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -1334,7 +1334,7 @@ default type, `Man-xref-man-page' is used for the buttons."
1334 1334
1335(defun Man-highlight-references0 (start-section regexp button-pos target type) 1335(defun Man-highlight-references0 (start-section regexp button-pos target type)
1336 ;; Based on `Man-build-references-alist' 1336 ;; Based on `Man-build-references-alist'
1337 (when (or (null start-section) ;; Search regardless of sections. 1337 (when (or (null start-section) ;; Search regardless of sections.
1338 ;; Section header is in this chunk. 1338 ;; Section header is in this chunk.
1339 (Man-find-section start-section)) 1339 (Man-find-section start-section))
1340 (let ((end (if start-section 1340 (let ((end (if start-section
@@ -1347,18 +1347,24 @@ default type, `Man-xref-man-page' is used for the buttons."
1347 (goto-char (point-min)) 1347 (goto-char (point-min))
1348 nil))) 1348 nil)))
1349 (while (re-search-forward regexp end t) 1349 (while (re-search-forward regexp end t)
1350 ;; An overlay button is preferable because the underlying text 1350 (let ((b (match-beginning button-pos))
1351 ;; may have text property highlights (Bug#7881). 1351 (e (match-end button-pos))
1352 (make-button 1352 (match (match-string button-pos)))
1353 (match-beginning button-pos) 1353 ;; Some lists of references end with ", and ...". Chop the
1354 (match-end button-pos) 1354 ;; "and" bit off before making a button.
1355 'type type 1355 (when (string-match "\\`and +" match)
1356 'Man-target-string (cond 1356 (setq b (+ b (- (match-end 0) (match-beginning 0)))))
1357 ((numberp target) 1357 ;; An overlay button is preferable because the underlying text
1358 (match-string target)) 1358 ;; may have text property highlights (Bug#7881).
1359 ((functionp target) 1359 (make-button
1360 target) 1360 b e
1361 (t nil))))))) 1361 'type type
1362 'Man-target-string (cond
1363 ((numberp target)
1364 (match-string target))
1365 ((functionp target)
1366 target)
1367 (t nil))))))))
1362 1368
1363(defun Man-cleanup-manpage (&optional interactive) 1369(defun Man-cleanup-manpage (&optional interactive)
1364 "Remove overstriking and underlining from the current buffer. 1370 "Remove overstriking and underlining from the current buffer.