emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] scratch/outline a34cf43 12/15: lisp/outline.el (outline-hi


From: Oleh Krehel
Subject: [Emacs-diffs] scratch/outline a34cf43 12/15: lisp/outline.el (outline-hide-sublevels): Rename from `hide-sublevels'.
Date: Wed, 28 Jan 2015 11:44:26 +0000

branch: scratch/outline
commit a34cf433cf82abf31deb751d7d7589dfb3608b6f
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    lisp/outline.el (outline-hide-sublevels): Rename from `hide-sublevels'.
---
 lisp/ChangeLog  |    6 ++++++
 lisp/outline.el |   41 ++++++++++++++++++++++-------------------
 2 files changed, 28 insertions(+), 19 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d4e0720..710e353 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,11 @@
 2015-01-28  Oleh Krehel  <address@hidden>
 
+       * outline.el (outline-hide-sublevels): Rename from
+       `hide-sublevels'.
+       (hide-sublevels): Declare as obsolete.
+
+2015-01-28  Oleh Krehel  <address@hidden>
+
        * outline.el (outline-show-subtree): Rename from `show-subtree'.
        (show-subtree): Declare as obsolete.
 
diff --git a/lisp/outline.el b/lisp/outline.el
index 248eeb9..4685245 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -74,7 +74,7 @@ in the file it applies to.")
     (define-key map "\C-e" 'outline-show-entry)
     (define-key map "\C-l" 'outline-hide-leaves)
     (define-key map "\C-k" 'show-branches)
-    (define-key map "\C-q" 'hide-sublevels)
+    (define-key map "\C-q" 'outline-hide-sublevels)
     (define-key map "\C-o" 'hide-other)
     (define-key map "\C-^" 'outline-move-subtree-up)
     (define-key map "\C-v" 'outline-move-subtree-down)
@@ -89,8 +89,8 @@ in the file it applies to.")
     (define-key map [hide hide-other]
       '(menu-item "Hide Other" hide-other
         :help "Hide everything except current body and parent and top-level 
headings"))
-    (define-key map [hide hide-sublevels]
-      '(menu-item "Hide Sublevels" hide-sublevels
+    (define-key map [hide outline-hide-sublevels]
+      '(menu-item "Hide Sublevels" outline-hide-sublevels
         :help "Hide everything but the top LEVELS levels of headers, in whole 
buffer"))
     (define-key map [hide outline-hide-subtree]
       '(menu-item "Hide Subtree" outline-hide-subtree
@@ -848,22 +848,22 @@ Show the heading too, if it is currently invisible."
 (defun outline-show-heading ()
   "Show the current heading and move to its end."
   (outline-flag-region (- (point)
-                         (if (bobp) 0
-                           (if (and outline-blank-line
+                          (if (bobp) 0
+                            (if (and outline-blank-line
                                      (eq (char-before (1- (point))) ?\n))
-                               2 1)))
-                      (progn (outline-end-of-heading) (point))
-                      nil))
+                                2 1)))
+                       (progn (outline-end-of-heading) (point))
+                       nil))
 
-(defun hide-sublevels (levels)
+(defun outline-hide-sublevels (levels)
   "Hide everything but the top LEVELS levels of headers, in whole buffer."
   (interactive (list
-               (cond
-                (current-prefix-arg (prefix-numeric-value current-prefix-arg))
-                ((save-excursion (beginning-of-line)
-                                 (looking-at outline-regexp))
-                 (funcall outline-level))
-                (t 1))))
+                (cond
+                  (current-prefix-arg (prefix-numeric-value 
current-prefix-arg))
+                  ((save-excursion (beginning-of-line)
+                                   (looking-at outline-regexp))
+                   (funcall outline-level))
+                  (t 1))))
   (if (< levels 1)
       (error "Must keep at least one level of headers"))
   (save-excursion
@@ -878,14 +878,14 @@ Show the heading too, if it is currently invisible."
                   ;; Keep empty last line, if available.
                   (if (bolp) (1- (point)) (point)))))
       (if (< end beg)
-         (setq beg (prog1 end (setq end beg))))
+          (setq beg (prog1 end (setq end beg))))
       ;; First hide everything.
       (outline-flag-region beg end t)
       ;; Then unhide the top level headers.
       (outline-map-region
        (lambda ()
-        (if (<= (funcall outline-level) levels)
-            (outline-show-heading)))
+         (if (<= (funcall outline-level) levels)
+             (outline-show-heading)))
        beg end)
       ;; Finally unhide any trailing newline.
       (goto-char (point-max))
@@ -893,10 +893,13 @@ Show the heading too, if it is currently invisible."
           (outline-flag-region (1- (point)) (point) nil))))
   (run-hooks 'outline-view-change-hook))
 
+(define-obsolete-function-alias
+    'hide-sublevels 'outline-hide-sublevels "25.1")
+
 (defun hide-other ()
   "Hide everything except current body and parent and top-level headings."
   (interactive)
-  (hide-sublevels 1)
+  (outline-hide-sublevels 1)
   (let (outline-view-change-hook)
     (save-excursion
       (outline-back-to-heading t)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]