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: Buttons in man pages Date: Sun, 14 Dec 2014 01:40:39 +0100 Message-ID: <87k31vhxmg.fsf@gmx.com> References: <87a92tf066.fsf@gmx.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1418517688 22385 80.91.229.3 (14 Dec 2014 00:41:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 14 Dec 2014 00:41:28 +0000 (UTC) To: 19359@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Dec 14 01:41:21 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 1XzxFQ-0008Tc-Rb for geb-bug-gnu-emacs@m.gmane.org; Sun, 14 Dec 2014 01:41:21 +0100 Original-Received: from localhost ([::1]:34667 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XzxFQ-0004Ng-GG for geb-bug-gnu-emacs@m.gmane.org; Sat, 13 Dec 2014 19:41:20 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46288) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XzxFG-0004Nb-9t for bug-gnu-emacs@gnu.org; Sat, 13 Dec 2014 19:41:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XzxF8-0007YL-Jg for bug-gnu-emacs@gnu.org; Sat, 13 Dec 2014 19:41:10 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:35748) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XzxF8-0007YH-F9 for bug-gnu-emacs@gnu.org; Sat, 13 Dec 2014 19:41:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XzxF8-0001dd-55 for bug-gnu-emacs@gnu.org; Sat, 13 Dec 2014 19:41:02 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <87a92tf066.fsf@gmx.com> Resent-From: ibeas@gmx.com (=?UTF-8?Q?=C3=81lvar?= Ibeas) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 14 Dec 2014 00:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19359 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 19359-submit@debbugs.gnu.org id=B19359.14185176506270 (code B ref 19359); Sun, 14 Dec 2014 00:41:02 +0000 Original-Received: (at 19359) by debbugs.gnu.org; 14 Dec 2014 00:40:50 +0000 Original-Received: from localhost ([127.0.0.1]:45114 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XzxEv-0001d4-JE for submit@debbugs.gnu.org; Sat, 13 Dec 2014 19:40:50 -0500 Original-Received: from mout.gmx.net ([212.227.17.21]:49263) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XzxEt-0001cm-DP for 19359@debbugs.gnu.org; Sat, 13 Dec 2014 19:40:48 -0500 Original-Received: from yermo ([84.127.142.133]) by mail.gmx.com (mrgmx102) with ESMTPSA (Nemesis) id 0LjdS8-1XOPUe3Uk4-00bcMw; Sun, 14 Dec 2014 01:40:41 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) X-Provags-ID: V03:K0:FGeq3Mgujy49wnhE6oha+x0COj+S57VdrzQJorQmsm0BffOYfqC /zfjA6WP3iKJDzychpT9ySWGaEFXDezUVqLISFmwy4dT41b/dhgzUfTd9JnS7Vim4mM/SaW f2v6ZCTe8gXmgOfz1D4tgIQObYYRQ0JUe+uHj+7mddaOBF+uZTfs3aC1Hjdp1UZ1SU8mQB+ MsQOa+Yu7VvgwamjBDUHA== X-UI-Out-Filterresults: notjunk:1; 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:97301 Archived-At: --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: inline; filename=patch_a2 Content-Transfer-Encoding: quoted-printable Content-Description: patch_a2 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. =20 - + ;;; Code: =20 (require 'ansi-color) @@ -275,7 +275,7 @@ Used in `bookmark-set' to get the default bookmark name= ." :type 'hook :group 'man) =20 -(defvar Man-name-regexp "[-a-zA-Z0-9_=C2=AD+][-a-zA-Z0-9_.:=C2=AD+]*" +(defvar Man-name-regexp "[-a-zA-Z0-9_+][-a-zA-Z0-9_.:+]*" "Regular expression describing the name of a manpage (without section).") =20 (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.") =20 (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_.:=C2=AD+]*\\)?\\_>\\)[ \t]*(\\(" Man-section-regexp "\\))") "Regular expression describing a reference to another manpage.") =20 @@ -373,7 +373,7 @@ Otherwise, the value is whatever the function :type 'string :group 'man) =20 - + ;; 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") =20 - + ;; =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D ;; utilities =20 @@ -707,7 +707,7 @@ a \"/\" as a local filename. The function returns eith= er `man-db' 'man)))) Man-support-local-filenames)) =20 - + ;; =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D ;; default man entry: get word near point =20 @@ -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))))))) - - + (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))))))) + + ;; =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D ;; Top level command and background process sentinel =20 @@ -1455,7 +1457,7 @@ manpage command." (split-string args " "))) " ")) =20 - + ;; =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D ;; set up manual mode in buffer and build alists =20 @@ -1652,7 +1654,7 @@ The following key bindings are currently in effect in= the buffer: (forward-line 1))) )))) =20 - + ;; =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D ;; Man mode commands =20 @@ -1889,7 +1891,7 @@ Uses `Man-name-local-regexp'." (bookmark-default-handler `("" (buffer . ,buf) . ,(bookmark-get-bookmark-record bookmark))))) =20 - + ;; Init the man package variables, if not already done. (Man-init-defvars) =20 --=-=-=--