From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ibeas@gmx.com (=?UTF-8?Q?=C3=81lvar?= Ibeas) Newsgroups: gmane.emacs.bugs Subject: bug#19359: [PATCHES] Buttons in man pages Date: Fri, 12 Dec 2014 14:49:21 +0100 Message-ID: <87a92tf066.fsf@gmx.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1418402851 25310 80.91.229.3 (12 Dec 2014 16:47:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 12 Dec 2014 16:47:31 +0000 (UTC) To: 19359@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Dec 12 17:47:25 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XzTNE-0003eA-4S for geb-bug-gnu-emacs@m.gmane.org; Fri, 12 Dec 2014 17:47:24 +0100 Original-Received: from localhost ([::1]:58329 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XzTND-0007lU-NA for geb-bug-gnu-emacs@m.gmane.org; Fri, 12 Dec 2014 11:47:23 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43781) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XzTN0-0007aY-Vf for bug-gnu-emacs@gnu.org; Fri, 12 Dec 2014 11:47:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XzTMt-0003GG-3G for bug-gnu-emacs@gnu.org; Fri, 12 Dec 2014 11:47:10 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:34767) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XzTMs-0003G6-VR for bug-gnu-emacs@gnu.org; Fri, 12 Dec 2014 11:47:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XzTMs-0006lN-F3 for bug-gnu-emacs@gnu.org; Fri, 12 Dec 2014 11:47:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: ibeas@gmx.com (=?UTF-8?Q?=C3=81lvar?= Ibeas) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 12 Dec 2014 16:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 19359 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.141840277525935 (code B ref -1); Fri, 12 Dec 2014 16:47:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 12 Dec 2014 16:46:15 +0000 Original-Received: from localhost ([127.0.0.1]:44132 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XzTM6-0006kE-9z for submit@debbugs.gnu.org; Fri, 12 Dec 2014 11:46:15 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:53752) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XzQbQ-0002JL-FA for submit@debbugs.gnu.org; Fri, 12 Dec 2014 08:49:53 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XzQbD-0006qf-ON for submit@debbugs.gnu.org; Fri, 12 Dec 2014 08:49:47 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:60673) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XzQbD-0006qa-Kr for submit@debbugs.gnu.org; Fri, 12 Dec 2014 08:49:39 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55403) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XzQb7-0005Jp-5Y for bug-gnu-emacs@gnu.org; Fri, 12 Dec 2014 08:49:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XzQaz-0006of-GB for bug-gnu-emacs@gnu.org; Fri, 12 Dec 2014 08:49:33 -0500 Original-Received: from mout.gmx.net ([212.227.17.22]:58130) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XzQaz-0006oR-62 for bug-gnu-emacs@gnu.org; Fri, 12 Dec 2014 08:49:25 -0500 Original-Received: from yermo ([84.127.142.133]) by mail.gmx.com (mrgmx103) with ESMTPSA (Nemesis) id 0M2cDB-1Xj0H13R1p-00sLch; Fri, 12 Dec 2014 14:49:23 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) X-Provags-ID: V03:K0:2LQBN9uyPj/bk0XtIottUz958roZi6IpRWHwsADG7M+BNT6RDji QJf1WBGV30dsABzmfPLQamQxOj+VFMqQKMmrc2tTL6iRg94G3Zgu1YTPFC3CAqlqkZum47o qe0nugOjN67f92p3g4m8A9iZbFYe37YS/ycISwJRq+Xaim9XmlyPBkBSlpvsDj7AByuQxEq GsNSzsQeCGyk4HsHn5mdQ== X-UI-Out-Filterresults: notjunk:1; X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Mailman-Approved-At: Fri, 12 Dec 2014 11:46:12 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:97270 Archived-At: --=-=-= Content-Type: text/plain Hello, I find some broken links and highlight problems after invoking: M-x man groff 1. If a reference to another man page starts a line and the previous line has some text, its last word is included in the button. Also, the link follows the whole string. For instance: Introduction, history and further readings: roff(7). Here, the button tries to fetch the man page `readings:roff(7)'. The proposed (and lazy) patch_a doesn't allow references spanning several lines. 2. As the output of the background process is filtered by chunks, if the `SEE ALSO' section is split into several (and I guess this is likely if the section is as big as the one in groff(1)), only the first of them gets highlighted. This doesn't happen in 24.4. It would be necessary to format the buffer only at the end of the process (I don't know how to do it). Additionally (or instead), it might be desirable to extend the highlighted buttons to (what appear to be) references in the whole page, as is done with patch_b. This solves also the issue with man pages in languages other than English, where the `SEE ALSO' section is not recognized by the current `Man-see-also-regexp' and references are not highlighted. 3. There are three highlighted files in the subsection `groff Font Directory'. The last two are only partially highlighted. With patch_c, they are discarded as buttons. As for the first file, the link is broken. When a file ends with a dot, I guess it's more likely it be punctuation rather than part of the file, so patch_c also removes those dots. In GNU Emacs 25.0.50.1 (i686-pc-linux-gnu, GTK+ Version 3.4.2) of 2014-12-11 on yermo Windowing system distributor `The X.Org Foundation', version 11.0.11204000 System Description: Debian GNU/Linux 7.7 (wheezy) Configured features: XPM JPEG TIFF GIF PNG SOUND GSETTINGS NOTIFY FREETYPE XFT ZLIB Important settings: value of $LANG: es_ES.UTF-8 locale-coding-system: utf-8-unix Major mode: Man Minor modes in effect: tooltip-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t buffer-read-only: t line-number-mode: t Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Invoking man groff in the background groff man page formatted Mark set Invoking man 1 formatters:groff in the background Can't find the 1 formatters:groff manpage Man-next-manpage: This is the only manpage in the buffer Cannot find a file: /usr/share/groff/1.21/tmac. Making completion list... Quit Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr emacsbug message dired format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util help-fns mail-prsvr mail-utils tabify imenu man easymenu cl-loaddefs cl-lib ansi-color time-date tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process gfilenotify dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs) Memory information: ((conses 8 88263 5052) (symbols 24 18365 0) (miscs 20 108 241) (strings 16 12637 3932) (string-bytes 1 364509) (vectors 8 10694) (vector-slots 4 411857 4524) (floats 8 75 74) (intervals 28 4874 16) (buffers 520 13) (heap 1024 43027 358)) --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=patch_a Content-Description: patch_a Disallow line breaks in reference names * lisp/man.el (Man-reference-regexp) --- lisp/man.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lisp/man.el b/lisp/man.el index a61524b..c6954a0 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -304,8 +304,7 @@ This regexp should not start with a `^' character.") This regular expression should start with a `^' character.") (defvar Man-reference-regexp - (concat "\\(" Man-name-regexp - "\\(\n[ \t]+" Man-name-regexp "\\)*\\)[ \t]*(\\(" + (concat "\\(" Man-name-regexp "\\)[ \t]*(\\(" Man-section-regexp "\\))") "Regular expression describing a reference to another manpage.") @@ -657,7 +656,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 2 ref))) ;; "2v chmod" case ? ((string-match (concat "^\\(" Man-section-regexp "\\) +\\(" Man-name-regexp "\\)$") ref) --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=patch_b Content-Description: patch_b Highlight cross-references all across man pages, except the title * lisp/man.el (Man-highlight-references, Man-highlight-references0) --- lisp/man.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/man.el b/lisp/man.el index a61524b..1c482ba 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -1263,7 +1263,7 @@ default type, `Man-xref-man-page' is used for the buttons." (Man-highlight-references0 nil Man-apropos-regexp 1 'Man-default-man-entry (or xref-man-type 'Man-xref-man-page))) - (Man-highlight-references0 Man-see-also-regexp Man-reference-regexp 1 + (Man-highlight-references0 nil Man-reference-regexp 1 'Man-default-man-entry (or xref-man-type 'Man-xref-man-page)) (Man-highlight-references0 Man-synopsis-regexp Man-header-regexp 0 2 @@ -1284,6 +1284,8 @@ default type, `Man-xref-man-page' is used for the buttons." (point))) (goto-char (point-min)) nil))) + (if (eq (point) 1) + (Man-next-section 1)) (while (re-search-forward regexp end t) ;; An overlay button is preferable because the underlying text ;; may have text property highlights (Bug#7881). --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=patch_c Content-Description: patch_c Change file links in man pages * lisp/man.el (Man-file-name-regexp): Remove single trailing dot and force beginning at the beggining of a symbol. --- lisp/man.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/man.el b/lisp/man.el index a61524b..5f278ac 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -339,7 +339,8 @@ This regexp should not start with a `^' character.") "Regular expression describing references to header files.") (defvar Man-normal-file-regexp - (concat Man-normal-file-prefix-regexp Man-file-name-regexp) + (concat "\\(\\_<" Man-normal-file-prefix-regexp + "[^<>\", \t\n]+?\\)\\.?\\_>") "Regular expression describing references to normal files.") ;; This includes the section as an optional part to catch hyphenated @@ -1268,7 +1269,7 @@ default type, `Man-xref-man-page' is used for the buttons." (or xref-man-type 'Man-xref-man-page)) (Man-highlight-references0 Man-synopsis-regexp Man-header-regexp 0 2 'Man-xref-header-file) - (Man-highlight-references0 Man-files-regexp Man-normal-file-regexp 0 0 + (Man-highlight-references0 Man-files-regexp Man-normal-file-regexp 1 1 'Man-xref-normal-file))) (defun Man-highlight-references0 (start-section regexp button-pos target type) --=-=-=--