emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Change org-back-to-heading to use org's heading regex
@ 2013-09-14 21:30 aditya siram
  2013-09-14 22:21 ` Carsten Dominik
  0 siblings, 1 reply; 3+ messages in thread
From: aditya siram @ 2013-09-14 21:30 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 810 bytes --]

Hi all,
Org-mode uses two regex's to find headings, one from outline.el and one
defined internally and captures more information. I propose we stop using
the one from outline.el.

org-mode uses `org-back-to-heading` a lot to navigate point back to the
nearest heading.

This just delegates to `outline-back-to-heading` from the outline.el
package, which uses a regex for finding headlines: "[*\^L]+"

Org also defines another heading regex which is more capable and captures
more information: "^\\(\\*+\\)\\(?: +\\(.*?\\)\\)?[ \t]*$".

I would propose changing org-back-to-heading to use that so that a user
(like me :) ) can use `match-string` to grab the relevant parts of the
string.

Since this is a pretty simple, but sweeping change, I thought I'd bring it
up here first before patching.

Thanks!
-deech

[-- Attachment #2: Type: text/html, Size: 1008 bytes --]

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

* Re: Change org-back-to-heading to use org's heading regex
  2013-09-14 21:30 Change org-back-to-heading to use org's heading regex aditya siram
@ 2013-09-14 22:21 ` Carsten Dominik
  2013-09-17 22:37   ` aditya siram
  0 siblings, 1 reply; 3+ messages in thread
From: Carsten Dominik @ 2013-09-14 22:21 UTC (permalink / raw)
  To: aditya siram; +Cc: emacs-orgmode

Hi Aditya,

I do not support this idea.

1. sometimes Org functions are used in other modes, with a different value for the outline regexp.  WHile this will not work for many Org functions, it is useful to have it work for some.

2. For just searching headings, it is efficient to use a regexp that is as simple as possible and does not need to do any back tracking.

3. You can easily use the simple regexps to find a heading.  If you need detailed info, match again with looking-at and then use the match data.

Regards

- Carsten

On 14.9.2013, at 23:30, aditya siram <aditya.siram@gmail.com> wrote:

> Hi all,
> Org-mode uses two regex's to find headings, one from outline.el and one defined internally and captures more information. I propose we stop using the one from outline.el.
> 
> org-mode uses `org-back-to-heading` a lot to navigate point back to the nearest heading. 
> 
> This just delegates to `outline-back-to-heading` from the outline.el package, which uses a regex for finding headlines: "[*\^L]+"
> 
> Org also defines another heading regex which is more capable and captures more information: "^\\(\\*+\\)\\(?: +\\(.*?\\)\\)?[ \t]*$".
> 
> I would propose changing org-back-to-heading to use that so that a user (like me :) ) can use `match-string` to grab the relevant parts of the string.
> 
> Since this is a pretty simple, but sweeping change, I thought I'd bring it up here first before patching.
> 
> Thanks!
> -deech
> 
> 
> 

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

* Re: Change org-back-to-heading to use org's heading regex
  2013-09-14 22:21 ` Carsten Dominik
@ 2013-09-17 22:37   ` aditya siram
  0 siblings, 0 replies; 3+ messages in thread
From: aditya siram @ 2013-09-17 22:37 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1774 bytes --]

Yes, you're right. And while I was looking for an alternate solution I
found `org-heading-components` which does everything I need and more!
Thanks!
-deech


On Sat, Sep 14, 2013 at 5:21 PM, Carsten Dominik
<carsten.dominik@gmail.com>wrote:

> Hi Aditya,
>
> I do not support this idea.
>
> 1. sometimes Org functions are used in other modes, with a different value
> for the outline regexp.  WHile this will not work for many Org functions,
> it is useful to have it work for some.
>
> 2. For just searching headings, it is efficient to use a regexp that is as
> simple as possible and does not need to do any back tracking.
>
> 3. You can easily use the simple regexps to find a heading.  If you need
> detailed info, match again with looking-at and then use the match data.
>
> Regards
>
> - Carsten
>
> On 14.9.2013, at 23:30, aditya siram <aditya.siram@gmail.com> wrote:
>
> > Hi all,
> > Org-mode uses two regex's to find headings, one from outline.el and one
> defined internally and captures more information. I propose we stop using
> the one from outline.el.
> >
> > org-mode uses `org-back-to-heading` a lot to navigate point back to the
> nearest heading.
> >
> > This just delegates to `outline-back-to-heading` from the outline.el
> package, which uses a regex for finding headlines: "[*\^L]+"
> >
> > Org also defines another heading regex which is more capable and
> captures more information: "^\\(\\*+\\)\\(?: +\\(.*?\\)\\)?[ \t]*$".
> >
> > I would propose changing org-back-to-heading to use that so that a user
> (like me :) ) can use `match-string` to grab the relevant parts of the
> string.
> >
> > Since this is a pretty simple, but sweeping change, I thought I'd bring
> it up here first before patching.
> >
> > Thanks!
> > -deech
> >
> >
> >
>
>

[-- Attachment #2: Type: text/html, Size: 2426 bytes --]

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

end of thread, other threads:[~2013-09-17 22:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-14 21:30 Change org-back-to-heading to use org's heading regex aditya siram
2013-09-14 22:21 ` Carsten Dominik
2013-09-17 22:37   ` aditya siram

Code repositories for project(s) associated with this public inbox

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

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