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: Tue, 20 Apr 2004 12:02:46 -0600 Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: <16517.26054.118955.117704@ihs.com> References: 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 1082484738 17505 80.91.224.253 (20 Apr 2004 18:12:18 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 20 Apr 2004 18:12:18 +0000 (UTC) Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Apr 20 20:12:01 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 1BFziz-0008S4-00 for ; Tue, 20 Apr 2004 20:12:01 +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 1BFzeS-0005N8-VD for geb-bug-gnu-emacs@m.gmane.org; Tue, 20 Apr 2004 14:07:20 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1BFzdj-00059E-ET for bug-gnu-emacs@gnu.org; Tue, 20 Apr 2004 14:06:35 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1BFzd9-0004z0-CF for bug-gnu-emacs@gnu.org; Tue, 20 Apr 2004 14:06:30 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BFzd8-0004yp-UE for bug-gnu-emacs@gnu.org; Tue, 20 Apr 2004 14:05:58 -0400 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by fencepost.gnu.org with esmtp (Exim 4.24) id 1BFzc0-0001kN-Oy for gnu-emacs-bug@gnu.org; Tue, 20 Apr 2004 14:04:48 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1BFzcZ-0004jV-8c for gnu-emacs-bug@gnu.org; Tue, 20 Apr 2004 14:05:55 -0400 Original-Received: from [170.207.70.222] (helo=mail1.ihs.com) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BFzc0-0004Xr-7r for gnu-emacs-bug@gnu.org; Tue, 20 Apr 2004 14:04:48 -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 i3KI2du8004582 for ; Tue, 20 Apr 2004 12:02:39 -0600 (MDT) Original-To: gnu-emacs-bug@gnu.org 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:7671 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:7671 Dan Jacobson wrote: > I notice in man mode when placing the mouse over SEE ALSO items, > nothing special happens, and we cannot hit the middle button to go to > the man page referred to, although r RET gets us there fast enough. Here's a patch. Note that it does not handle hyphenated references. 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. *** emacs-21.3/lisp/man.el.orig Fri Oct 18 19:21:09 2002 --- emacs-21.3/lisp/man.el Tue Apr 20 10:27:15 2004 *************** *** 228,233 **** --- 228,236 ---- (defvar Man-mode-map nil "Keymap for Man mode.") + (defvar Man-mode-reference-map nil + "Keymap for highlighted references in Man mode.") + (defvar Man-mode-hook nil "Hook run when Man mode is enabled.") *************** *** 354,359 **** --- 357,368 ---- (define-key Man-mode-map "?" 'describe-mode) ) + (if Man-mode-reference-map + nil + (define-prefix-command 'Man-mode-reference-map) + (define-key Man-mode-reference-map [mouse-2] + 'Man-mouse-follow-manual-reference)) + ;; ====================================================================== ;; utilities *************** *** 904,910 **** (setq runningpoint (point)) (if (re-search-forward Man-hyphenated-reference-regexp end t) (let* ((word (Man-match-substring 0)) ! (len (1- (length word)))) (if hyphenated (setq word (concat hyphenated word) hyphenated nil --- 913,926 ---- (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 *************** *** 1121,1126 **** --- 1137,1151 ---- (Man-getpage-in-background (Man-translate-references (aheadsym Man-refpages-alist))))) + (defun Man-mouse-follow-manual-reference (click) + "Get the highlighted manpage under the mouse." + (interactive "e") + (save-excursion + (set-buffer (window-buffer (posn-window (event-start click)))) + (Man-follow-manual-reference + (get-text-property (posn-point (event-start click)) + 'Man-manual-reference)))) + (defun Man-kill () "Kill the buffer containing the manpage." (interactive) -- Kevin Rodgers