unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Bug in outline-magic.el
@ 2013-06-28 16:06 Michal Sojka
  2013-06-28 16:59 ` Thorsten Jolitz
  0 siblings, 1 reply; 6+ messages in thread
From: Michal Sojka @ 2013-06-28 16:06 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Emacs mailing list

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



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-06-30 23:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-28 16:06 Bug in outline-magic.el Michal Sojka
2013-06-28 16:59 ` Thorsten Jolitz
2013-06-30 20:58   ` Michal Sojka
2013-06-30 22:07     ` Thorsten Jolitz
2013-06-30 23:00     ` Michal Sojka
2013-06-30 23:51       ` Thorsten Jolitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).