From: Juri Linkov <juri@jurta.org>
To: Colin Watson <cjwatson@debian.org>
Cc: 5566@debbugs.gnu.org,
libwww-facebook-api-perl@packages.debian.org,
rfrancoise@debian.org, man-db@packages.debian.org,
jidanni@jidanni.org
Subject: bug#5566: 23.1.92; man page header ugly on narrow terminals
Date: Fri, 12 Feb 2010 23:57:34 +0200 [thread overview]
Message-ID: <87d40aw20h.fsf@mail.jurta.org> (raw)
In-Reply-To: <20100212205915.GU4484@riva.ucam.org> (Colin Watson's message of "Fri, 12 Feb 2010 20:59:15 +0000")
>> Emacs doesn't process such `man' output. `Man-fontify-manpage' removes
>> ^H's only when the character before ^H is the same as the character after ^H:
>>
>> (while (re-search-forward "\\(.\\)\\(\b+\\1\\)+" nil t)
>> (replace-match "\\1")
>> (put-text-property (1- (point)) (point) 'face Man-overstrike-face))
>>
>> But in this case the characters before ^H and after ^H are different.
>
> As I mentioned before, emacs could improve its output and make it more
> consistent with typical terminal emulators by displaying X^HY as Y when
> X != Y.
From your explanation I gather that for legacy reasons it's unlikely
that the groff's output will be fixed any time soon. So below is
a patch for man.el that removes these ^H:
=== modified file 'lisp/man.el'
--- lisp/man.el 2010-02-11 20:57:10 +0000
+++ lisp/man.el 2010-02-12 21:56:49 +0000
@@ -1105,6 +1105,11 @@ (defun Man-fontify-manpage ()
(while (re-search-forward "[-|]\\(\b[-|]\\)+" nil t)
(replace-match "+")
(put-text-property (1- (point)) (point) 'face 'bold))
+ ;; When the header is longer than the manpage name, groff tries to
+ ;; condense it to a shorter line interspered with ^H. Remove ^H with
+ ;; their preceding chars (but don't put Man-overstrike-face). (Bug#5566)
+ (goto-char (point-min))
+ (while (re-search-forward ".\b" nil t) (backward-delete-char 2))
(goto-char (point-min))
;; Try to recognize common forms of cross references.
(Man-highlight-references)
@@ -1192,6 +1197,11 @@ (defun Man-cleanup-manpage (&optional in
))
(goto-char (point-min))
(while (re-search-forward "[-|]\\(\b[-|]\\)+" nil t) (replace-match "+"))
+ ;; When the header is longer than the manpage name, groff tries to
+ ;; condense it to a shorter line interspered with ^H. Remove ^H with
+ ;; their preceding chars (but don't put Man-overstrike-face). (Bug#5566)
+ (goto-char (point-min))
+ (while (re-search-forward ".\b" nil t) (backward-delete-char 2))
(Man-softhyphen-to-minus)
(message "%s man page cleaned up" Man-arguments))
--
Juri Linkov
http://www.jurta.org/emacs/
next prev parent reply other threads:[~2010-02-12 21:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-11 18:49 bug#5566: 23.1.92; man page header ugly on narrow terminals jidanni
[not found] ` <20100211222648.GJ13019@belanna.comodo.priv.at>
2010-02-12 11:23 ` Colin Watson
2010-02-12 19:24 ` Juri Linkov
2010-02-12 19:20 ` Juri Linkov
2010-02-12 20:59 ` Colin Watson
2010-02-12 21:57 ` Juri Linkov [this message]
2010-02-13 7:34 ` Chong Yidong
2010-02-14 0:23 ` Juri Linkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87d40aw20h.fsf@mail.jurta.org \
--to=juri@jurta.org \
--cc=5566@debbugs.gnu.org \
--cc=cjwatson@debian.org \
--cc=jidanni@jidanni.org \
--cc=libwww-facebook-api-perl@packages.debian.org \
--cc=man-db@packages.debian.org \
--cc=rfrancoise@debian.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.