all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Bug in outline-magic.el
@ 2013-06-28 16:06 Michal Sojka
  2013-06-28 16:59 ` Thorsten Jolitz
  0 siblings, 1 reply; 6+ messages in thread
From: Michal Sojka @ 2013-06-28 16:06 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Emacs mailing list

Dear Carsten,

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.

The version 0.9 (or 20120505.1234 from MELPA) doesn’t work for me. In
some files (e.g. outline-magic.el itself), when the point is at the
beginning of the buffer and I run ‘outline-cycle’, the whole buffer gets
hidden. Subsequent runs of ‘outline-cycle’ fail and everything remains
hidden. The failure is caused by (error “before first heading”) called
from `outline-back-to-heading`.

I run GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.4.2) of 2013-04-13 on trouble, modified by Debian.

This patch fixes the problem.

diff --git a/outline-magic.el b/outline-magic.el
index 52ca5cf..81331c5 100644
--- a/outline-magic.el
+++ b/outline-magic.el
@@ -266,7 +266,13 @@ them set by set, separated by a nil element.  See the example for
        (setq this-command 'outline-cycle-showall))
        (t
        ;; Default action: go to overview
-       (hide-sublevels 1)
+       (let ((toplevel (cond
+                        (current-prefix-arg (prefix-numeric-value current-prefix-arg))
+                        ((save-excursion (beginning-of-line)
+                                         (looking-at outline-regexp))
+                         (max 1 (funcall outline-level)))
+                        (t 1))))
+         (hide-sublevels toplevel))
        (message "OVERVIEW")
        (setq this-command 'outline-cycle-overview))))

Best regards,
-Michal



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

* Re: Bug in outline-magic.el
  2013-06-28 16:06 Bug in outline-magic.el Michal Sojka
@ 2013-06-28 16:59 ` Thorsten Jolitz
  2013-06-30 20:58   ` Michal Sojka
  0 siblings, 1 reply; 6+ messages in thread
From: Thorsten Jolitz @ 2013-06-28 16:59 UTC (permalink / raw)
  To: help-gnu-emacs

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.

I remember I hit the same bug like you and fixed it - but nothing else
;)

There is a version 0.9.1 available on github:

,--------------------------------------
| https://github.com/tj64/outline-magic
`--------------------------------------

and I think its this version I merged into outshine.el

,---------------------------------
| https://github.com/tj64/outshine
`---------------------------------

and since outshine does not have the problem you describe any more, I
conclude that its fixed in version 0.9.1 of outline-magic too. May be
you can check it out?


PS If you use outshine.el in combination with outorg.el and navi-mode.el
(all available in my github account) you get everything outline-magic
offers (since it is merged into outshine.el) + the extensions from
out-xtra.el + many new ideas and features, see this tutorial

,-----------------------------------------------------------
| http://orgmode.org/worg/org-tutorials/org-outside-org.html
`-----------------------------------------------------------

on Worg (there are links to related screencasts on youtube at the end of
the page).

HTH

--
cheers,
Thorsten




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

* Re: Bug in outline-magic.el
  2013-06-28 16:59 ` Thorsten Jolitz
@ 2013-06-30 20:58   ` Michal Sojka
  2013-06-30 22:07     ` Thorsten Jolitz
  2013-06-30 23:00     ` Michal Sojka
  0 siblings, 2 replies; 6+ messages in thread
From: Michal Sojka @ 2013-06-30 20:58 UTC (permalink / raw)
  To: Thorsten Jolitz, help-gnu-emacs

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 remember I hit the same bug like you and fixed it - but nothing else
> ;)
>
> There is a version 0.9.1 available on github:
>
> ,--------------------------------------
> | https://github.com/tj64/outline-magic
> `--------------------------------------

Hmm, what about modifying the pages on Emacs Wiki [1], [2] to reflect
the location of the new version. I installed outline-magic from MELPA,
which contains the version from wiki. If you want, I can do it.

[1] http://www.emacswiki.org/emacs/OutlineMagic
[2] http://www.emacswiki.org/emacs/outline-magic.el

[...]

> PS If you use outshine.el in combination with outorg.el and navi-mode.el
> (all available in my github account) you get everything outline-magic
> offers (since it is merged into outshine.el) + the extensions from
> out-xtra.el + many new ideas and features, see this tutorial
>
> ,-----------------------------------------------------------
> | http://orgmode.org/worg/org-tutorials/org-outside-org.html
> `-----------------------------------------------------------
>
> on Worg (there are links to related screencasts on youtube at the end of
> the page).

