diff options
author | Eli Zaretskii <eliz@gnu.org> | 2019-08-09 16:51:14 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2019-08-09 16:51:14 +0300 |
commit | 495b33bb3858fbb8912f7d357e1d277062b98bcd (patch) | |
tree | 4bc87c4936716c91819a7880763f631264fda7bf /lisp/man.el | |
parent | bf10b8c3e8d8c45be47bb3c529017d3cb5562178 (diff) | |
download | emacs-495b33bb3858fbb8912f7d357e1d277062b98bcd.tar.gz emacs-495b33bb3858fbb8912f7d357e1d277062b98bcd.tar.bz2 emacs-495b33bb3858fbb8912f7d357e1d277062b98bcd.zip |
Fix highlighting in man pages displayed by "M-x man"
* lisp/man.el (Man-highlight-references0): Handle the case
when a section is divided between 2 or more chunks of text
received from the 'man' program. (Bug#36927)
Diffstat (limited to 'lisp/man.el')
-rw-r--r-- | lisp/man.el | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lisp/man.el b/lisp/man.el index d52ca2156d2..8858451b384 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -1288,8 +1288,23 @@ default type, `Man-xref-man-page' is used for the buttons." (defun Man-highlight-references0 (start-section regexp button-pos target type) ;; Based on `Man-build-references-alist' - (when (or (null start-section) - (Man-find-section start-section)) + (when (or (null start-section) ;; Search regardless of sections. + ;; Section header is in this chunk. + (Man-find-section start-section) + ;; Section header was in one of the previous chunks. + (save-excursion + (save-restriction + (let ((orig-pos (point))) + (widen) + (if (Man-find-section start-section) + ;; We are in the right section of the next + ;; section is either not yet in the buffer, or + ;; it starts after the position where we should + ;; start highlighting. + (progn + (forward-line 1) + (or (null (re-search-forward Man-heading-regexp nil t)) + (> (point) orig-pos)))))))) (let ((end (if start-section (progn (forward-line 1) |