]> code.delx.au - gnu-emacs/blobdiff - lisp/foldout.el
Dired recognize dirs when file size in human units
[gnu-emacs] / lisp / foldout.el
index b0eaf753d60b600f858f94eec522362a7eedd4f4..dd01636d02b00b7b02d8222f2196e41b57a784ea 100644 (file)
@@ -1,9 +1,9 @@
 ;;; foldout.el --- folding extensions for outline-mode and outline-minor-mode
 
 ;;; foldout.el --- folding extensions for outline-mode and outline-minor-mode
 
-;; Copyright (C) 1994, 2001-201 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 2001-2016 Free Software Foundation, Inc.
 
 ;; Author: Kevin Broadey <KevinB@bartley.demon.co.uk>
 
 ;; Author: Kevin Broadey <KevinB@bartley.demon.co.uk>
-;; Maintainer: FSF
+;; Maintainer: emacs-devel@gnu.org
 ;; Created: 27 Jan 1994
 ;; Version: 1.10
 ;; Keywords: folding, outlines
 ;; Created: 27 Jan 1994
 ;; Version: 1.10
 ;; Keywords: folding, outlines
@@ -39,7 +39,7 @@
 ;; look under one of the level-2 headings, position the cursor on it and do C-c
 ;; C-z again.  This exposes the level-2 body and its level-3 child subheadings
 ;; and narrows the buffer again.  You can keep on zooming in on successive
 ;; look under one of the level-2 headings, position the cursor on it and do C-c
 ;; C-z again.  This exposes the level-2 body and its level-3 child subheadings
 ;; and narrows the buffer again.  You can keep on zooming in on successive
-;; subheadings as much as you like.  A string in the modeline tells you how
+;; subheadings as much as you like.  A string in the mode line tells you how
 ;; deep you've gone.
 ;;
 ;; When zooming in on a heading you might only want to see the child
 ;; deep you've gone.
 ;;
 ;; When zooming in on a heading you might only want to see the child
 ;; setup a lot easier.
 ;;
 ;; folding.el by Jamie Lokier <u90jl@ecs.ox.ac.uk> supports folding by
 ;; setup a lot easier.
 ;;
 ;; folding.el by Jamie Lokier <u90jl@ecs.ox.ac.uk> supports folding by
-;; recognising special marker text in you file.
+;; recognizing special marker text in you file.
 ;;
 ;;
-;; c-outline.el (by me) provides outline-mode support to recognise `C'
+;; c-outline.el (by me) provides outline-mode support to recognize `C'
 ;; statements as outline headings, so with foldout you can have a folding `C'
 ;; code editor without having to put in start- and end-of-fold markers.  This
 ;; is a real winner!
 ;; statements as outline headings, so with foldout you can have a folding `C'
 ;; code editor without having to put in start- and end-of-fold markers.  This
 ;; is a real winner!
 ;; shows only the subheadings.
 
 ;; 1.2   28-Jan-94
 ;; shows only the subheadings.
 
 ;; 1.2   28-Jan-94
