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

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

Re: outline-cycle makes buffer content disappear


From: Thorsten Jolitz
Subject: Re: outline-cycle makes buffer content disappear
Date: Tue, 05 Feb 2013 19:30:39 +0100
User-agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.2 (gnu/linux)

Thorsten Jolitz <address@hidden> writes:

Answering my own question:

> when I use outline-cycle from the outline-magic package (global version,
> i.e. with arg or with point on beg-of-buffer) in an .el file with
> several first-level outline entries, the whole buffer content
> disappears, except 3 dots ('show-all' brings the content back).
>
> Using outline-cycle without arg on one of the next first-level entries
> cycles the entry between 2 (not 3) states: CHILDREN and FOLDED.
>
> The other outline-minor-mode commands work as expected. What might be
> the reason for this behaviour?


Debugging outline.el and outline-magic.el, I found out that:

1. When I define a custom file-local var 'outline-regexp', I need to
   define a file-local var 'outline-level' too, that is actually a function to
   calculate the right outline-level, e.g. by substracting 4 from the
   lenght of the match-data:

,---------------------------------------------------------------------------------------------
| ;; * first level (1)
| some text some text some text
| 
| ;; ** second level (1.1)
| some text some text some text
| ;; *** third level (1.1.1)
| some text some text some text
| ;; *** third level (1.1.2)
| some text some text some text
| 
| ;; Local Variables:
| ;; coding: utf-8
| ;; mode: emacs-lisp
| ;; eval: (outline-minor-mode)
| ;; ispell-local-dictionary: "en_US"
| ;; outline-regexp: ";; [*]+ "
| ;; outline-level: (lambda () (let ((len (- (match-end 0) (match-beginning 
0)))) (- len 4))))
| ;; End:
`---------------------------------------------------------------------------------------------

2. 'outline-cycle' in outline-magic.el relies on the use of 

,------------------------------------------
| (eq last-command 'outline-cycle-overview)
| (eq last-command 'outline-cycle-toc)
`------------------------------------------

what does not work anymore with 'smex' (http://www.emacswiki.org/Smex)
when using 'M-x outline-cycle', since in that case the last command is
always a smex command. It does work with 'M-: (outline-cycle)' though or
when called via key-binding.

-- 
cheers,
Thorsten




reply via email to

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