diff options
| author | Stefan Monnier | 2000-09-29 03:36:26 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2000-09-29 03:36:26 +0000 |
| commit | d8c201f535dc3573b0c7b0baa11b1fdface9f8f4 (patch) | |
| tree | 12bf14f742e24c5213f18ff7a6750426e8f6d7d2 | |
| parent | be5e3be3acf8bc9d9b55fb6f84b5c665b530f503 (diff) | |
| download | emacs-d8c201f535dc3573b0c7b0baa11b1fdface9f8f4.tar.gz emacs-d8c201f535dc3573b0c7b0baa11b1fdface9f8f4.zip | |
(outline-minor-mode): Use define-minor-mode.
(outline-mode): Use define-derived-mode.
| -rw-r--r-- | lisp/ChangeLog | 89 | ||||
| -rw-r--r-- | lisp/textmodes/outline.el | 76 |
2 files changed, 108 insertions, 57 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 20c42c0b704..edecf5ae141 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,92 @@ | |||
| 1 | 2000-09-28 Stefan Monnier <monnier@cs.yale.edu> | ||
| 2 | |||
| 3 | * textmodes/outline.el (outline-minor-mode): Use define-minor-mode. | ||
| 4 | (outline-mode): Use define-derived-mode. | ||
| 5 | |||
| 6 | * progmodes/perl-mode.el (perl-mode): | ||
| 7 | * progmodes/awk-mode.el (awk-mode): | ||
| 8 | * progmodes/asm-mode.el (asm-mode): | ||
| 9 | Don't gratuitously override the default for comment-column. | ||
| 10 | |||
| 11 | * emacs-lisp/lisp.el (lisp-complete-symbol): | ||
| 12 | Distinguish the let-binding case from the funcall case. | ||
| 13 | (forward-sexp-function): New variable. | ||
| 14 | (forward-sexp): Use it. | ||
| 15 | |||
| 16 | * emacs-lisp/easy-mmode.el (easy-mmode-define-keymap): Autoload. | ||
| 17 | (easy-mmode-defmap): Remove the now useless autoload. | ||
| 18 | |||
| 19 | * time.el (display-time-mode): Use define-minor-mode. | ||
| 20 | |||
| 21 | * subr.el (add-minor-mode): Don't eval NAME. | ||
| 22 | Don't depend on the presence of TOGGLE-FUN for any special behavior. | ||
| 23 | Use if rather than cond. | ||
| 24 | |||
| 25 | * simple.el (read-expression-map): Define more properly. | ||
| 26 | (comment-indent-hook): Remove. | ||
| 27 | (string-to-syntax): Bug fix. | ||
| 28 | |||
| 29 | * pcvs.el (cvs-ediff-exit-hook): Kill buffer before window. | ||
| 30 | (cvs-ediff-diff): Fix typo. | ||
| 31 | (cvs-revert-if-needed): Don't bother preserving read-only. | ||
| 32 | |||
| 33 | * paren.el (show-paren-mode): Use define-minor-mode. | ||
| 34 | |||
| 35 | * jka-compr.el (auto-compression-mode): Use define-minor-mode. | ||
| 36 | (toggle-auto-compression): Remove. | ||
| 37 | (jka-compr-build-file-regexp): Remove useless grouping. | ||
| 38 | |||
| 39 | * diff-mode.el (diff-mode-map, diff-minor-mode-prefix): | ||
| 40 | Avoid user-reserved bindings. | ||
| 41 | (diff-mode, diff-minor-mode): Drop make-local-hook (done by add-hook). | ||
| 42 | (diff-header-face): Revert to grey85. | ||
| 43 | |||
| 44 | * cvs-status.el (cvs-status-entry-leader-re): Minor fix. | ||
| 45 | |||
| 46 | * complete.el (partial-completion-mode) <defcustom>: Remove. | ||
| 47 | (partial-completion-mode): Use define-minor-mode. | ||
| 48 | (PC-do-completion): Understand `completion-auto-help = delay' | ||
| 49 | to mean to popup the completion buffer only the second time. | ||
| 50 | (PC-include-file-all-completions, PC-include-file-all-completions) | ||
| 51 | (PC-include-file-all-completions): Don't quote lambda. | ||
| 52 | |||
| 53 | * comint.el (comint-mode-hook): Docstring fix. | ||
| 54 | (comint-mode): Use define-derived-mode. | ||
| 55 | (comint-mode-map): Remove obsolete comment. | ||
| 56 | (make-comint): Minor stylistic change. | ||
| 57 | (comint-insert-clicked-input): Be more careful to find the overlay. | ||
| 58 | Use this-command-keys rather than hardcoding mouse-2. | ||
| 59 | |||
| 60 | * font-lock.el: Replace confusing (,@ with , | ||
| 61 | (tex-font-lock-keywords-1, tex-font-lock-keywords-2): | ||
| 62 | Don't use regexp-opt-depth. Spice up the regexp for args. | ||
| 63 | Don't distinguish between cmds that can take an opt arg or not. | ||
| 64 | Use `append' and `prepend' rather than `keep'. | ||
| 65 | |||
| 66 | * textmodes/tex-mode.el (latex-imenu-indent-string): Add a space. | ||
| 67 | (latex-outline-regexp): New var. | ||
| 68 | (latex-outline-level): New fun. | ||
| 69 | (latex-section-alist): New var. | ||
| 70 | (latex-imenu-create-index): Use it. Use `push' as well. | ||
| 71 | (tex-shell-map): Initialize it properly. | ||
| 72 | (tex-mode): Minor stylistic change. | ||
| 73 | (plain-tex-mode): Use define-derived-mode. | ||
| 74 | (latex-mode): Use define-derived-mode. | ||
| 75 | Construct the paragraph regexps in a more readable way. | ||
| 76 | Set the buffer-local outline-{level,regexp} vars. | ||
| 77 | (slitex-mode): Derive from latex-mode. | ||
| 78 | (tex-common-initialization): Don't kill-all-vars anymore. | ||
| 79 | Add setting for comment-add and font-lock-defaults. | ||
| 80 | (tex-start-shell): Use with-current-buffer and don't re-init keymap. | ||
| 81 | (tex-main-file): New fun. Obey TeX-master as well and remove `.tex'. | ||
| 82 | (tex-start-tex): New arg DIR (and send a chdir command for it). | ||
| 83 | Also display the shell buffer and save it in tex-last-buffer-texed. | ||
| 84 | (tex-region): Use expand-file-name rather than concat. | ||
| 85 | Remove code made useless by changes in tex-start-tex. | ||
| 86 | (tex-file): Use tex-main-file and adapt to new tex-start-tex. | ||
| 87 | |||
| 88 | * map-ynp.el (map-y-or-n-p): Fix missing backquotes. | ||
| 89 | |||
| 1 | 2000-09-28 Dave Love <fx@gnu.org> | 90 | 2000-09-28 Dave Love <fx@gnu.org> |
| 2 | 91 | ||
| 3 | * eshell/eshell.el (eshell) <defgroup>: Add :version. | 92 | * eshell/eshell.el (eshell) <defgroup>: Add :version. |
diff --git a/lisp/textmodes/outline.el b/lisp/textmodes/outline.el index 38a66239aa7..a42d2a1013d 100644 --- a/lisp/textmodes/outline.el +++ b/lisp/textmodes/outline.el | |||
| @@ -28,6 +28,10 @@ | |||
| 28 | ;; An outline can be `abstracted' to show headers at any given level, | 28 | ;; An outline can be `abstracted' to show headers at any given level, |
| 29 | ;; with all stuff below hidden. See the Emacs manual for details. | 29 | ;; with all stuff below hidden. See the Emacs manual for details. |
| 30 | 30 | ||
| 31 | ;;; Todo: | ||
| 32 | |||
| 33 | ;; - subtree-terminators | ||
| 34 | |||
| 31 | ;;; Code: | 35 | ;;; Code: |
| 32 | 36 | ||
| 33 | (defgroup outlines nil | 37 | (defgroup outlines nil |
| @@ -140,15 +144,6 @@ in the file it applies to." | |||
| 140 | (define-key outline-mode-map "\C-c" outline-mode-prefix-map) | 144 | (define-key outline-mode-map "\C-c" outline-mode-prefix-map) |
| 141 | (define-key outline-mode-map [menu-bar] outline-mode-menu-bar-map)) | 145 | (define-key outline-mode-map [menu-bar] outline-mode-menu-bar-map)) |
| 142 | 146 | ||
| 143 | (defcustom outline-minor-mode nil | ||
| 144 | "Non-nil if using Outline mode as a minor mode of some other mode." | ||
| 145 | :type 'boolean | ||
| 146 | :group 'outlines) | ||
| 147 | (make-variable-buffer-local 'outline-minor-mode) | ||
| 148 | (or (assq 'outline-minor-mode minor-mode-alist) | ||
| 149 | (setq minor-mode-alist (append minor-mode-alist | ||
| 150 | (list '(outline-minor-mode " Outl"))))) | ||
| 151 | |||
| 152 | (defvar outline-font-lock-keywords | 147 | (defvar outline-font-lock-keywords |
| 153 | '(;; | 148 | '(;; |
| 154 | ;; Highlight headings according to the level. | 149 | ;; Highlight headings according to the level. |
| @@ -181,7 +176,7 @@ in the file it applies to." | |||
| 181 | "Normal hook to be run after outline visibility changes.") | 176 | "Normal hook to be run after outline visibility changes.") |
| 182 | 177 | ||
| 183 | ;;;###autoload | 178 | ;;;###autoload |
| 184 | (defun outline-mode () | 179 | (define-derived-mode outline-mode text-mode "Outline" |
| 185 | "Set major mode for editing outlines with selective display. | 180 | "Set major mode for editing outlines with selective display. |
| 186 | Headings are lines which start with asterisks: one for major headings, | 181 | Headings are lines which start with asterisks: one for major headings, |
| 187 | two for subheadings, etc. Lines not starting with asterisks are body lines. | 182 | two for subheadings, etc. Lines not starting with asterisks are body lines. |
| @@ -220,34 +215,21 @@ beginning of the line. The longer the match, the deeper the level. | |||
| 220 | 215 | ||
| 221 | Turning on outline mode calls the value of `text-mode-hook' and then of | 216 | Turning on outline mode calls the value of `text-mode-hook' and then of |
| 222 | `outline-mode-hook', if they are non-nil." | 217 | `outline-mode-hook', if they are non-nil." |
| 223 | (interactive) | ||
| 224 | (kill-all-local-variables) | ||
| 225 | (use-local-map outline-mode-map) | ||
| 226 | (setq mode-name "Outline") | ||
| 227 | (setq major-mode 'outline-mode) | ||
| 228 | (define-abbrev-table 'text-mode-abbrev-table ()) | ||
| 229 | (setq local-abbrev-table text-mode-abbrev-table) | ||
| 230 | (set-syntax-table text-mode-syntax-table) | ||
| 231 | (make-local-variable 'line-move-ignore-invisible) | 218 | (make-local-variable 'line-move-ignore-invisible) |
| 232 | (setq line-move-ignore-invisible t) | 219 | (setq line-move-ignore-invisible t) |
| 233 | ;; Cause use of ellipses for invisible text. | 220 | ;; Cause use of ellipses for invisible text. |
| 234 | (add-to-invisibility-spec '(outline . t)) | 221 | (add-to-invisibility-spec '(outline . t)) |
| 235 | (make-local-variable 'paragraph-start) | 222 | (set (make-local-variable 'paragraph-start) |
| 236 | (setq paragraph-start (concat paragraph-start "\\|\\(" | 223 | (concat paragraph-start "\\|\\(" outline-regexp "\\)")) |
| 237 | outline-regexp "\\)")) | ||
| 238 | ;; Inhibit auto-filling of header lines. | 224 | ;; Inhibit auto-filling of header lines. |
| 239 | (make-local-variable 'auto-fill-inhibit-regexp) | 225 | (set (make-local-variable 'auto-fill-inhibit-regexp) outline-regexp) |
| 240 | (setq auto-fill-inhibit-regexp outline-regexp) | 226 | (set (make-local-variable 'paragraph-separate) |
| 241 | (make-local-variable 'paragraph-separate) | 227 | (concat paragraph-separate "\\|\\(" outline-regexp "\\)")) |
| 242 | (setq paragraph-separate (concat paragraph-separate "\\|\\(" | 228 | (set (make-local-variable 'font-lock-defaults) |
| 243 | outline-regexp "\\)")) | 229 | '(outline-font-lock-keywords t)) |
| 244 | (make-local-variable 'font-lock-defaults) | ||
| 245 | (setq font-lock-defaults '(outline-font-lock-keywords t)) | ||
| 246 | (make-local-variable 'change-major-mode-hook) | ||
| 247 | (setq imenu-generic-expression | 230 | (setq imenu-generic-expression |
| 248 | (list (list nil (concat outline-regexp ".*$") 0))) | 231 | (list (list nil (concat outline-regexp ".*$") 0))) |
| 249 | (add-hook 'change-major-mode-hook 'show-all) | 232 | (add-hook 'change-major-mode-hook 'show-all nil t)) |
| 250 | (run-hooks 'text-mode-hook 'outline-mode-hook)) | ||
| 251 | 233 | ||
| 252 | (defcustom outline-minor-mode-prefix "\C-c@" | 234 | (defcustom outline-minor-mode-prefix "\C-c@" |
| 253 | "*Prefix key to use for Outline commands in Outline minor mode. | 235 | "*Prefix key to use for Outline commands in Outline minor mode. |
| @@ -256,48 +238,28 @@ After that, changing the prefix key requires manipulating keymaps." | |||
| 256 | :type 'string | 238 | :type 'string |
| 257 | :group 'outlines) | 239 | :group 'outlines) |
| 258 | 240 | ||
| 259 | (defvar outline-minor-mode-map nil) | ||
| 260 | (if outline-minor-mode-map | ||
| 261 | nil | ||
| 262 | (setq outline-minor-mode-map (make-sparse-keymap)) | ||
| 263 | (define-key outline-minor-mode-map [menu-bar] | ||
| 264 | outline-mode-menu-bar-map) | ||
| 265 | (define-key outline-minor-mode-map outline-minor-mode-prefix | ||
| 266 | outline-mode-prefix-map)) | ||
| 267 | |||
| 268 | (or (assq 'outline-minor-mode minor-mode-map-alist) | ||
| 269 | (setq minor-mode-map-alist | ||
| 270 | (cons (cons 'outline-minor-mode outline-minor-mode-map) | ||
| 271 | minor-mode-map-alist))) | ||
| 272 | |||
| 273 | ;;;###autoload | 241 | ;;;###autoload |
| 274 | (defun outline-minor-mode (&optional arg) | 242 | (define-minor-mode outline-minor-mode |
| 275 | "Toggle Outline minor mode. | 243 | "Toggle Outline minor mode. |
| 276 | With arg, turn Outline minor mode on if arg is positive, off otherwise. | 244 | With arg, turn Outline minor mode on if arg is positive, off otherwise. |
| 277 | See the command `outline-mode' for more information on this mode." | 245 | See the command `outline-mode' for more information on this mode." |
| 278 | (interactive "P") | 246 | nil " Outl" (list (cons [menu-bar] outline-mode-menu-bar-map) |
| 279 | (setq outline-minor-mode | 247 | (cons outline-minor-mode-prefix outline-mode-prefix-map)) |
| 280 | (if (null arg) (not outline-minor-mode) | ||
| 281 | (> (prefix-numeric-value arg) 0))) | ||
| 282 | (if outline-minor-mode | 248 | (if outline-minor-mode |
| 283 | (progn | 249 | (progn |
| 284 | (make-local-hook 'change-major-mode-hook) | ||
| 285 | ;; Turn off this mode if we change major modes. | 250 | ;; Turn off this mode if we change major modes. |
| 286 | (add-hook 'change-major-mode-hook | 251 | (add-hook 'change-major-mode-hook |
| 287 | (lambda () (outline-minor-mode -1)) | 252 | (lambda () (outline-minor-mode -1)) |
| 288 | nil t) | 253 | nil t) |
| 289 | (make-local-variable 'line-move-ignore-invisible) | 254 | (set (make-local-variable 'line-move-ignore-invisible) t) |
| 290 | (setq line-move-ignore-invisible t) | ||
| 291 | ;; Cause use of ellipses for invisible text. | 255 | ;; Cause use of ellipses for invisible text. |
| 292 | (add-to-invisibility-spec '(outline . t)) | 256 | (add-to-invisibility-spec '(outline . t))) |
| 293 | (run-hooks 'outline-minor-mode-hook)) | ||
| 294 | (setq line-move-ignore-invisible nil) | 257 | (setq line-move-ignore-invisible nil) |
| 295 | ;; Cause use of ellipses for invisible text. | 258 | ;; Cause use of ellipses for invisible text. |
| 296 | (remove-from-invisibility-spec '(outline . t))) | 259 | (remove-from-invisibility-spec '(outline . t))) |
| 297 | ;; When turning off outline mode, get rid of any outline hiding. | 260 | ;; When turning off outline mode, get rid of any outline hiding. |
| 298 | (or outline-minor-mode | 261 | (or outline-minor-mode |
| 299 | (show-all)) | 262 | (show-all))) |
| 300 | (force-mode-line-update)) | ||
| 301 | 263 | ||
| 302 | (defcustom outline-level 'outline-level | 264 | (defcustom outline-level 'outline-level |
| 303 | "*Function of no args to compute a header's nesting level in an outline. | 265 | "*Function of no args to compute a header's nesting level in an outline. |