-;; Fixed a dumb bug - didn't make `foldout-modeline-string' buffer-local :-(
+;; Fixed a dumb bug - didn't make `foldout-mode-line-string' buffer-local :-(
 ;;
 ;; Changed `foldout-exit-fold' to use prefix arg to say how many folds to exit.
 ;; Negative arg means exit but don't hide text.  Zero arg means exit all folds.
 ;;
 ;; Changed `foldout-exit-fold' to use prefix arg to say how many folds to exit.
 ;; Negative arg means exit but don't hide text.  Zero arg means exit all folds.
 An end marker of nil means the fold ends after (point-max).")
 (make-variable-buffer-local 'foldout-fold-list)
 
 An end marker of nil means the fold ends after (point-max).")
 (make-variable-buffer-local 'foldout-fold-list)
 
-(defvar foldout-modeline-string nil
-  "Modeline string announcing that we are in an outline fold.")
-(make-variable-buffer-local 'foldout-modeline-string)
+(defvar foldout-mode-line-string nil
+  "Mode line string announcing that we are in an outline fold.")
+(make-variable-buffer-local 'foldout-mode-line-string)
 
 ;; put our minor mode string immediately following outline-minor-mode's
 
 ;; put our minor mode string immediately following outline-minor-mode's
-(or (assq 'foldout-modeline-string minor-mode-alist)
+(or (assq 'foldout-mode-line-string minor-mode-alist)
     (let ((outl-entry (memq (assq 'outline-minor-mode minor-mode-alist)
                            minor-mode-alist))
     (let ((outl-entry (memq (assq 'outline-minor-mode minor-mode-alist)
                            minor-mode-alist))
-         (foldout-entry '((foldout-modeline-string foldout-modeline-string))))
+         (foldout-entry '((foldout-mode-line-string foldout-mode-line-string))))
 
       ;; something's wrong with outline if we can't find it
       (if (null outl-entry)
 
       ;; something's wrong with outline if we can't find it
       (if (null outl-entry)
@@ -250,7 +250,7 @@ An end marker of nil means the fold ends after (point-max).")
   "Open the subtree under the current heading and narrow to it.
 
 Normally the body and the immediate subheadings are exposed, but
   "Open the subtree under the current heading and narrow to it.
 
 Normally the body and the immediate subheadings are exposed, but
-optional arg EXPOSURE \(interactively with prefix arg\) changes this:-
+optional arg EXPOSURE \(interactively with prefix arg) changes this:-
 
        EXPOSURE > 0    exposes n levels of subheadings (c.f. show-children)
        EXPOSURE < 0    exposes only the body
 
        EXPOSURE > 0    exposes n levels of subheadings (c.f. show-children)
        EXPOSURE < 0    exposes only the body
@@ -280,24 +280,24 @@ optional arg EXPOSURE \(interactively with prefix arg\) changes this:-
       (goto-char start)
       (cond
        ((null exposure)
       (goto-char start)
       (cond
        ((null exposure)
-       (show-entry)
-       (show-children))
+       (outline-show-entry)
+       (outline-show-children))
        ((< exposure-value 0)
        ((< exposure-value 0)
-       (show-entry))
+       (outline-show-entry))
        ((consp exposure)
        ((consp exposure)
-       (show-children))
+       (outline-show-children))
        ((> exposure-value 0)
        ((> exposure-value 0)
-       (show-children exposure-value))
+       (outline-show-children exposure-value))
        (t
        (t
-       (show-subtree))
+       (outline-show-subtree))
        )
 
       ;; save the location of the fold we are entering
       (setq foldout-fold-list (cons (cons start-marker end-marker)
                                    foldout-fold-list))
 
        )
 
       ;; save the location of the fold we are entering
       (setq foldout-fold-list (cons (cons start-marker end-marker)
                                    foldout-fold-list))
 
-      ;; update the modeline
-      (foldout-update-modeline)
+      ;; update the mode line
+      (foldout-update-mode-line)
       )))
 \f
 
       )))
 \f
 
@@ -366,7 +366,7 @@ exited and text is left visible."
        ;; hide the subtree
        (when hide-fold
          (goto-char start-marker)
        ;; hide the subtree
        (when hide-fold
          (goto-char start-marker)
-         (hide-subtree))
+         (outline-hide-subtree))
 
        ;; make sure the next heading is exposed
        (if end-marker
 
        ;; make sure the next heading is exposed
        (if end-marker
@@ -375,8 +375,7 @@ exited and text is left visible."
 
       ;; zap the markers so they don't slow down editing
       (set-marker start-marker nil)
 
       ;; zap the markers so they don't slow down editing
       (set-marker start-marker nil)
-      (if end-marker (set-marker end-marker nil))
-      )
+      (if end-marker (set-marker end-marker nil)))
 
     ;; narrow to the enclosing fold if there is one
     (if foldout-fold-list
 
     ;; narrow to the enclosing fold if there is one
     (if foldout-fold-list
@@ -386,32 +385,29 @@ exited and text is left visible."
          (narrow-to-region start-marker
                            (if end-marker
                                (1- (marker-position end-marker))
          (narrow-to-region start-marker
                            (if end-marker
                                (1- (marker-position end-marker))
-                             (point-max)))
-         ))
+                             (point-max)))))
     (recenter)
 
     (recenter)
 
-    ;; update the modeline
-    (foldout-update-modeline)
-    ))
+    ;; update the mode line
+    (foldout-update-mode-line)))
 \f
 
 \f
 
-(defun foldout-update-modeline ()
-  "Set the modeline string to indicate our fold depth."
+(defun foldout-update-mode-line ()
+  "Set the mode line to indicate our fold depth."
   (let ((depth (length foldout-fold-list)))
   (let ((depth (length foldout-fold-list)))
-    (setq foldout-modeline-string
+    (setq foldout-mode-line-string
          (cond
           ;; if we're not in a fold, keep quiet
           ((zerop depth)
            nil)
          (cond
           ;; if we're not in a fold, keep quiet
           ((zerop depth)
            nil)
-          ;; in outline-minor-mode we're after "Outl:xx" in the modeline
+          ;; in outline-minor-mode we're after "Outl:xx" in the mode line
           (outline-minor-mode
            (format ":%d" depth))
           ;; otherwise just announce the depth (I guess we're in outline-mode)
           ((= depth 1)
            " Inside 1 fold")
           (t
           (outline-minor-mode
            (format ":%d" depth))
           ;; otherwise just announce the depth (I guess we're in outline-mode)
           ((= depth 1)
            " Inside 1 fold")
           (t
-           (format " Inside %d folds" depth))
-          ))))
+           (format " Inside %d folds" depth))))))
 \f
 
 (defun foldout-mouse-zoom (event)
 \f
 
 (defun foldout-mouse-zoom (event)
@@ -458,10 +454,10 @@ What gets exposed depends on the number of mouse clicks:-
   (foldout-mouse-goto-heading event)
   (let ((nclicks (event-click-count event)))
     (cond
   (foldout-mouse-goto-heading event)
   (let ((nclicks (event-click-count event)))
     (cond
-     ((= nclicks 1) (show-entry))
-     ((= nclicks 2) (show-children))
-     ((= nclicks 3) (show-entry) (show-children))
-     (t (show-subtree)))))
+     ((= nclicks 1) (outline-show-entry))
+     ((= nclicks 2) (outline-show-children))
+     ((= nclicks 3) (outline-show-entry) (outline-show-children))
+     (t (outline-show-subtree)))))
 
 (defun foldout-mouse-hide-or-exit (event)
   "Hide the subtree under the heading clicked on, or exit a fold.
 
 (defun foldout-mouse-hide-or-exit (event)
   "Hide the subtree under the heading clicked on, or exit a fold.
@@ -482,7 +478,7 @@ What happens depends on the number of mouse clicks:-
     (if (= nclicks 1)
        (progn
          (foldout-mouse-goto-heading event)
     (if (= nclicks 1)
        (progn
          (foldout-mouse-goto-heading event)
-         (hide-subtree))
+         (outline-hide-subtree))
       (foldout-exit-fold
        (cond
        ((= nclicks 2) 1)               ; exit and hide
       (foldout-exit-fold
        (cond
        ((= nclicks 2) 1)               ; exit and hide