unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#19359: [PATCHES] Buttons in man pages
@ 2014-12-12 13:49 Álvar Ibeas
  2014-12-12 20:23 ` Andreas Schwab
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Álvar Ibeas @ 2014-12-12 13:49 UTC (permalink / raw)
  To: 19359

[-- Attachment #1: Type: text/plain, Size: 4254 bytes --]

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))


[-- Attachment #2: patch_a --]
[-- Type: text/plain, Size: 1126 bytes --]

    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)



[-- Attachment #3: patch_b --]
[-- Type: text/plain, Size: 1190 bytes --]

    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).


[-- Attachment #4: patch_c --]
[-- Type: text/plain, Size: 1311 bytes --]

    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)



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-06-25 21:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-12 13:49 bug#19359: [PATCHES] Buttons in man pages Álvar Ibeas
2014-12-12 20:23 ` Andreas Schwab
2014-12-14  0:40 ` bug#19359: " Álvar Ibeas
2014-12-17 22:15 ` Álvar Ibeas
2019-06-25 21:03 ` bug#19359: [PATCHES] " Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).