emacs-devel
[Top][All Lists]
Advanced

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

Re: address@hidden: Pressing RET in woman-mode calls man]


From: Masatake YAMATO
Subject: Re: address@hidden: Pressing RET in woman-mode calls man]
Date: Fri, 14 Oct 2005 01:53:00 +0900 (JST)

> > Pressing RET in woman-mode when point is on a "reference word" (e.g. in the
> > "SEE ALSO" section of the man page) invokes man, not woman, on the manpage.
> > The same applies to mouse-1 and mouse-2. Pressing C-h k in woman-mode gives
> > the following information:
> 
> I'll take charge of this issue.
> 
> I cannot remember the reason, but I did:
> 
> 2003-04-02  Masatake YAMATO  <address@hidden>
> 
>       * woman.el (woman-xref): Removed.
>       (woman-mode): Use `Man-highlight-references' instead of
>       `WoMan-highlight-references'.
>       (WoMan-highlight-references): Removed.
> 

I took a mistake when I unified common code in man.el and woman.el.
Here is the fix. If you think the patch is overkill, let me know.

2005-10-13  Masatake YAMATO  <address@hidden>

        * woman.el (WoMan-xref-man-page): New button type derived
        from `Man-abstract-xref-man-page'.
        (woman-mode): Pass `WoMan-xref-man-page' to 
        `Man-highlight-references'.

        * man.el (Man-abstract-xref-man-page): New button type.
        (Man-xref-man-page): Make it derived from `Man-abstract-xref-man-page'.
        (Man-highlight-references): Add new optiolnal argument `xref-man-type'. 

*** man.el      03 10月 2005 02:37:48 +0900    1.154
--- man.el      13 10月 2005 22:57:02 +0900    
***************
*** 415,424 ****
    (define-key Man-mode-map "?"    'describe-mode))
  
  ;; buttons
! (define-button-type 'Man-xref-man-page
!   'action (lambda (button) (man-follow (button-label button)))
    'follow-link t
!   'help-echo "mouse-2, RET: display this man page")
  
  (define-button-type 'Man-xref-header-file
      'action (lambda (button)
--- 415,432 ----
    (define-key Man-mode-map "?"    'describe-mode))
  
  ;; buttons
! (define-button-type 'Man-abstract-xref-man-page
    'follow-link t
!   'help-echo "mouse-2, RET: display this man page"
!   'func nil
!   'action (lambda (button) (funcall 
!                           (button-get button 'func)
!                           (button-label button))))
! 
! (define-button-type 'Man-xref-man-page 
!   :supertype 'Man-abstract-xref-man-page
!   'func 'man-follow)
! 
  
  (define-button-type 'Man-xref-header-file
      'action (lambda (button)
***************
*** 903,916 ****
                         'face Man-overstrike-face)))
    (message "%s man page formatted" Man-arguments))
  
! (defun Man-highlight-references ()
    "Highlight the references on mouse-over.
  References include items in the SEE ALSO section,
! header file (#include <foo.h>) and files in FILES."
    (let ((dummy 0))
      (Man-highlight-references0
       Man-see-also-regexp Man-reference-regexp 1 dummy
!      'Man-xref-man-page)
      (Man-highlight-references0
       Man-synopsis-regexp Man-header-regexp 0 2
       'Man-xref-header-file)
--- 911,927 ----
                         'face Man-overstrike-face)))
    (message "%s man page formatted" Man-arguments))
  
! (defun Man-highlight-references (&optional xref-man-type)
    "Highlight the references on mouse-over.
  References include items in the SEE ALSO section,
! header file (#include <foo.h>) and files in FILES.
! If XREF-MAN-TYPE is used as the button type for items
! in SEE ALSO section. If it is nil, default type, 
! `Man-xref-man-page' is used."
    (let ((dummy 0))
      (Man-highlight-references0
       Man-see-also-regexp Man-reference-regexp 1 dummy
!      (or xref-man-type 'Man-xref-man-page))
      (Man-highlight-references0
       Man-synopsis-regexp Man-header-regexp 0 2
       'Man-xref-header-file)
*** woman.el    03 10月 2005 02:37:50 +0900      1.40
--- woman.el    13 10月 2005 22:53:14 +0900      
***************
*** 424,429 ****
--- 424,434 ----
  (defvar woman-version "0.551 (beta)" "WoMan version information.")
  
  (require 'man)
+ (require 'button)
+ (define-button-type 'WoMan-xref-man-page 
+   :supertype 'Man-abstract-xref-man-page
+   'func 'woman)
+ 
  (eval-when-compile                    ; to avoid compiler warnings
    (require 'dired)
    (require 'apropos))
***************
*** 1864,1870 ****
    (setq woman-imenu-done nil)
    (if woman-imenu (woman-imenu))
    (let (buffer-read-only)
!     (Man-highlight-references))
    (set-buffer-modified-p nil)
    (run-mode-hooks 'woman-mode-hook))
  
--- 1869,1875 ----
    (setq woman-imenu-done nil)
    (if woman-imenu (woman-imenu))
    (let (buffer-read-only)
!     (Man-highlight-references 'WoMan-xref-man-page))
    (set-buffer-modified-p nil)
    (run-mode-hooks 'woman-mode-hook))
  

reply via email to

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