]> git.eshelyaron.com Git - emacs.git/commitdiff
(outline-minor-mode): Use define-minor-mode.
authorStefan Monnier <monnier@iro.umontreal.ca>
Fri, 29 Sep 2000 03:36:26 +0000 (03:36 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Fri, 29 Sep 2000 03:36:26 +0000 (03:36 +0000)
(outline-mode): Use define-derived-mode.

lisp/ChangeLog
lisp/textmodes/outline.el

index 20c42c0b704bcabd05a8345c1f438d0e22ad4887..edecf5ae141082079c903256ff896512dcb8d6d7 100644 (file)
@@ -1,3 +1,92 @@
+2000-09-28  Stefan Monnier  <monnier@cs.yale.edu>
+
+       * textmodes/outline.el (outline-minor-mode): Use define-minor-mode.
+       (outline-mode): Use define-derived-mode.
+
+       * progmodes/perl-mode.el (perl-mode): 
+       * progmodes/awk-mode.el (awk-mode):
+       * progmodes/asm-mode.el (asm-mode):
+       Don't gratuitously override the default for comment-column.
+
+       * emacs-lisp/lisp.el (lisp-complete-symbol):
+       Distinguish the let-binding case from the funcall case.
+       (forward-sexp-function): New variable.
+       (forward-sexp): Use it.
+
+       * emacs-lisp/easy-mmode.el (easy-mmode-define-keymap): Autoload.
+       (easy-mmode-defmap): Remove the now useless autoload.
+
+       * time.el (display-time-mode): Use define-minor-mode.
+
+       * subr.el (add-minor-mode): Don't eval NAME.
+       Don't depend on the presence of TOGGLE-FUN for any special behavior.
+       Use if rather than cond.
+
+       * simple.el (read-expression-map): Define more properly.
+       (comment-indent-hook): Remove.
+       (string-to-syntax): Bug fix.
+
+       * pcvs.el (cvs-ediff-exit-hook): Kill buffer before window.
+       (cvs-ediff-diff): Fix typo.
+       (cvs-revert-if-needed): Don't bother preserving read-only.
+
+       * paren.el (show-paren-mode): Use define-minor-mode.
+
+       * jka-compr.el (auto-compression-mode): Use define-minor-mode.
+       (toggle-auto-compression): Remove.
+       (jka-compr-build-file-regexp): Remove useless grouping.
+
+       * diff-mode.el (diff-mode-map, diff-minor-mode-prefix):
+       Avoid user-reserved bindings.
+       (diff-mode, diff-minor-mode): Drop make-local-hook (done by add-hook).
+       (diff-header-face): Revert to grey85.
+
+       * cvs-status.el (cvs-status-entry-leader-re): Minor fix.
+
+       * complete.el (partial-completion-mode) <defcustom>: Remove.
+       (partial-completion-mode): Use define-minor-mode.
+       (PC-do-completion): Understand `completion-auto-help = delay'
+       to mean to popup the completion buffer only the second time.
+       (PC-include-file-all-completions, PC-include-file-all-completions) 
+       (PC-include-file-all-completions): Don't quote lambda.
+
+       * comint.el (comint-mode-hook): Docstring fix.
+       (comint-mode): Use define-derived-mode.
+       (comint-mode-map): Remove obsolete comment.
+       (make-comint): Minor stylistic change.
+       (comint-insert-clicked-input): Be more careful to find the overlay.
+       Use this-command-keys rather than hardcoding mouse-2.
+
+       * font-lock.el: Replace confusing (,@ with ,
+       (tex-font-lock-keywords-1, tex-font-lock-keywords-2):
+       Don't use regexp-opt-depth.  Spice up the regexp for args.
+       Don't distinguish between cmds that can take an opt arg or not.
+       Use `append' and `prepend' rather than `keep'.
+
+       * textmodes/tex-mode.el (latex-imenu-indent-string): Add a space.
+       (latex-outline-regexp): New var.
+       (latex-outline-level): New fun.
+       (latex-section-alist): New var.
+       (latex-imenu-create-index): Use it.  Use `push' as well.
+       (tex-shell-map): Initialize it properly.
+       (tex-mode): Minor stylistic change.
+       (plain-tex-mode): Use define-derived-mode.
+       (latex-mode): Use define-derived-mode.
+       Construct the paragraph regexps in a more readable way.
+       Set the buffer-local outline-{level,regexp} vars.
+       (slitex-mode): Derive from latex-mode.
+       (tex-common-initialization): Don't kill-all-vars anymore.
+       Add setting for comment-add and font-lock-defaults.
+       (tex-start-shell): Use with-current-buffer and don't re-init keymap.
+       (tex-main-file): New fun.  Obey TeX-master as well and remove `.tex'.
+       (tex-start-tex): New arg DIR (and send a chdir command for it).
+       Also display the shell buffer and save it in tex-last-buffer-texed.
+       (tex-region): Use expand-file-name rather than concat.
+       Remove code made useless by changes in tex-start-tex.
+       (tex-file): Use tex-main-file and adapt to new tex-start-tex.
+
+       * map-ynp.el (map-y-or-n-p): Fix missing backquotes.
+
 2000-09-28  Dave Love  <fx@gnu.org>
 
        * eshell/eshell.el (eshell) <defgroup>: Add :version.
index 38a66239aa7f4fb4f8f4502ea574da315335fc1c..a42d2a1013d87382904b97fec9cdcb3bc6112c70 100644 (file)
 ;; An outline can be `abstracted' to show headers at any given level,
 ;; with all stuff below hidden.  See the Emacs manual for details.
 
+;;; Todo:
+
+;; - subtree-terminators
+
 ;;; Code:
 
 (defgroup outlines nil
@@ -140,15 +144,6 @@ in the file it applies to."
   (define-key outline-mode-map "\C-c" outline-mode-prefix-map)
   (define-key outline-mode-map [menu-bar] outline-mode-menu-bar-map))
 
-(defcustom outline-minor-mode nil
-  "Non-nil if using Outline mode as a minor mode of some other mode."
-  :type 'boolean
-  :group 'outlines)
-(make-variable-buffer-local 'outline-minor-mode)
-(or (assq 'outline-minor-mode minor-mode-alist)
-    (setq minor-mode-alist (append minor-mode-alist
-                                  (list '(outline-minor-mode " Outl")))))
-
 (defvar outline-font-lock-keywords
   '(;;
     ;; Highlight headings according to the level.
@@ -181,7 +176,7 @@ in the file it applies to."
   "Normal hook to be run after outline visibility changes.")
 
 ;;;###autoload
-(defun outline-mode ()
+(define-derived-mode outline-mode text-mode "Outline"
   "Set major mode for editing outlines with selective display.
 Headings are lines which start with asterisks: one for major headings,
 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.
 
 Turning on outline mode calls the value of `text-mode-hook' and then of
 `outline-mode-hook', if they are non-nil."
-  (interactive)
-  (kill-all-local-variables)
-  (use-local-map outline-mode-map)
-  (setq mode-name "Outline")
-  (setq major-mode 'outline-mode)
-  (define-abbrev-table 'text-mode-abbrev-table ())
-  (setq local-abbrev-table text-mode-abbrev-table)
-  (set-syntax-table text-mode-syntax-table)
   (make-local-variable 'line-move-ignore-invisible)
   (setq line-move-ignore-invisible t)
   ;; Cause use of ellipses for invisible text.
   (add-to-invisibility-spec '(outline . t))
-  (make-local-variable 'paragraph-start)
-  (setq paragraph-start (concat paragraph-start "\\|\\("
-                               outline-regexp "\\)"))
+  (set (make-local-variable 'paragraph-start)
+       (concat paragraph-start "\\|\\(" outline-regexp "\\)"))
   ;; Inhibit auto-filling of header lines.
-  (make-local-variable 'auto-fill-inhibit-regexp)
-  (setq auto-fill-inhibit-regexp outline-regexp)
-  (make-local-variable 'paragraph-separate)
-  (setq paragraph-separate (concat paragraph-separate "\\|\\("
-                                  outline-regexp "\\)"))
-  (make-local-variable 'font-lock-defaults)
-  (setq font-lock-defaults '(outline-font-lock-keywords t))
-  (make-local-variable 'change-major-mode-hook)
+  (set (make-local-variable 'auto-fill-inhibit-regexp) outline-regexp)
+  (set (make-local-variable 'paragraph-separate)
+       (concat paragraph-separate "\\|\\(" outline-regexp "\\)"))
+  (set (make-local-variable 'font-lock-defaults)
+       '(outline-font-lock-keywords t))
   (setq imenu-generic-expression
        (list (list nil (concat outline-regexp ".*$") 0)))
-  (add-hook 'change-major-mode-hook 'show-all)
-  (run-hooks 'text-mode-hook 'outline-mode-hook))
+  (add-hook 'change-major-mode-hook 'show-all nil t))
 
 (defcustom outline-minor-mode-prefix "\C-c@"
   "*Prefix key to use for Outline commands in Outline minor mode.
@@ -256,48 +238,28 @@ After that, changing the prefix key requires manipulating keymaps."
   :type 'string
   :group 'outlines)
 
-(defvar outline-minor-mode-map nil)
-(if outline-minor-mode-map
-    nil
-  (setq outline-minor-mode-map (make-sparse-keymap))
-  (define-key outline-minor-mode-map [menu-bar]
-    outline-mode-menu-bar-map)
-  (define-key outline-minor-mode-map outline-minor-mode-prefix
-    outline-mode-prefix-map))
-
-(or (assq 'outline-minor-mode minor-mode-map-alist)
-    (setq minor-mode-map-alist
-         (cons (cons 'outline-minor-mode outline-minor-mode-map)
-               minor-mode-map-alist)))
-
 ;;;###autoload
-(defun outline-minor-mode (&optional arg)
+(define-minor-mode outline-minor-mode
   "Toggle Outline minor mode.
 With arg, turn Outline minor mode on if arg is positive, off otherwise.
 See the command `outline-mode' for more information on this mode."
-  (interactive "P")
-  (setq outline-minor-mode
-       (if (null arg) (not outline-minor-mode)
-         (> (prefix-numeric-value arg) 0)))
+  nil " Outl" (list (cons [menu-bar] outline-mode-menu-bar-map)
+                   (cons outline-minor-mode-prefix outline-mode-prefix-map))
   (if outline-minor-mode
       (progn
-       (make-local-hook 'change-major-mode-hook)
        ;; Turn off this mode if we change major modes.
        (add-hook 'change-major-mode-hook
                  (lambda () (outline-minor-mode -1))
                  nil t)
-       (make-local-variable 'line-move-ignore-invisible)
-       (setq line-move-ignore-invisible t)
+       (set (make-local-variable 'line-move-ignore-invisible) t)
        ;; Cause use of ellipses for invisible text.
-       (add-to-invisibility-spec '(outline . t))
-       (run-hooks 'outline-minor-mode-hook))
+       (add-to-invisibility-spec '(outline . t)))
     (setq line-move-ignore-invisible nil)
     ;; Cause use of ellipses for invisible text.
     (remove-from-invisibility-spec '(outline . t)))
   ;; When turning off outline mode, get rid of any outline hiding.
   (or outline-minor-mode
-      (show-all))
-  (force-mode-line-update))
+      (show-all)))
 \f
 (defcustom outline-level 'outline-level
   "*Function of no args to compute a header's nesting level in an outline.