From: ibeas@gmx.com (Álvar Ibeas)
To: 19359@debbugs.gnu.org
Subject: bug#19359: Buttons in man pages
Date: Sun, 14 Dec 2014 01:40:39 +0100 [thread overview]
Message-ID: <87k31vhxmg.fsf@gmx.com> (raw)
In-Reply-To: <87a92tf066.fsf@gmx.com>
[-- 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)
next prev parent reply other threads:[~2014-12-14 0:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2014-12-17 22:15 ` bug#19359: " Álvar Ibeas
2019-06-25 21:03 ` bug#19359: [PATCHES] " Lars Ingebrigtsen
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k31vhxmg.fsf@gmx.com \
--to=ibeas@gmx.com \
--cc=19359@debbugs.gnu.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 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).