From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.bugs Subject: Re: man mode mouse over SEE ALSO items Date: Fri, 23 Apr 2004 12:47:19 -0600 Organization: Information Handling Services, Electronic Systems Development Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: <16521.25783.783741.857809@ihs.com> References: <16518.34795.676580.999220@ihs.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1082747272 19318 80.91.224.253 (23 Apr 2004 19:07:52 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 23 Apr 2004 19:07:52 +0000 (UTC) Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Apr 23 21:07:44 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BH61Y-0007W6-00 for ; Fri, 23 Apr 2004 21:07:44 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BH60z-0004zA-QR for geb-bug-gnu-emacs@m.gmane.org; Fri, 23 Apr 2004 15:07:09 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1BH5zm-0003vg-6o for bug-gnu-emacs@gnu.org; Fri, 23 Apr 2004 15:05:54 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1BH5z3-0003OV-65 for bug-gnu-emacs@gnu.org; Fri, 23 Apr 2004 15:05:40 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BH5z2-0003OL-Tx for bug-gnu-emacs@gnu.org; Fri, 23 Apr 2004 15:05:08 -0400 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by fencepost.gnu.org with esmtp (Exim 4.24) id 1BH5xR-0007Aq-PH for gnu-emacs-bug@gnu.org; Fri, 23 Apr 2004 15:03:29 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1BH5yK-0002rQ-3n for gnu-emacs-bug@gnu.org; Fri, 23 Apr 2004 15:04:55 -0400 Original-Received: from [170.207.70.222] (helo=mail1.ihs.com) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BH5hn-0006Fw-3c for gnu-emacs-bug@gnu.org; Fri, 23 Apr 2004 14:47:19 -0400 Original-Received: from briard.ihs.com (esd80.ihs.com [170.207.51.80]) by mail1.ihs.com (8.12.10/8.12.10) with SMTP id i3NIl6Ik018944 for ; Fri, 23 Apr 2004 12:47:07 -0600 (MDT) Original-To: gnu-emacs-bug@gnu.org In-Reply-To: <16518.34795.676580.999220@ihs.com> X-Mailer: VM 7.15 under Emacs 19.34.3 X-IHS-MailScanner: Found to be clean X-IHS-MailScanner-SpamCheck: X-IHS-MailScanner-Envelope-Sender: kevinr@ihs.com X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.4 Precedence: list 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 Xref: main.gmane.org gmane.emacs.bugs:7727 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:7727 Kevin Rodgers writes: > > Here's a patch. Note that it does not handle hyphenated references. > > That patch seems to have been corrupted, so I'm resending it. > > > 2004-04-20 Kevin Rodgers > > > > * man.el (Man-mode-reference-map): New variable and prefix command. > > (Man-mouse-follow-manual-reference): New command. > > (Man-build-references-alist): Add mouse-face, keymap, help-echo, > > and Man-manual-reference text properties to each reference. I now have hyphenated references working as well. Since RMS indicated that my previous patch will be accepted, I'm sending an add-on patch (instead of a replacement). 2004-04-22 Kevin Rodgers * man.el (Man-build-references-alist): Extend text properties over hyphenated references; avoid consing up a text property list for each reference; use match-string instead of Man-match-substring. *** emacs-21.3/lisp//man.el~ Tue Apr 20 10:27:15 2004 --- emacs-21.3/lisp//man.el Thu Apr 22 09:04:05 2004 *************** *** 903,909 **** (end (progn (Man-next-section 1) (point))) ! hyphenated (runningpoint -1)) (save-restriction (narrow-to-region start end) --- 903,911 ---- (end (progn (Man-next-section 1) (point))) ! hyphenated-ref ; string ! hyphenated-ref-beg ; buffer position ! hyphenated-ref-end ; buffer position (runningpoint -1)) (save-restriction (narrow-to-region start end) *************** *** 912,936 **** (while (and (not (eobp)) (/= (point) runningpoint)) (setq runningpoint (point)) (if (re-search-forward Man-hyphenated-reference-regexp end t) ! (let* ((word (Man-match-substring 0)) ! (len (1- (length word))) (inhibit-read-only t)) ! (add-text-properties (match-beginning 0) (match-end 0) ! `(mouse-face highlight ! keymap Man-mode-reference-map ! help-echo "mouse-2: \ ! follow this reference" ! Man-manual-reference ,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 (= (aref word len) ?-) ! (setq hyphenated (substring word 0 len))) ! (if (string-match Man-reference-regexp word) ! (aput 'Man-refpages-alist word)))) (skip-chars-forward " \t\n,")))))) (setq Man-refpages-alist (nreverse Man-refpages-alist))) --- 914,946 ---- (while (and (not (eobp)) (/= (point) runningpoint)) (setq runningpoint (point)) (if (re-search-forward Man-hyphenated-reference-regexp end t) ! (let* ((ref (match-string 0)) ! (ref-len (length ref)) ! (ref-beg (match-beginning 0)) ! (ref-end (match-end 0)) ! (ref-props '(mouse-face highlight ! keymap Man-mode-reference-map ! help-echo "mouse-2: \ ! follow this reference")) (inhibit-read-only t)) ! (if hyphenated-ref ! (progn ! (setq ref (concat hyphenated-ref ref) ! ref-len (length ref)) ! (add-text-properties hyphenated-ref-end ref-beg ! ref-props) ! (put-text-property hyphenated-ref-beg ref-beg ! 'Man-manual-reference ref))) ! (add-text-properties ref-beg ref-end ref-props) ! (put-text-property ref-beg ref-end ! 'Man-manual-reference ref) ! (if (= (aref ref (1- ref-len)) ?-) ! (setq hyphenated-ref-beg ref-beg ! hyphenated-ref-end ref-end ! hyphenated-ref (substring ref 0 (1- ref-len))) ! (setq hyphenated-ref nil)) ! (if (string-match Man-reference-regexp ref) ! (aput 'Man-refpages-alist ref)))) (skip-chars-forward " \t\n,")))))) (setq Man-refpages-alist (nreverse Man-refpages-alist))) -- Kevin Rodgers