unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* outline-cycle makes buffer content disappear
@ 2013-02-05  0:11 Thorsten Jolitz
  2013-02-05 18:30 ` Thorsten Jolitz
  0 siblings, 1 reply; 3+ messages in thread
From: Thorsten Jolitz @ 2013-02-05  0:11 UTC (permalink / raw)
  To: help-gnu-emacs


Hi List, 

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?

PS
Why is it so difficult to get rid of the 'C-c @' prefix of
outline-minor-mode (replace it with 'C-c')? I tried tricks from the
Emacs Wiki, customized the variable - but to no avail. Finally I ended
up modifying outline.el - not the best solution. 

How can I override this prefix in my .emacs in a way that works?

-- 
cheers,
Thorsten





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

* Re: outline-cycle makes buffer content disappear
  2013-02-05  0:11 outline-cycle makes buffer content disappear Thorsten Jolitz
@ 2013-02-05 18:30 ` Thorsten Jolitz
  2013-02-06 18:29   ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Thorsten Jolitz @ 2013-02-05 18:30 UTC (permalink / raw)
  To: help-gnu-emacs

Thorsten Jolitz <tjolitz@gmail.com> 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




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

* Re: outline-cycle makes buffer content disappear
  2013-02-05 18:30 ` Thorsten Jolitz
@ 2013-02-06 18:29   ` Stefan Monnier
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2013-02-06 18:29 UTC (permalink / raw)
  To: help-gnu-emacs

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

Sounds like a bug in Smex (after all, the default M-x is nowadays
implemented in Elisp, so Smex should be able to work about as well).


        Stefan




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

end of thread, other threads:[~2013-02-06 18:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-05  0:11 outline-cycle makes buffer content disappear Thorsten Jolitz
2013-02-05 18:30 ` Thorsten Jolitz
2013-02-06 18:29   ` Stefan Monnier

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