unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [id.brep@gmail.com: Strange behavior of emacs-lisp-mode with outline-minor-mode]
@ 2006-03-06  0:51 Richard Stallman
  2006-03-06  1:55 ` Fwd: Strange behavior of emacs-lisp-mode with outline-minor-mode Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Stallman @ 2006-03-06  0:51 UTC (permalink / raw)


Does anyone disagree with this change?
It is really a matter of what outline commands should do in Lisp mode,
and I don't use them.

------- Start of forwarded message -------
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com;
	h=received:to:subject:from:date:message-id:user-agent:mime-version:content-type;
	b=fJAxfaRpRWx1MXRB+xzUNsLJg1QRsAJNWzI8L3csmFYNTFXVlN6L8XuxKy/GE9oJ/hz6OVPIuALbhwRvP3AUpCNPmcEeufwrk3CRmXRPkhu6oRWrZYxBdfE+FyNF0ZPIE9+dWb7Kg42Z1vfkjLVcmKnJngGEIj8bVLwC00DIDEE=
To: emacs-pretest-bug@gnu.org
From: Zhang Wei <id.brep@gmail.com>
Date: Wed, 01 Mar 2006 01:08:40 +0800
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Subject: Strange behavior of emacs-lisp-mode with outline-minor-mode

If we turn on outline-minor-mode in emacs-lisp-mode, and press
`C-c @ C-q', only three dots there, nothing left!

Accoding to the doc of `C-c @ C-q' runs the command
`hide-sublevels', it should hide everything but the top levels
levels of headers, in whole buffer.

The value of outline-regexp of emacs-lisp-mode is 

";;;\\(;* [^ 	\n]\\|###autoload\\)\\|("

That means every line start with a "(" or ";;; x" will be
considered as top level headers. When we run `hide-sublevels',
these lines shouled be left.

This bug could be fixed by the following patch:

- --8<---------------cut here---------------start------------->8---
- --- orig/lisp/emacs-lisp/lisp-mode.el
+++ mod/lisp/emacs-lisp/lisp-mode.el
@@ -251,9 +251,11 @@
 (defun lisp-outline-level ()
   "Lisp mode `outline-level' function."
   (let ((len (- (match-end 0) (match-beginning 0))))
- -    (if (looking-at "(\\|;;;###autoload")
+    (if (looking-at ";;;###autoload")
 	1000
- -      len)))
+      (if (looking-at "(") 
+	  1
+	(- len 4)))))
 
 (defvar lisp-mode-shared-map
   (let ((map (make-sparse-keymap)))
- --8<---------------cut here---------------end--------------->8---


_______________________________________________
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
------- End of forwarded message -------

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

* Re: Fwd: Strange behavior of emacs-lisp-mode with outline-minor-mode
  2006-03-06  0:51 [id.brep@gmail.com: Strange behavior of emacs-lisp-mode with outline-minor-mode] Richard Stallman
@ 2006-03-06  1:55 ` Stefan Monnier
  2006-03-06  2:46   ` Zhang Wei
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2006-03-06  1:55 UTC (permalink / raw)
  Cc: rms, emacs-devel

> Does anyone disagree with this change?
> It is really a matter of what outline commands should do in Lisp mode,
> and I don't use them.

>    (let ((len (- (match-end 0) (match-beginning 0))))
> - -    (if (looking-at "(\\|;;;###autoload")
> +    (if (looking-at ";;;###autoload")
>  	1000
> - -      len)))
> +      (if (looking-at "(") 
> +	  1
> +	(- len 4)))))
 
This means that

 ;;; Foo:

gets level 1 and that

 (defun ...)

also gets level 1.  This is wrong.

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.


        Stefan

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

* Re: Fwd: Strange behavior of emacs-lisp-mode with outline-minor-mode
  2006-03-06  1:55 ` Fwd: Strange behavior of emacs-lisp-mode with outline-minor-mode Stefan Monnier
@ 2006-03-06  2:46   ` Zhang Wei
  2006-03-06  4:49     ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Zhang Wei @ 2006-03-06  2:46 UTC (permalink / raw)
  Cc: rms, emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

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

Then what is right? Gets level 1000 is right?
The problem is there's no level 1 in lisp-mode with outline-minor.

> 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

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

* Re: Fwd: Strange behavior of emacs-lisp-mode with outline-minor-mode
  2006-03-06  2:46   ` Zhang Wei
@ 2006-03-06  4:49     ` Stefan Monnier
  2006-03-06  5:24       ` Zhang Wei
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2006-03-06  4:49 UTC (permalink / raw)
  Cc: emacs-devel

>> 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)

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

* Re: Fwd: Strange behavior of emacs-lisp-mode with outline-minor-mode
  2006-03-06  4:49     ` Stefan Monnier
@ 2006-03-06  5:24       ` Zhang Wei
  0 siblings, 0 replies; 5+ messages in thread
From: Zhang Wei @ 2006-03-06  5:24 UTC (permalink / raw)


Stefan Monnier <monnier@iro.umontreal.ca> writes:

> 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.

This patch works great.

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

end of thread, other threads:[~2006-03-06  5:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-06  0:51 [id.brep@gmail.com: Strange behavior of emacs-lisp-mode with outline-minor-mode] Richard Stallman
2006-03-06  1:55 ` Fwd: Strange behavior of emacs-lisp-mode with outline-minor-mode Stefan Monnier
2006-03-06  2:46   ` Zhang Wei
2006-03-06  4:49     ` Stefan Monnier
2006-03-06  5:24       ` Zhang Wei

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).