help-gnu-emacs
[Top][All Lists]
Advanced

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

Bug in outline-magic.el


From: Michal Sojka
Subject: Bug in outline-magic.el
Date: Fri, 28 Jun 2013 18:06:46 +0200
User-agent: Notmuch/0.15.2 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu)

Dear Carsten,

I think that there is a bug in outline-magic.el. See below. I put the
same text also at
http://www.emacswiki.org/emacs/Comments_on_outline-magic.el.

The version 0.9 (or 20120505.1234 from MELPA) doesn’t work for me. In
some files (e.g. outline-magic.el itself), when the point is at the
beginning of the buffer and I run ‘outline-cycle’, the whole buffer gets
hidden. Subsequent runs of ‘outline-cycle’ fail and everything remains
hidden. The failure is caused by (error “before first heading”) called
from `outline-back-to-heading`.

I run GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.4.2) of 2013-04-13 
on trouble, modified by Debian.

This patch fixes the problem.

diff --git a/outline-magic.el b/outline-magic.el
index 52ca5cf..81331c5 100644
--- a/outline-magic.el
+++ b/outline-magic.el
@@ -266,7 +266,13 @@ them set by set, separated by a nil element.  See the 
example for
        (setq this-command 'outline-cycle-showall))
        (t
        ;; Default action: go to overview
-       (hide-sublevels 1)
+       (let ((toplevel (cond
+                        (current-prefix-arg (prefix-numeric-value 
current-prefix-arg))
+                        ((save-excursion (beginning-of-line)
+                                         (looking-at outline-regexp))
+                         (max 1 (funcall outline-level)))
+                        (t 1))))
+         (hide-sublevels toplevel))
        (message "OVERVIEW")
        (setq this-command 'outline-cycle-overview))))

Best regards,
-Michal



reply via email to

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