/[emacs]/emacs/lisp/man.el
ViewVC logotype

Diff of /emacs/lisp/man.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.155 by jet, Tue Oct 18 04:21:51 2005 UTC revision 1.156 by jet, Sun Nov 6 18:01:34 2005 UTC
# Line 286  This regexp should not start with a `^' Line 286  This regexp should not start with a `^'
286  This regular expression should start with a `^' character.")  This regular expression should start with a `^' character.")
287    
288  (defvar Man-reference-regexp  (defvar Man-reference-regexp
289    (concat "\\(" Man-name-regexp "\\)(\\(" Man-section-regexp "\\))")    (concat "\\(" Man-name-regexp "\\)[ \t]*(\\(" Man-section-regexp "\\))")
290    "Regular expression describing a reference to another manpage.")    "Regular expression describing a reference to another manpage.")
291    
292    (defvar Man-apropos-regexp
293      (concat "\\\[\\(" Man-name-regexp "\\)\\\][ \t]*(\\(" Man-section-regexp "\\))")
294      "Regular expression describing a reference to manpages in \"man -k output\".")
295    
296  (defvar Man-synopsis-regexp "SYNOPSIS"  (defvar Man-synopsis-regexp "SYNOPSIS"
297    "Regular expression for SYNOPSIS heading (or your equivalent).    "Regular expression for SYNOPSIS heading (or your equivalent).
298  This regexp should not start with a `^' character.")  This regexp should not start with a `^' character.")
# Line 421  Otherwise, the value is whatever the fun Line 425  Otherwise, the value is whatever the fun
425    'func nil    'func nil
426    'action (lambda (button) (funcall    'action (lambda (button) (funcall
427                              (button-get button 'func)                              (button-get button 'func)
428                              (button-label button))))                              (or (button-get button 'Man-target-string)
429                                    (button-label button)))))
430    
431  (define-button-type 'Man-xref-man-page  (define-button-type 'Man-xref-man-page
432    :supertype 'Man-abstract-xref-man-page    :supertype 'Man-abstract-xref-man-page
# Line 918  header file (#include <foo.h>) and files Line 923  header file (#include <foo.h>) and files
923  If XREF-MAN-TYPE is used as the button type for items  If XREF-MAN-TYPE is used as the button type for items
924  in SEE ALSO section. If it is nil, default type,  in SEE ALSO section. If it is nil, default type,
925  `Man-xref-man-page' is used."  `Man-xref-man-page' is used."
926    (let ((dummy 0))    (if (string-match "-k " Man-arguments)
927          (progn
928            (Man-highlight-references0
929             nil Man-reference-regexp 1 nil
930             (or xref-man-type 'Man-xref-man-page))
931            (Man-highlight-references0
932             nil Man-apropos-regexp 1 (lambda ()
933                                        (format "%s(%s)"
934                                                (match-string 1)
935                                                (match-string 2)))
936             (or xref-man-type 'Man-xref-man-page))
937            )
938      (Man-highlight-references0      (Man-highlight-references0
939       Man-see-also-regexp Man-reference-regexp 1 dummy       Man-see-also-regexp Man-reference-regexp 1 nil
940       (or xref-man-type 'Man-xref-man-page))       (or xref-man-type 'Man-xref-man-page))
941      (Man-highlight-references0      (Man-highlight-references0
942       Man-synopsis-regexp Man-header-regexp 0 2       Man-synopsis-regexp Man-header-regexp 0 2
# Line 929  in SEE ALSO section. If it is nil, defau Line 945  in SEE ALSO section. If it is nil, defau
945       Man-files-regexp Man-normal-file-regexp 0 0       Man-files-regexp Man-normal-file-regexp 0 0
946       'Man-xref-normal-file)))       'Man-xref-normal-file)))
947    
948  (defun Man-highlight-references0 (start-section regexp button-pos target-pos type)  (defun Man-highlight-references0 (start-section regexp button-pos target type)
949    ;; Based on `Man-build-references-alist'    ;; Based on `Man-build-references-alist'
950    (when (Man-find-section start-section)    (when (or (null start-section)
951      (forward-line 1)              (Man-find-section start-section))
952      (let ((end (save-excursion      (let ((end (if start-section
953                   (Man-next-section 1)                     (progn
954                   (point))))                       (forward-line 1)
955        (back-to-indentation)                       (back-to-indentation)
956                         (save-excursion
957                           (Man-next-section 1)
958                           (point)))
959                     (goto-char (point-min))
960                     (point-max))))
961        (while (re-search-forward regexp end t)        (while (re-search-forward regexp end t)
962          (make-text-button          (make-text-button
963           (match-beginning button-pos)           (match-beginning button-pos)
964           (match-end button-pos)           (match-end button-pos)
965           'type type           'type type
966           'Man-target-string (match-string target-pos)           'Man-target-string (cond
967           )))))                               ((numberp target)
968                                  (match-string target))
969                                 ((functionp target)
970                                  (funcall target))
971                                 (t nil)))))))
972    
973  (defun Man-cleanup-manpage (&optional interactive)  (defun Man-cleanup-manpage (&optional interactive)
974    "Remove overstriking and underlining from the current buffer.    "Remove overstriking and underlining from the current buffer.

Legend:
Removed from v.1.155  
changed lines
  Added in v.1.156

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26