[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug in outline-magic.el
From: |
Thorsten Jolitz |
Subject: |
Re: Bug in outline-magic.el |
Date: |
Mon, 01 Jul 2013 01:51:53 +0200 |
User-agent: |
Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.3 (gnu/linux) |
Michal Sojka <sojkam1@fel.cvut.cz> writes:
Hi Michal,
> On Sun, Jun 30 2013, Michal Sojka wrote:
>> On Fri, Jun 28 2013, Thorsten Jolitz wrote:
>>> Michal Sojka <sojkam1@fel.cvut.cz> writes:
>>>
>>> Hi Michal,
>>>
>>>> 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.
>>>
>>> I kind of took over outline-magic.el from Carsten when I merged it into
>>> outshine.el and he asked me if I want to be the new maintainer.
>>
>> outshine.el seems interesting. I think I'll give it a try.
>
> I've just looked at outshine.el and I like the idea. What I don't like
> is that it does not work in buffers without "modern" headers such as
> LaTeX, programming languages etc. where outline-magic worked. In my
> opinion, the strength of outline-magic is that it works the same in all
> major modes that set outline-regexp reasonably.
With outline/outline-magic you can define whatever you want as a
headline. Outshine tries to make source-code files look&feel like
Org-mode files, and it actually works with all kinds of major-modes
(even those not yet written), but not with all kinds of headline styles
(only outcommented Org-mode headers).
> From the quick look at the code, it seems that you try to detect the
> presence of "modern" headers in files (at least elisp files). It would
> be nice if you could change outshine to work like outline-magic when
> modern headers are not detected.
Just like the Org-mode maintainers decided that the asteriks
,---------
| * Header
`---------
is hardcoded syntax in Org-mode, I decided to only cover the case that
users structure their files with outcommented Org-mode headers. This
keeps things simple and generic.
If users want it only for some major-modes and others not, they can
still use outline/outline-magic without loading outshine in the
major-mode hook.
I'm afraid it would be quite difficult to fall-back to plain
outline/outline-magic once outshine was loaded in the case that no
'modern' headers are detected, so I would prefer to rather not touch
this.
> I also miss the functionality to fold elisp defuns with outshine.
I Org-mode, headlines are folded, not their content, and in an elisp
buffer structured with outshine headers, the defuns are content, not
headlines.
But navi-mode.el gives you something similar, and much more:
'M-s n' for opening the navi-buffer (e.g. in outshine.el buffer)
then 'f' for showing functions and macros:
,--------------------------------------------------------------------------
| 48 matches for "^[[:space:]]*(def[mau][^e][a-z]* " in buffer: outshine.el
| 204:(defun outshine-compatible-face (inherits specs)
| 468:(defmacro outshine-define-key-with-fallback
| 501:(defun outshine-chomp (str)
| 511:(defun outshine-set-outline-regexp-base ()
| 524:(defun outshine-normalize-regexps ()
| 539:(defun outshine-modern-header-style-in-elisp-p (&optional buffer)
| 550:(defun outshine-calc-comment-region-starter ()
| 560:(defun outshine-calc-comment-padding () ...
`--------------------------------------------------------------------------
'v' for showing variables:
,---------------------------------------------------------------------------
| 39 matches for "^[[:space:]]*(def[vcgf][^l][a-z]+ " in buffer: outshine.el
| 123:(defconst outshine-version "1.0"
| 127:(defconst outshine-level-faces
| 132:(defconst outshine-outline-heading-end-regexp "\n"
| 136:(defconst outshine-oldschool-elisp-outline-regexp-base "[;]+"
| 142:(defvar outline-minor-mode-prefix "\M-#"
| 150:(defvar outline-promotion-headings nil ...
`---------------------------------------------------------------------------
'3' for showing headers up to level 3:
,---------------------------------------------------------------------
| 34 matches for "^;; \*\*?\*? " in buffer: outshine.el
| 1:;; * outshine.el --- outline with outshine outshines outline
| 18:;; ** Commentary
| 20:;; *** About outshine
| 44:;; *** Installation
| 100:;; *** Emacs Version
| 107:;; ** ChangeLog
| 114:;; * Requires ...
`---------------------------------------------------------------------
and 'C-3 f' for showing headers up to level 3 and function definitions:
,----------------------------------------------------------------------
| ...
| 462:;; * Defuns
| 463:;; ** Functions
| 464:;; *** Define keys with fallback
| 468:(defmacro outshine-define-key-with-fallback
| 498:;; *** Normalize regexps
| 501:(defun outshine-chomp (str)
| 511:(defun outshine-set-outline-regexp-base ()
| 524:(defun outshine-normalize-regexps ()
| 536:;; *** Calculate outline-regexp and outline-level
| 539:(defun outshine-modern-header-style-in-elisp-p (&optional buffer)
| 550:(defun outshine-calc-comment-region-starter () ...
`----------------------------------------------------------------------
just to give you a few examples.
> Therefore, I'll stay with outline-magic. The bug I reported is present
> even in your version so I've sent you a pull request over github.
Yes, you are right - I always orderly start with level 1 when
structuring my files, so I did not notice. I applied your patch to
outline-magic and outshine, thanks!
--
cheers,
Thorsten