aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLute Kamstra2005-06-13 08:22:34 +0000
committerLute Kamstra2005-06-13 08:22:34 +0000
commit63e9aa8ee8daa065664f97a03b93387b3f39c9f5 (patch)
tree3d5febdc71ea7e366114f4487cf24efb400df896
parentdd72a03ac28d34e970c073949f4819999fef1360 (diff)
downloademacs-63e9aa8ee8daa065664f97a03b93387b3f39c9f5.tar.gz
emacs-63e9aa8ee8daa065664f97a03b93387b3f39c9f5.zip
(woman-mode-line-format): Delete constant.
(woman-mode-map): Initialize it properly. (woman-mode): Set mode-class property to special. Use delay-mode-hooks and run-mode-hooks. Use the right keymap. Set major-mode and mode-name. Don't set mode-line-format directly. (Man-getpage-in-background): Don't reference woman-mode-line-format.
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/woman.el74
2 files changed, 37 insertions, 45 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0dd7b735ee6..f9ec346596c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,13 @@
12005-06-13 Lute Kamstra <lute@gnu.org> 12005-06-13 Lute Kamstra <lute@gnu.org>
2 2
3 * woman.el (woman-mode-line-format): Delete constant.
4 (woman-mode-map): Initialize it properly.
5 (woman-mode): Set mode-class property to special. Use
6 delay-mode-hooks and run-mode-hooks. Use the right keymap. Set
7 major-mode and mode-name. Don't set mode-line-format directly.
8 (Man-getpage-in-background): Don't reference
9 woman-mode-line-format.
10
3 * emacs-lisp/debug.el (cancel-debug-on-entry): Make the empty 11 * emacs-lisp/debug.el (cancel-debug-on-entry): Make the empty
4 string argument obsolete. 12 string argument obsolete.
5 13
diff --git a/lisp/woman.el b/lisp/woman.el
index cb0bbfd7c12..de7d557f856 100644
--- a/lisp/woman.el
+++ b/lisp/woman.el
@@ -1035,18 +1035,6 @@ Set by `.ns' request; reset by any output or `.rs' request")
1035 "Set `woman-nospace' to nil." 1035 "Set `woman-nospace' to nil."
1036 (setq woman-nospace nil)) 1036 (setq woman-nospace nil))
1037 1037
1038(defconst woman-mode-line-format
1039 ;; This is essentially the Man-mode format with page numbers removed
1040 ;; and line numbers added. (Online documents do not have pages, but
1041 ;; they do have lines!)
1042 '("-" mode-line-mule-info mode-line-modified
1043 mode-line-frame-identification mode-line-buffer-identification
1044 " " global-mode-string
1045 " %[(WoMan" mode-line-process minor-mode-alist ")%]--"
1046 (line-number-mode "L%l--")
1047 (-3 . "%p") "-%-")
1048 "Mode line format for WoMan buffer.")
1049
1050(defconst woman-request-regexp "^[.'][ \t]*\\(\\S +\\) *" 1038(defconst woman-request-regexp "^[.'][ \t]*\\(\\S +\\) *"
1051 ;; Was "^\\.[ \t]*\\([a-z0-9]+\\) *" but cvs.1 uses a macro named 1039 ;; Was "^\\.[ \t]*\\([a-z0-9]+\\) *" but cvs.1 uses a macro named
1052 ;; "`" and CGI.man uses a macro named "''"! 1040 ;; "`" and CGI.man uses a macro named "''"!
@@ -1745,15 +1733,10 @@ Leave point at end of new text. Return length of inserted text."
1745 1733
1746(defvar woman-mode-map nil "Keymap for woman mode.") 1734(defvar woman-mode-map nil "Keymap for woman mode.")
1747 1735
1748(if woman-mode-map 1736(unless woman-mode-map
1749 () 1737 (setq woman-mode-map (make-sparse-keymap))
1750 ;; Set up the keymap, mostly inherited from Man-mode-map. Normally
1751 ;; button-buffer-map is used as a parent keymap, but we can't have two
1752 ;; parents, so we just copy it.
1753 (setq woman-mode-map (copy-keymap button-buffer-map))
1754 (set-keymap-parent woman-mode-map Man-mode-map) 1738 (set-keymap-parent woman-mode-map Man-mode-map)
1755 ;; Above two lines were 1739
1756 ;; (setq woman-mode-map (cons 'keymap Man-mode-map))
1757 (define-key woman-mode-map "R" 'woman-reformat-last-file) 1740 (define-key woman-mode-map "R" 'woman-reformat-last-file)
1758 (define-key woman-mode-map "w" 'woman) 1741 (define-key woman-mode-map "w" 'woman)
1759 (define-key woman-mode-map "\en" 'WoMan-next-manpage) 1742 (define-key woman-mode-map "\en" 'WoMan-next-manpage)
@@ -1841,6 +1824,8 @@ Argument EVENT is the invoking mouse event."
1841 (setq woman-emulation value) 1824 (setq woman-emulation value)
1842 (woman-reformat-last-file)) 1825 (woman-reformat-last-file))
1843 1826
1827(put 'woman-mode 'mode-class 'special)
1828
1844(defun woman-mode () 1829(defun woman-mode ()
1845 "Turn on (most of) Man mode to browse a buffer formatted by WoMan. 1830 "Turn on (most of) Man mode to browse a buffer formatted by WoMan.
1846WoMan is an ELisp emulation of much of the functionality of the Emacs 1831WoMan is an ELisp emulation of much of the functionality of the Emacs
@@ -1858,34 +1843,33 @@ See `Man-mode' for additional details."
1858 (fset 'Man-unindent 'ignore) 1843 (fset 'Man-unindent 'ignore)
1859 (fset 'Man-goto-page 'ignore) 1844 (fset 'Man-goto-page 'ignore)
1860 (unwind-protect 1845 (unwind-protect
1861 (progn 1846 (delay-mode-hooks (Man-mode))
1862 (set (make-local-variable 'Man-mode-map) woman-mode-map)
1863 ;; Install Man mode:
1864 (Man-mode)
1865 ;; Reset inappropriate definitions:
1866 (setq mode-line-format woman-mode-line-format)
1867 (put 'Man-mode 'mode-class 'special))
1868 ;; Restore the status quo: 1847 ;; Restore the status quo:
1869 (fset 'Man-build-page-list Man-build-page-list) 1848 (fset 'Man-build-page-list Man-build-page-list)
1870 (fset 'Man-strip-page-headers Man-strip-page-headers) 1849 (fset 'Man-strip-page-headers Man-strip-page-headers)
1871 (fset 'Man-unindent Man-unindent) 1850 (fset 'Man-unindent Man-unindent)
1872 (fset 'Man-goto-page Man-goto-page) 1851 (fset 'Man-goto-page Man-goto-page)))
1873 ) 1852 (setq major-mode 'woman-mode
1874 ;; Imenu support: 1853 mode-name "WoMan")
1875 (set (make-local-variable 'imenu-generic-expression) 1854 ;; Don't show page numbers like Man-mode does. (Online documents do
1876 ;; `make-local-variable' in case imenu not yet loaded! 1855 ;; not have pages)
1877 woman-imenu-generic-expression) 1856 (kill-local-variable 'mode-line-buffer-identification)
1878 (set (make-local-variable 'imenu-space-replacement) " ") 1857 (use-local-map woman-mode-map)
1879 ;; For reformat ... 1858 ;; Imenu support:
1880 ;; necessary when reformatting a file in its old buffer: 1859 (set (make-local-variable 'imenu-generic-expression)
1881 (setq imenu--last-menubar-index-alist nil) 1860 ;; `make-local-variable' in case imenu not yet loaded!
1882 ;; necessary to avoid re-installing the same imenu: 1861 woman-imenu-generic-expression)
1883 (setq woman-imenu-done nil) 1862 (set (make-local-variable 'imenu-space-replacement) " ")
1884 (if woman-imenu (woman-imenu)) 1863 ;; For reformat ...
1885 (setq buffer-read-only nil) 1864 ;; necessary when reformatting a file in its old buffer:
1886 (Man-highlight-references) 1865 (setq imenu--last-menubar-index-alist nil)
1887 (setq buffer-read-only t) 1866 ;; necessary to avoid re-installing the same imenu:
1888 (set-buffer-modified-p nil))) 1867 (setq woman-imenu-done nil)
1868 (if woman-imenu (woman-imenu))
1869 (let (buffer-read-only)
1870 (Man-highlight-references))
1871 (set-buffer-modified-p nil)
1872 (run-mode-hooks 'woman-mode-hook))
1889 1873
1890(defun woman-imenu (&optional redraw) 1874(defun woman-imenu (&optional redraw)
1891 "Add a \"Contents\" menu to the menubar. 1875 "Add a \"Contents\" menu to the menubar.
@@ -1962,7 +1946,7 @@ Optional argument REDRAW, if non-nil, forces mode line to be updated."
1962 (around Man-getpage-in-background-advice (topic) activate) 1946 (around Man-getpage-in-background-advice (topic) activate)
1963 "Use WoMan unless invoked outside a WoMan buffer or invoked explicitly. 1947 "Use WoMan unless invoked outside a WoMan buffer or invoked explicitly.
1964Otherwise use Man and record start of formatting time." 1948Otherwise use Man and record start of formatting time."
1965 (if (and (eq mode-line-format woman-mode-line-format) 1949 (if (and (eq major-mode 'woman-mode)
1966 (not (eq (caar command-history) 'man))) 1950 (not (eq (caar command-history) 'man)))
1967 (WoMan-getpage-in-background topic) 1951 (WoMan-getpage-in-background topic)
1968 ;; Initiates man processing 1952 ;; Initiates man processing