comparison lisp/info.el @ 107859:1a6d2311d8d5

Simplify by using `define-derived-mode'. * info.el (Info-mode): * calendar/todo-mode.el (todo-mode): * play/gomoku.el (gomoku-mode): Define with `define-derived-mode'. (gomoku-mode-map): Move initialization into declaration.
author Juanma Barranquero <lekktu@gmail.com>
date Thu, 15 Apr 2010 03:12:20 +0200
parents f0ec21d379ff
children c168d4537385
comparison
equal deleted inserted replaced
107858:57532220127a 107859:1a6d2311d8d5
3831 (defvar tool-bar-map) 3831 (defvar tool-bar-map)
3832 (defvar bookmark-make-record-function) 3832 (defvar bookmark-make-record-function)
3833 3833
3834 ;; Autoload cookie needed by desktop.el 3834 ;; Autoload cookie needed by desktop.el
3835 ;;;###autoload 3835 ;;;###autoload
3836 (defun Info-mode () 3836 (define-derived-mode Info-mode nil "Info"
3837 "Info mode provides commands for browsing through the Info documentation tree. 3837 "Info mode provides commands for browsing through the Info documentation tree.
3838 Documentation in Info is divided into \"nodes\", each of which discusses 3838 Documentation in Info is divided into \"nodes\", each of which discusses
3839 one topic and contains references to other nodes which discuss related 3839 one topic and contains references to other nodes which discuss related
3840 topics. Info has commands to follow the references and show you other nodes. 3840 topics. Info has commands to follow the references and show you other nodes.
3841 3841
3893 Every third `*' is highlighted to help pick the right number. 3893 Every third `*' is highlighted to help pick the right number.
3894 \\[Info-copy-current-node-name] Put name of current Info node in the kill ring. 3894 \\[Info-copy-current-node-name] Put name of current Info node in the kill ring.
3895 \\[clone-buffer] Select a new cloned Info buffer in another window. 3895 \\[clone-buffer] Select a new cloned Info buffer in another window.
3896 \\[universal-argument] \\[info] Move to new Info file with completion. 3896 \\[universal-argument] \\[info] Move to new Info file with completion.
3897 \\[universal-argument] N \\[info] Select Info buffer with prefix number in the name *info*<N>." 3897 \\[universal-argument] N \\[info] Select Info buffer with prefix number in the name *info*<N>."
3898 (kill-all-local-variables) 3898 :syntax-table text-mode-syntax-table
3899 (setq major-mode 'Info-mode) 3899 :abbrev-table text-mode-abbrev-table
3900 (setq mode-name "Info")
3901 (setq tab-width 8) 3900 (setq tab-width 8)
3902 (use-local-map Info-mode-map)
3903 (add-hook 'activate-menubar-hook 'Info-menu-update nil t) 3901 (add-hook 'activate-menubar-hook 'Info-menu-update nil t)
3904 (set-syntax-table text-mode-syntax-table)
3905 (setq local-abbrev-table text-mode-abbrev-table)
3906 (setq case-fold-search t) 3902 (setq case-fold-search t)
3907 (setq buffer-read-only t) 3903 (setq buffer-read-only t)
3908 (make-local-variable 'Info-current-file) 3904 (make-local-variable 'Info-current-file)
3909 (make-local-variable 'Info-current-subfile) 3905 (make-local-variable 'Info-current-subfile)
3910 (make-local-variable 'Info-current-node) 3906 (make-local-variable 'Info-current-node)
3911 (make-local-variable 'Info-tag-table-marker) 3907 (set (make-local-variable 'Info-tag-table-marker) (make-marker))
3912 (setq Info-tag-table-marker (make-marker)) 3908 (set (make-local-variable 'Info-tag-table-buffer) nil)
3913 (make-local-variable 'Info-tag-table-buffer)
3914 (setq Info-tag-table-buffer nil)
3915 (make-local-variable 'Info-history) 3909 (make-local-variable 'Info-history)
3916 (make-local-variable 'Info-history-forward) 3910 (make-local-variable 'Info-history-forward)
3917 (make-local-variable 'Info-index-alternatives) 3911 (make-local-variable 'Info-index-alternatives)
3918 (if Info-use-header-line ; do not override global header lines 3912 (if Info-use-header-line ; do not override global header lines
3919 (setq header-line-format 3913 (setq header-line-format
3920 '(:eval (get-text-property (point-min) 'header-line)))) 3914 '(:eval (get-text-property (point-min) 'header-line))))
3921 (set (make-local-variable 'tool-bar-map) info-tool-bar-map) 3915 (set (make-local-variable 'tool-bar-map) info-tool-bar-map)
3922 ;; This is for the sake of the invisible text we use handling titles. 3916 ;; This is for the sake of the invisible text we use handling titles.
3923 (make-local-variable 'line-move-ignore-invisible) 3917 (set (make-local-variable 'line-move-ignore-invisible) t)
3924 (setq line-move-ignore-invisible t) 3918 (set (make-local-variable 'desktop-save-buffer)
3925 (make-local-variable 'desktop-save-buffer) 3919 'Info-desktop-buffer-misc-data)
3926 (make-local-variable 'widen-automatically) 3920 (set (make-local-variable 'widen-automatically) nil)
3927 (setq widen-automatically nil)
3928 (setq desktop-save-buffer 'Info-desktop-buffer-misc-data)
3929 (add-hook 'kill-buffer-hook 'Info-kill-buffer nil t) 3921 (add-hook 'kill-buffer-hook 'Info-kill-buffer nil t)
3930 (add-hook 'clone-buffer-hook 'Info-clone-buffer nil t) 3922 (add-hook 'clone-buffer-hook 'Info-clone-buffer nil t)
3931 (add-hook 'change-major-mode-hook 'font-lock-defontify nil t) 3923 (add-hook 'change-major-mode-hook 'font-lock-defontify nil t)
3932 (add-hook 'isearch-mode-hook 'Info-isearch-start nil t) 3924 (add-hook 'isearch-mode-hook 'Info-isearch-start nil t)
3933 (set (make-local-variable 'isearch-search-fun-function) 3925 (set (make-local-variable 'isearch-search-fun-function)
3942 Info-search-whitespace-regexp) 3934 Info-search-whitespace-regexp)
3943 (set (make-local-variable 'revert-buffer-function) 3935 (set (make-local-variable 'revert-buffer-function)
3944 'Info-revert-buffer-function) 3936 'Info-revert-buffer-function)
3945 (Info-set-mode-line) 3937 (Info-set-mode-line)
3946 (set (make-local-variable 'bookmark-make-record-function) 3938 (set (make-local-variable 'bookmark-make-record-function)
3947 'Info-bookmark-make-record) 3939 'Info-bookmark-make-record))
3948 (run-mode-hooks 'Info-mode-hook))
3949 3940
3950 ;; When an Info buffer is killed, make sure the associated tags buffer 3941 ;; When an Info buffer is killed, make sure the associated tags buffer
3951 ;; is killed too. 3942 ;; is killed too.
3952 (defun Info-kill-buffer () 3943 (defun Info-kill-buffer ()
3953 (and (eq major-mode 'Info-mode) 3944 (and (eq major-mode 'Info-mode)