(diary-face, holiday-face): Add dark-background variants.
[bpt/emacs.git] / lisp / foldout.el
index 822533f..4a2aa2b 100644 (file)
@@ -5,7 +5,7 @@
 ;; Author: Kevin Broadey <KevinB@bartley.demon.co.uk>
 ;; Created: 27 Jan 1994
 ;; Version: foldout.el 1.10 dated 94/05/19 at 17:09:12
-;; Keywords: folding, outline
+;; Keywords: folding, outlines
 
 ;; This file is part of GNU Emacs.
 
@@ -20,8 +20,9 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to
-;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
 
 ;;; Commentary:
 
@@ -235,6 +236,15 @@ An end marker of NIL means the fold ends after (point-max).")
       ;; slip our fold announcement into the list
       (setcdr outl-entry (nconc foldout-entry (cdr outl-entry)))
       ))
+
+;; outline-flag-region has different `flag' values in outline.el and
+;; noutline.el for hiding and showing text.
+
+(defconst foldout-hide-flag
+  (if (featurep 'noutline) t ?\^M))
+
+(defconst foldout-show-flag
+  (if (featurep 'noutline) nil ?\n))
 \f
 
 (defun foldout-zoom-subtree (&optional exposure)
@@ -357,12 +367,13 @@ exited and text is left visible."
                                  (point-max))))
            ;; hide the subtree
            (if hide-fold
-               (outline-flag-region start-marker end-of-subtree ?\^M))
+               (outline-flag-region start-marker end-of-subtree
+                                    foldout-hide-flag))
 
            ;; make sure the next heading is exposed
            (if end-marker
-               (outline-flag-region end-of-subtree
-                                    beginning-of-heading ?\n))
+               (outline-flag-region end-of-subtree beginning-of-heading
+                                    foldout-show-flag))
            ))
 
       ;; zap the markers so they don't slow down editing
@@ -520,11 +531,12 @@ Valid modifiers are shift, control, meta, alt, hyper and super.")
     ()
   (define-key outline-mode-map "\C-c\C-z" 'foldout-zoom-subtree)
   (define-key outline-mode-map "\C-c\C-x" 'foldout-exit-fold)
-  (define-key outline-minor-mode-map
-    (concat outline-minor-mode-prefix "\C-z") 'foldout-zoom-subtree)
-  (define-key outline-minor-mode-map
-    (concat outline-minor-mode-prefix "\C-x") 'foldout-exit-fold)
-
+  (let ((map (lookup-key outline-minor-mode-map outline-minor-mode-prefix)))
+    (unless map
+      (setq map (make-sparse-keymap))
+      (define-key outline-minor-mode-map outline-minor-mode-prefix map))
+    (define-key map "\C-z" 'foldout-zoom-subtree)
+    (define-key map "\C-x" 'foldout-exit-fold))
   (let* ((modifiers (apply 'concat
                           (mapcar (function
                                    (lambda (modifier)