Thanks for the link, this all seems quite interesting :)

Cheers,
-Michal



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

* Re: Bug in outline-magic.el
  2013-06-30 20:58   ` Michal Sojka
@ 2013-06-30 22:07     ` Thorsten Jolitz
  2013-06-30 23:00     ` Michal Sojka
  1 sibling, 0 replies; 6+ messages in thread
From: Thorsten Jolitz @ 2013-06-30 22:07 UTC (permalink / raw)
  To: help-gnu-emacs

Michal Sojka <sojkam1@fel.cvut.cz> writes:

> outshine.el seems interesting. I think I'll give it a try.

If you like Org-mode, it is for you - it blurs the line between Org-mode
and programming language major modes. I organize all my source-code
files like Org-mode files, and with outshine they just look and feel
like Org-mode buffers.

But outshine.el is not a complete replacement for outline-magic.el, although
all of its functionality is merged into outshine, otherwise support for the
latter could be dropped.

outshine.el is based on a simple but powerful idea:

,----------------------------------------------
| headlines are outcommented Org-mode headlines
`----------------------------------------------

using whatever comment-syntax the programming-language major-mode at
hand defines. There is only one special case supported:

 - oldstyle Emacs Lisp headlines

    ,---------------------------
    | ;;;; Second Level Header
    `---------------------------

    instead of "outshine-style"

    ,----------------------------
    | ;; ** Second Level Header
    `----------------------------

Thus, if you do not adopt this basic idea and use outline/outline-magic in
other ways (i.e. you structure your source-code files without using
outcommented Org-mode headlines), you cannot use outshine.el. But you still
can benefit from outline-magic's extension to outline mode, so
outline-magic.el should be maintained independently from outshine.el.

>> There is a version 0.9.1 available on github:
>>
>> ,--------------------------------------
>> | https://github.com/tj64/outline-magic
>> `--------------------------------------
>
> Hmm, what about modifying the pages on Emacs Wiki [1], [2] to reflect
> the location of the new version. I installed outline-magic from MELPA,
> which contains the version from wiki. If you want, I can do it.
>
> [1] http://www.emacswiki.org/emacs/OutlineMagic
> [2] http://www.emacswiki.org/emacs/outline-magic.el
>
> [...]


Please, go ahead! 

I wanted to promote outshine.el, outorg.el and navi-mode.el on Emacs Wiki,
but I was turned off by the fact that they publish my full name together with
my IP address. I find that strange. 


PS 

Did you test the new version - does it fix the bug you encountered?. Would be
nice to get some confirmation that things work before announcing them on
Emacs Wiki. 

--
cheers,
Thorsten




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

* Re: Bug in outline-magic.el
  2013-06-30 20:58   ` Michal Sojka
  2013-06-30 22:07     ` Thorsten Jolitz
@ 2013-06-30 23:00     ` Michal Sojka
  2013-06-30 23:51       ` Thorsten Jolitz
  1 sibling, 1 reply; 6+ messages in thread
From: Michal Sojka @ 2013-06-30 23:00 UTC (permalink / raw)
  To: Thorsten Jolitz, help-gnu-emacs

Hi Thorsten,

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.

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. I also miss the functionality to fold
elisp defuns with outshine.

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.

Thanks,
-Michal



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

* Re: Bug in outline-magic.el
  2013-06-30 23:00     ` Michal Sojka
@ 2013-06-30 23:51       ` Thorsten Jolitz
  0 siblings, 0 replies; 6+ messages in thread
From: Thorsten Jolitz @ 2013-06-30 23:51 UTC (permalink / raw)
  To: help-gnu-emacs

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




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

end of thread, other threads:[~2013-06-30 23:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-28 16:06 Bug in outline-magic.el Michal Sojka
2013-06-28 16:59 ` Thorsten Jolitz
2013-06-30 20:58   ` Michal Sojka
2013-06-30 22:07     ` Thorsten Jolitz
2013-06-30 23:00     ` Michal Sojka
2013-06-30 23:51       ` Thorsten Jolitz

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.