bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: man mode mouse over SEE ALSO items


From: Kevin Rodgers
Subject: Re: man mode mouse over SEE ALSO items
Date: Wed, 21 Apr 2004 08:40:43 -0600

> 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  <address@hidden>
> 
>       * 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]