unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* man mode mouse over SEE ALSO items
@ 2004-04-19  1:19 Dan Jacobson
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Jacobson @ 2004-04-19  1:19 UTC (permalink / raw)


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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: man mode mouse over SEE ALSO items
       [not found] <mailman.460.1082403123.1061.bug-gnu-emacs@gnu.org>
@ 2004-04-20 18:02 ` Kevin Rodgers
       [not found] ` <mailman.538.1082484399.1061.bug-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2004-04-20 18:02 UTC (permalink / raw)


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  <ihs_4664@yahoo.com>

	* 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))
+
   \f
   ;; ======================================================================
   ;; 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: man mode mouse over SEE ALSO items
       [not found] ` <mailman.538.1082484399.1061.bug-gnu-emacs@gnu.org>
@ 2004-04-21 14:40   ` Kevin Rodgers
  2004-04-23 18:47     ` Kevin Rodgers
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Rodgers @ 2004-04-21 14:40 UTC (permalink / raw)


> 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  <ihs_4664@yahoo.com>
> 
> 	* 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))
+     
  \f
  ;; ======================================================================
  ;; 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: man mode mouse over SEE ALSO items
  2004-04-21 14:40   ` Kevin Rodgers
@ 2004-04-23 18:47     ` Kevin Rodgers
  0 siblings, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2004-04-23 18:47 UTC (permalink / raw)


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  <ihs_4664@yahoo.com>
> > 
> > 	* 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  <ihs_4664@yahoo.com>

	* 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-04-23 18:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.460.1082403123.1061.bug-gnu-emacs@gnu.org>
2004-04-20 18:02 ` man mode mouse over SEE ALSO items Kevin Rodgers
     [not found] ` <mailman.538.1082484399.1061.bug-gnu-emacs@gnu.org>
2004-04-21 14:40   ` Kevin Rodgers
2004-04-23 18:47     ` Kevin Rodgers
2004-04-19  1:19 Dan Jacobson

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).