* 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
* bug#19359: [PATCHES] Buttons in man pages
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
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Andreas Schwab @ 2014-12-12 20:23 UTC (permalink / raw)
To: Álvar Ibeas; +Cc: 19359
ibeas@gmx.com (Álvar Ibeas) writes:
> 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.
This will break word-wrapped references, see bug#6289.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#19359: Buttons in man pages
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 ` Álvar Ibeas
2014-12-17 22:15 ` Álvar Ibeas
2019-06-25 21:03 ` bug#19359: [PATCHES] " Lars Ingebrigtsen
3 siblings, 0 replies; 5+ messages in thread
From: Álvar Ibeas @ 2014-12-14 0:40 UTC (permalink / raw)
To: 19359
[-- Attachment #1: Type: text/plain, Size: 422 bytes --]
This patch only forms wrapped references when there is a hyphenation
character, solving the first issue. It doesn't highlight however
references extended over more than two lines, in the same way as the
current `Man-default-man-entry', which is the function used to fetch the
link target.
As long as this, it might be worth to address the fact that the blank
space between the parts of a wrapped reference is fontified.
[-- Attachment #2: patch_a2 --]
[-- Type: text/plain, Size: 4660 bytes --]
diff --git a/lisp/man.el b/lisp/man.el
index a61524b..7a75e46 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -84,7 +84,7 @@
;; - Allow a user option to mean that all the manpages should go in
;; the same buffer, where they can be browsed with M-n and M-p.
-\f
+
;;; Code:
(require 'ansi-color)
@@ -275,7 +275,7 @@ Used in `bookmark-set' to get the default bookmark name."
:type 'hook
:group 'man)
-(defvar Man-name-regexp "[-a-zA-Z0-9_+][-a-zA-Z0-9_.:+]*"
+(defvar Man-name-regexp "[-a-zA-Z0-9_+][-a-zA-Z0-9_.:+]*"
"Regular expression describing the name of a manpage (without section).")
(defvar Man-section-regexp "[0-9][a-zA-Z0-9+]*\\|[LNln]"
@@ -304,8 +304,8 @@ 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 "?\\([-\u2010\u00AD]\n[ \t]*"
+ "[-a-zA-Z0-9_.:+]*\\)?\\_>\\)[ \t]*(\\("
Man-section-regexp "\\))")
"Regular expression describing a reference to another manpage.")
@@ -373,7 +373,7 @@ Otherwise, the value is whatever the function
:type 'string
:group 'man)
-\f
+
;; other variables and keymap initializations
(defvar Man-original-frame)
(make-variable-buffer-local 'Man-original-frame)
@@ -519,7 +519,7 @@ Otherwise, the value is whatever the function
'follow-link t
'help-echo "mouse-2: display this file")
-\f
+
;; ======================================================================
;; utilities
@@ -707,7 +707,7 @@ a \"/\" as a local filename. The function returns either `man-db'
'man))))
Man-support-local-filenames))
-\f
+
;; ======================================================================
;; default man entry: get word near point
@@ -768,14 +768,15 @@ POS defaults to `point'."
(setq start (point)))))
;; We have found a suitable starting point, try to skip at least
;; one character.
- (skip-chars-forward "-a-zA-Z0-9._+:")
+ (skip-chars-forward "-a-zA-Z0-9._+:\u2010\u00AD")
(setq word (buffer-substring-no-properties start (point)))
;; If there is a continuation at the end of line, check the
;; following line too, eg:
;; see this-
;; command-here(1)
;; Note: This code gets executed iff our entry is after POS.
- (when (looking-at "[ \t\r\n]+\\([-a-zA-Z0-9._+:]+\\)([0-9])")
+ (when (looking-at (concat "[ \t\r\n]+\\([-a-zA-Z0-9._+:]+\\)("
+ Man-section-regexp ")"))
(setq word (concat word (match-string-no-properties 1)))
;; Make sure the section number gets included by the code below.
(goto-char (match-end 1)))
@@ -786,16 +787,17 @@ POS defaults to `point'."
;;; ;; If looking at something like *strcat(... , remove the '*'
;;; (when (string-match "^*" word)
;;; (setq word (substring word 1)))
- (concat
- word
- (and (not (string-equal word ""))
- ;; If looking at something like ioctl(2) or brc(1M),
- ;; include the section number in the returned value.
- (looking-at
- (concat "[ \t]*([ \t]*\\(" Man-section-regexp "\\)[ \t]*)"))
- (format "(%s)" (match-string-no-properties 1)))))))
-
-\f
+ (setq word (replace-regexp-in-string "[\u2010\u00AD]" "" word))
+ (concat
+ word
+ (and (not (string-equal word ""))
+ ;; If looking at something like ioctl(2) or brc(1M),
+ ;; include the section number in the returned value.
+ (looking-at
+ (concat "[ \t]*([ \t]*\\(" Man-section-regexp "\\)[ \t]*)"))
+ (format "(%s)" (match-string-no-properties 1)))))))
+
+
;; ======================================================================
;; Top level command and background process sentinel
@@ -1455,7 +1457,7 @@ manpage command."
(split-string args " ")))
" "))
-\f
+
;; ======================================================================
;; set up manual mode in buffer and build alists
@@ -1652,7 +1654,7 @@ The following key bindings are currently in effect in the buffer:
(forward-line 1)))
))))
-\f
+
;; ======================================================================
;; Man mode commands
@@ -1889,7 +1891,7 @@ Uses `Man-name-local-regexp'."
(bookmark-default-handler
`("" (buffer . ,buf) . ,(bookmark-get-bookmark-record bookmark)))))
-\f
+
;; Init the man package variables, if not already done.
(Man-init-defvars)
^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#19359: Buttons in man pages
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
3 siblings, 0 replies; 5+ messages in thread
From: Álvar Ibeas @ 2014-12-17 22:15 UTC (permalink / raw)
To: 19359
[-- Attachment #1: Type: text/plain, Size: 553 bytes --]
Here is another suggestion that could serve as an approach to avoid
cross-references being interpreted as word-wrapped links, when the
previous line doesn't end with a hyphen. This one allows references to
span more than two lines.
The variable `Man-name-regexp' is changed to include line
breaks. Hopefully, this doesn't mess up (many) other things.
As an advantage, with this approach, a cross-reference outside the `SEE
ALSO' section that is split across two (or more) lines can be followed
by typing RET not only with point on the first of them.
[-- Attachment #2: patch_a3 --]
[-- Type: text/plain, Size: 10571 bytes --]
diff --git a/lisp/man.el b/lisp/man.el
index a61524b..51e5b1b 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -275,7 +275,22 @@ Used in `bookmark-set' to get the default bookmark name."
:type 'hook
:group 'man)
-(defvar Man-name-regexp "[-a-zA-Z0-9_+][-a-zA-Z0-9_.:+]*"
+(defvar Man-name-leading-character "[-a-zA-Z0-9_+]"
+ "Regular expression describing the first character of the name of a manpage.")
+
+(defvar Man-name-character "[-a-zA-Z0-9_.:+]"
+ "Regular expression describing a generic character in the name of a manpage.")
+
+(defvar Man-hyphenation-added-character "[\u2010\u00AD]"
+ "Regular expression describing a character added to break a name.")
+
+(defvar Man-hyphenation-character
+ (concat "\\(?:-\\|" Man-hyphenation-added-character "\\)")
+ "Regular expression describing a character used for hyphenation.")
+
+(defvar Man-name-regexp
+ (concat "\\(\\_<" Man-name-leading-character "\\(" Man-name-character "*?"
+ Man-hyphenation-character "\n[ \t]*\\)*" Man-name-character "*\\_>\\)")
"Regular expression describing the name of a manpage (without section).")
(defvar Man-section-regexp "[0-9][a-zA-Z0-9+]*\\|[LNln]"
@@ -304,9 +319,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]*(\\("
- Man-section-regexp "\\))")
+ (concat Man-name-regexp "[ \t]*(\\(" Man-section-regexp "\\))")
"Regular expression describing a reference to another manpage.")
(defvar Man-apropos-regexp
@@ -707,7 +720,33 @@ a \"/\" as a local filename. The function returns either `man-db'
'man))))
Man-support-local-filenames))
-\f
+
+(defun Man-skip-name-backward ()
+ "Move point backward until the beginning of what seems to be a
+name. Return the name length."
+ (let (travel)
+ (setq travel (skip-chars-backward "-a-zA-Z0-9_.:+"))
+ (while (looking-back (concat Man-hyphenation-character "\n[ \t]*"))
+ (end-of-line 0)
+ (backward-char)
+ (setq travel (+ travel
+ (skip-chars-backward "-a-zA-Z0-9_.:+"))))
+ travel))
+
+(defun Man-skip-name-forward ()
+ "Move point forward until the end of what seems to be a name.
+Return the name length."
+ (let (travel)
+ (setq travel (skip-chars-forward "-a-zA-Z0-9_.:+"))
+ (while (or (and (looking-back "-")
+ (looking-at "$"))
+ (looking-at (concat Man-hyphenation-character "$")))
+ (beginning-of-line 2)
+ (skip-chars-forward "[ \t]*")
+ (setq travel (+ travel
+ (skip-chars-forward "-a-zA-Z0-9_.:+"))))
+ travel))
+
;; ======================================================================
;; default man entry: get word near point
@@ -729,7 +768,7 @@ POS defaults to `point'."
;; We skipped a valid section number backwards, look at
;; preceding text.
(or (and (skip-chars-backward ",; \t")
- (not (zerop (skip-chars-backward "-a-zA-Z0-9._+:"))))
+ (not (zerop (Man-skip-name-backward))))
;; Not a valid entry, move POS after closing paren.
(not (setq pos (match-end 0)))))
;; We have a candidate, make `start' record its starting
@@ -737,7 +776,7 @@ POS defaults to `point'."
(setq start (point))
;; Otherwise look at char before POS.
(goto-char pos)
- (if (not (zerop (skip-chars-backward "-a-zA-Z0-9._+:")))
+ (if (not (zerop (Man-skip-name-backward)))
;; Our candidate is just before or around POS.
(setq start (point))
;; Otherwise record the current column and look backwards.
@@ -750,7 +789,7 @@ POS defaults to `point'."
;; Skip section number backwards.
(goto-char (match-beginning 0))
(skip-chars-backward " \t"))
- (if (not (zerop (skip-chars-backward "-a-zA-Z0-9._+:")))
+ (if (not (zerop (Man-skip-name-backward)))
(progn
;; We have a candidate before POS ...
(setq start (point))
@@ -768,17 +807,12 @@ POS defaults to `point'."
(setq start (point)))))
;; We have found a suitable starting point, try to skip at least
;; one character.
- (skip-chars-forward "-a-zA-Z0-9._+:")
+ (Man-skip-name-forward)
(setq word (buffer-substring-no-properties start (point)))
- ;; If there is a continuation at the end of line, check the
- ;; following line too, eg:
- ;; see this-
- ;; command-here(1)
- ;; Note: This code gets executed iff our entry is after POS.
- (when (looking-at "[ \t\r\n]+\\([-a-zA-Z0-9._+:]+\\)([0-9])")
- (setq word (concat word (match-string-no-properties 1)))
- ;; Make sure the section number gets included by the code below.
- (goto-char (match-end 1)))
+ (setq word (replace-regexp-in-string
+ (concat "\\([ \t\n]\\|"
+ Man-hyphenation-added-character "\\)")
+ "" word))
(when (string-match "[-._]+$" word)
(setq word (substring word 0 (match-beginning 0))))
;; The following was commented out since the preceding code
@@ -786,14 +820,14 @@ POS defaults to `point'."
;;; ;; If looking at something like *strcat(... , remove the '*'
;;; (when (string-match "^*" word)
;;; (setq word (substring word 1)))
- (concat
- word
- (and (not (string-equal word ""))
- ;; If looking at something like ioctl(2) or brc(1M),
- ;; include the section number in the returned value.
- (looking-at
- (concat "[ \t]*([ \t]*\\(" Man-section-regexp "\\)[ \t]*)"))
- (format "(%s)" (match-string-no-properties 1)))))))
+ (concat
+ word
+ (and (not (string-equal word ""))
+ ;; If looking at something like ioctl(2) or brc(1M),
+ ;; include the section number in the returned value.
+ (looking-at
+ (concat "[ \t]*([ \t]*\\(" Man-section-regexp "\\)[ \t]*)"))
+ (format "(%s)" (match-string-no-properties 1)))))))
\f
;; ======================================================================
@@ -1535,7 +1569,7 @@ The following key bindings are currently in effect in the buffer:
(end (progn
(Man-next-section 1)
(point)))
- hyphenated
+ ;; hyphenated
(runningpoint -1))
(save-restriction
(narrow-to-region start end)
@@ -1543,18 +1577,22 @@ The following key bindings are currently in effect in the buffer:
(back-to-indentation)
(while (and (not (eobp)) (/= (point) runningpoint))
(setq runningpoint (point))
- (if (re-search-forward Man-hyphenated-reference-regexp end t)
- (let* ((word (match-string 0))
- (len (1- (length word))))
- (if hyphenated
- (setq word (concat hyphenated word)
- hyphenated nil
- ;; Update len, in case a reference spans
- ;; more than two lines (paranoia).
- len (1- (length word))))
- (if (memq (aref word len) '(?- ?))
- (setq hyphenated (substring word 0 len)))
- (and (string-match Man-reference-regexp word)
+ (if (re-search-forward Man-reference-regexp end t)
+ (let* ((word (match-string 0)))
+ ;; (len (1- (length word)))
+ ;; (if hyphenated
+ ;; (setq word (concat hyphenated word)
+ ;; hyphenated nil
+ ;; ;; Update len, in case a reference spans
+ ;; ;; more than two lines (paranoia).
+ ;; len (1- (length word))))
+ ;; (if (memq (aref word len) '(?- ?))
+ ;; (setq hyphenated (substring word 0 len)))
+ (setq word (replace-regexp-in-string
+ (concat "\\([ \t\n]\\|"
+ Man-hyphenation-added-character "\\)")
+ "" word))
+ (and ;(string-match Man-reference-regexp word)
(not (member word Man--refpages))
(push word Man--refpages))))
(skip-chars-forward " \t\n,"))))))
@@ -1720,25 +1758,25 @@ Actually the section moved to is described by `Man-see-also-regexp'."
(error "%s" (concat "No " Man-see-also-regexp
" section found in the current manpage"))))
-(defun Man-possibly-hyphenated-word ()
- "Return a possibly hyphenated word at point.
-If the word starts at the first non-whitespace column, and the
-previous line ends with a hyphen, return the last word on the previous
-line instead. Thus, if a reference to \"tcgetpgrp(3V)\" is hyphenated
-as \"tcgetp-grp(3V)\", and point is at \"grp(3V)\", we return
-\"tcgetp-\" instead of \"grp\"."
- (save-excursion
- (skip-syntax-backward "w()")
- (skip-chars-forward " \t")
- (let ((beg (point))
- (word (current-word)))
- (when (eq beg (save-excursion
- (back-to-indentation)
- (point)))
- (end-of-line 0)
- (if (eq (char-before) ?-)
- (setq word (current-word))))
- word)))
+;; (defun Man-possibly-hyphenated-word ()
+;; "Return a possibly hyphenated word at point.
+;; If the word starts at the first non-whitespace column, and the
+;; previous line ends with a hyphen, return the last word on the previous
+;; line instead. Thus, if a reference to \"tcgetpgrp(3V)\" is hyphenated
+;; as \"tcgetp-grp(3V)\", and point is at \"grp(3V)\", we return
+;; \"tcgetp-\" instead of \"grp\"."
+;; (save-excursion
+;; (skip-syntax-backward "w()")
+;; (skip-chars-forward " \t")
+;; (let ((beg (point))
+;; (word (current-word)))
+;; (when (eq beg (save-excursion
+;; (back-to-indentation)
+;; (point)))
+;; (end-of-line 0)
+;; (if (eq (char-before) ?-)
+;; (setq word (current-word))))
+;; word)))
(defvar Man--last-refpage nil)
@@ -1752,14 +1790,14 @@ Specify which REFERENCE to use; default is based on word at point."
(let* ((default (or
(car (all-completions
(let ((word
- (or (Man-possibly-hyphenated-word)
- "")))
+ (or (Man-default-man-entry)
+ "")))
;; strip a trailing '-':
- (if (string-match "-$" word)
- (substring word 0
- (match-beginning 0))
- word))
- Man--refpages))
+ ;; (if (string-match "-$" word)
+ ;; (substring word 0
+ ;; (match-beginning 0))
+ ;; word))
+ Man--refpages)))
(if (member Man--last-refpage Man--refpages)
Man--last-refpage
(car Man--refpages))))
^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#19359: [PATCHES] Buttons in man pages
2014-12-12 13:49 bug#19359: [PATCHES] Buttons in man pages Álvar Ibeas
` (2 preceding siblings ...)
2014-12-17 22:15 ` Álvar Ibeas
@ 2019-06-25 21:03 ` Lars Ingebrigtsen
3 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2019-06-25 21:03 UTC (permalink / raw)
To: Álvar Ibeas; +Cc: 19359
ibeas@gmx.com (Álvar Ibeas) writes:
>
> 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)'.
I'm unable to reproduce this on the Emacs trunk, so I would guess this
has been fixed by now, and I'm closing this bug report. If it's still
present, please reopen.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [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).