diff options
| author | Manuel Giraud | 2025-06-19 16:42:57 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2025-06-21 11:15:26 +0300 |
| commit | 00b8d11ac8682749f15ac7125f54f357b8825d86 (patch) | |
| tree | 187954322d12d0beea3f1e35dd5a786f3644341b | |
| parent | 4607d3e426115ded71f0d8c19e7187ed45c19734 (diff) | |
| download | emacs-00b8d11ac8682749f15ac7125f54f357b8825d86.tar.gz emacs-00b8d11ac8682749f15ac7125f54f357b8825d86.zip | |
Fix bold or underline of underscores (bug#78839)
* lisp/man.el (Man-fontify-manpage): Fix the "_\b_" case.
| -rw-r--r-- | lisp/man.el | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/lisp/man.el b/lisp/man.el index 397162a7ad1..9e1d294b1ec 100644 --- a/lisp/man.el +++ b/lisp/man.el | |||
| @@ -1379,17 +1379,24 @@ Same for the ANSI bold and normal escape sequences." | |||
| 1379 | (put-text-property (1- (point)) (point) | 1379 | (put-text-property (1- (point)) (point) |
| 1380 | 'font-lock-face 'Man-underline)))) | 1380 | 'font-lock-face 'Man-underline)))) |
| 1381 | (goto-char (point-min)) | 1381 | (goto-char (point-min)) |
| 1382 | (while (and (search-forward "_\b" nil t) (not (eobp))) | 1382 | (while (and (re-search-forward "_\b\\([^_]\\)" nil t) (not (eobp))) |
| 1383 | (delete-char -2) | 1383 | (replace-match "\\1") |
| 1384 | (put-text-property (point) (1+ (point)) 'font-lock-face 'Man-underline)) | 1384 | (put-text-property (1- (point)) (point) 'font-lock-face 'Man-underline)) |
| 1385 | (goto-char (point-min)) | 1385 | (goto-char (point-min)) |
| 1386 | (while (search-forward "\b_" nil t) | 1386 | (while (re-search-forward "\\([^_]\\)\b_" nil t) |
| 1387 | (delete-char -2) | 1387 | (replace-match "\\1") |
| 1388 | (put-text-property (1- (point)) (point) 'font-lock-face 'Man-underline)) | 1388 | (put-text-property (1- (point)) (point) 'font-lock-face 'Man-underline)) |
| 1389 | (goto-char (point-min)) | 1389 | (goto-char (point-min)) |
| 1390 | (while (re-search-forward "\\(.\\)\\(\b+\\1\\)+" nil t) | 1390 | (while (re-search-forward "\\([^_]\\)\\(\b+\\1\\)+" nil t) |
| 1391 | (replace-match "\\1") | 1391 | (replace-match "\\1") |
| 1392 | (put-text-property (1- (point)) (point) 'font-lock-face 'Man-overstrike)) | 1392 | (put-text-property (1- (point)) (point) 'font-lock-face 'Man-overstrike)) |
| 1393 | ;; Special case for "__": is it an underlined underscore or a bold | ||
| 1394 | ;; underscore? Look at the face after it to know. | ||
| 1395 | (goto-char (point-min)) | ||
| 1396 | (while (search-forward "_\b_" nil t) | ||
| 1397 | (delete-char -2) | ||
| 1398 | (let ((face (get-text-property (point) 'font-lock-face))) | ||
| 1399 | (put-text-property (1- (point)) (point) 'font-lock-face face))) | ||
| 1393 | (goto-char (point-min)) | 1400 | (goto-char (point-min)) |
| 1394 | (while (re-search-forward "o\b\\+\\|\\+\bo" nil t) | 1401 | (while (re-search-forward "o\b\\+\\|\\+\bo" nil t) |
| 1395 | (replace-match "o") | 1402 | (replace-match "o") |