all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thorsten Jolitz <tjolitz@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Bug in outline-magic.el
Date: Mon, 01 Jul 2013 01:51:53 +0200	[thread overview]
Message-ID: <87k3lbduna.fsf@gmail.com> (raw)
In-Reply-To: 878v1rp5ky.fsf@steelpick.2x.cz

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




      reply	other threads:[~2013-06-30 23:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k3lbduna.fsf@gmail.com \
    --to=tjolitz@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.