1741 |
(define-key woman-mode-map "w" 'woman) |
(define-key woman-mode-map "w" 'woman) |
1742 |
(define-key woman-mode-map "\en" 'WoMan-next-manpage) |
(define-key woman-mode-map "\en" 'WoMan-next-manpage) |
1743 |
(define-key woman-mode-map "\ep" 'WoMan-previous-manpage) |
(define-key woman-mode-map "\ep" 'WoMan-previous-manpage) |
1744 |
(define-key woman-mode-map [M-mouse-2] 'woman-follow-word)) |
(define-key woman-mode-map [M-mouse-2] 'woman-follow-word) |
1745 |
|
|
1746 |
|
;; We don't need to call `man' when we are in `woman-mode'. |
1747 |
|
(define-key woman-mode-map [remap man] 'woman)) |
1748 |
|
|
1749 |
(defun woman-follow-word (event) |
(defun woman-follow-word (event) |
1750 |
"Run WoMan with word under mouse as topic. |
"Run WoMan with word under mouse as topic. |
1945 |
(defvar WoMan-Man-start-time nil |
(defvar WoMan-Man-start-time nil |
1946 |
"Used to record formatting time used by the `man' command.") |
"Used to record formatting time used by the `man' command.") |
1947 |
|
|
1948 |
(defadvice Man-getpage-in-background |
;; Both advices are disabled because "a file in Emacs should not put |
1949 |
(around Man-getpage-in-background-advice (topic) activate) |
;; advice on a function in Emacs" (see Info node "(elisp)Advising |
1950 |
"Use WoMan unless invoked outside a WoMan buffer or invoked explicitly. |
;; Functions"). Counting the formatting time is useful for |
1951 |
Otherwise use Man and record start of formatting time." |
;; developping, but less applicable for daily use. The advice for |
1952 |
(if (and (eq major-mode 'woman-mode) |
;; `Man-getpage-in-background' can be discarded, because the |
1953 |
(not (eq (caar command-history) 'man))) |
;; key-binding in `woman-mode-map' has been remapped to call `woman' |
1954 |
(WoMan-getpage-in-background topic) |
;; but `man'. Michael Albinus <michael.albinus@gmx.de> |
1955 |
;; Initiates man processing |
|
1956 |
(setq WoMan-Man-start-time (current-time)) |
;; (defadvice Man-getpage-in-background |
1957 |
ad-do-it)) |
;; (around Man-getpage-in-background-advice (topic) activate) |
1958 |
|
;; "Use WoMan unless invoked outside a WoMan buffer or invoked explicitly. |
1959 |
(defadvice Man-bgproc-sentinel |
;; Otherwise use Man and record start of formatting time." |
1960 |
(after Man-bgproc-sentinel-advice activate) |
;; (if (and (eq major-mode 'woman-mode) |
1961 |
;; Terminates man processing |
;; (not (eq (caar command-history) 'man))) |
1962 |
"Report formatting time." |
;; (WoMan-getpage-in-background topic) |
1963 |
(let* ((time (current-time)) |
;; ;; Initiates man processing |
1964 |
(time (+ (* (- (car time) (car WoMan-Man-start-time)) 65536) |
;; (setq WoMan-Man-start-time (current-time)) |
1965 |
(- (cadr time) (cadr WoMan-Man-start-time))))) |
;; ad-do-it)) |
1966 |
(message "Man formatting done in %d seconds" time))) |
|
1967 |
|
;; (defadvice Man-bgproc-sentinel |
1968 |
|
;; (after Man-bgproc-sentinel-advice activate) |
1969 |
|
;; ;; Terminates man processing |
1970 |
|
;; "Report formatting time." |
1971 |
|
;; (let* ((time (current-time)) |
1972 |
|
;; (time (+ (* (- (car time) (car WoMan-Man-start-time)) 65536) |
1973 |
|
;; (- (cadr time) (cadr WoMan-Man-start-time))))) |
1974 |
|
;; (message "Man formatting done in %d seconds" time))) |
1975 |
|
|
1976 |
|
|
1977 |
;;; Buffer handling: |
;;; Buffer handling: |