emacs-devel
[Top][All Lists]
Advanced

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

Re: Fwd: Strange behavior of emacs-lisp-mode with outline-minor-mode


From: Stefan Monnier
Subject: Re: Fwd: Strange behavior of emacs-lisp-mode with outline-minor-mode
Date: Sun, 05 Mar 2006 23:49:54 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

>> This means that
>> 
>> ;;; Foo:
>> 
>> gets level 1 and that
>> 
>> (defun ...)
>> 
>> also gets level 1.  This is wrong.

> Then what is right?

Something else where the level of "(" is higher than for ";;; ".

> Gets level 1000 is right?

For example.

> The problem is there's no level 1 in lisp-mode with outline-minor.

Actually, I think the problem is that outline doesn't really define what
levels mean.  At least various major modes use different values.

For most cases outline doesn't care about absolute values of levels but only
relative ones.  C-x @ C-q is the only counter example I've bumped into
(there are probably others, tho).  I think the expectation was that the user
provide an explicit numeric argument when using it, rather than rely on
the default.

>> The motivation for this change was:
>> 
>>> If we turn on outline-minor-mode in emacs-lisp-mode, and press
>>> `C-c @ C-q', only three dots there, nothing left!
>> 
>> I don't see this behavior.  Please give a precise recipe.

> 1, emacs -q
> 2, C-x C-f emacs-source/lisp/ido.el
> 3, C-c @ C-q

Oops, sorry, yes I see it now.  It turns out I've been using the patch below
for so long that I completely forgot about it.  I've just installed it.


        Stefan


--- orig/lisp/outline.el
+++ mod/lisp/outline.el
@@ -828,7 +829,13 @@
 
 (defun hide-sublevels (levels)
   "Hide everything but the top LEVELS levels of headers, in whole buffer."
-  (interactive "p")
+  (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))))
   (if (< levels 1)
       (error "Must keep at least one level of headers"))
   (let (outline-view-change-hook)




reply via email to

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