all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] org-end-of-meta-data-and-drawers
@ 2011-06-08 22:47 Eric Abrahamsen
  2011-06-09  0:34 ` Eric Abrahamsen
  2011-06-30 16:02 ` Bastien
  0 siblings, 2 replies; 8+ messages in thread
From: Eric Abrahamsen @ 2011-06-08 22:47 UTC (permalink / raw)
  To: emacs-orgmode

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

Currently, this function goes to a lot of trouble to concatenate a
complicated regexp to find metadata and drawers, and then doesn't use
it. As it stands, if you put point in a headline that has a property
drawer and then call =(org-end-of-meta-data-and-drawers)=, point moves
to the *beginning* of the property drawer -- obviously not what you
want.

Eric



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: orgmetadatafix.diff --]
[-- Type: text/x-diff, Size: 465 bytes --]

diff --git a/lisp/org.el b/lisp/org.el
index 777850a..e7f9f89 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -19992,7 +19992,7 @@ clocking lines, and drawers."
 		    "\\|"
 		    "\\([ \t]*\\(" org-keyword-time-regexp "\\)\\)")))
     (forward-line 1)
-    (while (looking-at (concat "[ \t]*\\(" org-keyword-time-regexp "\\)"))
+    (while (looking-at (concat "[ \t]*\\(" re "\\)"))
       (if (not (match-end 1))
 	  ;; empty or planning line
 	  (forward-line 1)

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

* Re: [PATCH] org-end-of-meta-data-and-drawers
  2011-06-08 22:47 [PATCH] org-end-of-meta-data-and-drawers Eric Abrahamsen
@ 2011-06-09  0:34 ` Eric Abrahamsen
  2011-06-09  0:43   ` Eric Abrahamsen
  2011-06-30 16:02 ` Bastien
  1 sibling, 1 reply; 8+ messages in thread
From: Eric Abrahamsen @ 2011-06-09  0:34 UTC (permalink / raw)
  To: emacs-orgmode

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Currently, this function goes to a lot of trouble to concatenate a
> complicated regexp to find metadata and drawers, and then doesn't use
> it. As it stands, if you put point in a headline that has a property
> drawer and then call =(org-end-of-meta-data-and-drawers)=, point moves
> to the *beginning* of the property drawer -- obviously not what you
> want.

Dammit this is still not right, hang on a second…

Eric

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

* Re: [PATCH] org-end-of-meta-data-and-drawers
  2011-06-09  0:34 ` Eric Abrahamsen
@ 2011-06-09  0:43   ` Eric Abrahamsen
  2011-06-29 15:52     ` Eric Abrahamsen
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Abrahamsen @ 2011-06-09  0:43 UTC (permalink / raw)
  To: emacs-orgmode

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

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> Currently, this function goes to a lot of trouble to concatenate a
>> complicated regexp to find metadata and drawers, and then doesn't use
>> it. As it stands, if you put point in a headline that has a property
>> drawer and then call =(org-end-of-meta-data-and-drawers)=, point moves
>> to the *beginning* of the property drawer -- obviously not what you
>> want.
>
> Dammit this is still not right, hang on a second…

Okay, this should be right, sorry about that.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: orgmetadatafix.diff --]
[-- Type: text/x-diff, Size: 438 bytes --]

diff --git a/lisp/org.el b/lisp/org.el
index 777850a..ee0b88c 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -19992,7 +19992,7 @@ clocking lines, and drawers."
 		    "\\|"
 		    "\\([ \t]*\\(" org-keyword-time-regexp "\\)\\)")))
     (forward-line 1)
-    (while (looking-at (concat "[ \t]*\\(" org-keyword-time-regexp "\\)"))
+    (while (looking-at re)
       (if (not (match-end 1))
 	  ;; empty or planning line
 	  (forward-line 1)

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

* Re: [PATCH] org-end-of-meta-data-and-drawers
  2011-06-09  0:43   ` Eric Abrahamsen
@ 2011-06-29 15:52     ` Eric Abrahamsen
  2011-06-30 16:03       ` Bastien
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Abrahamsen @ 2011-06-29 15:52 UTC (permalink / raw)
  To: emacs-orgmode

It looks like patch-acceptance has picked up again recently -- may I
humbly bump the fix below? Such a useful helper function, otherwise!

Thanks,
Eric

> diff --git a/lisp/org.el b/lisp/org.el
> index 777850a..ee0b88c 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -19992,7 +19992,7 @@ clocking lines, and drawers."
>  		    "\\|"
>  		    "\\([ \t]*\\(" org-keyword-time-regexp "\\)\\)")))
>      (forward-line 1)
> -    (while (looking-at (concat "[ \t]*\\(" org-keyword-time-regexp "\\)"))
> +    (while (looking-at re)
>        (if (not (match-end 1))
>  	  ;; empty or planning line
>  	  (forward-line 1)

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

* Re: [PATCH] org-end-of-meta-data-and-drawers
  2011-06-08 22:47 [PATCH] org-end-of-meta-data-and-drawers Eric Abrahamsen
  2011-06-09  0:34 ` Eric Abrahamsen
@ 2011-06-30 16:02 ` Bastien
  2011-07-01  0:46   ` Eric Abrahamsen
  1 sibling, 1 reply; 8+ messages in thread
From: Bastien @ 2011-06-30 16:02 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: emacs-orgmode

Hi Eric,

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Currently, this function goes to a lot of trouble to concatenate a
> complicated regexp to find metadata and drawers, and then doesn't use
> it. As it stands, if you put point in a headline that has a property
> drawer and then call =(org-end-of-meta-data-and-drawers)=, point moves
> to the *beginning* of the property drawer -- obviously not what you
> want.

you're right there was something weird in this function.

I just simplified it, inspired by your patch.  Thanks 
for this!

-- 
 Bastien

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

* Re: [PATCH] org-end-of-meta-data-and-drawers
  2011-06-29 15:52     ` Eric Abrahamsen
@ 2011-06-30 16:03       ` Bastien
  0 siblings, 0 replies; 8+ messages in thread
From: Bastien @ 2011-06-30 16:03 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: emacs-orgmode

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> It looks like patch-acceptance has picked up again recently -- may I
> humbly bump the fix below? Such a useful helper function, otherwise!

If you are using this helper function in your own defuns, please report
any issue.  For example, I see no reason why the function should gives
the value of (point), but maybe you need this.

Thanks,

-- 
 Bastien

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

* Re: [PATCH] org-end-of-meta-data-and-drawers
  2011-06-30 16:02 ` Bastien
@ 2011-07-01  0:46   ` Eric Abrahamsen
  2011-07-05  9:05     ` Bastien
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Abrahamsen @ 2011-07-01  0:46 UTC (permalink / raw)
  To: emacs-orgmode

On Thu, Jun 30 2011, Bastien wrote:

> Hi Eric,
>
> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> Currently, this function goes to a lot of trouble to concatenate a
>> complicated regexp to find metadata and drawers, and then doesn't use
>> it. As it stands, if you put point in a headline that has a property
>> drawer and then call =(org-end-of-meta-data-and-drawers)=, point moves
>> to the *beginning* of the property drawer -- obviously not what you
>> want.
>
> you're right there was something weird in this function.
>
> I just simplified it, inspired by your patch.  Thanks 
> for this!

Thanks, but this introduces new problems for me -- the regexp matches on
every line, so it trucks along past both drawers and regular text to the
next heading, and stops there. I think the test for the drawer end is
necessary, which probably means the regexp grouping is also necessary…

E

PS My own use case (another version of org word count) didn't rely on a
return value from the function, but it strikes me that, all else being
equal, a return value of point could be more useful than nothing…

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

* Re: [PATCH] org-end-of-meta-data-and-drawers
  2011-07-01  0:46   ` Eric Abrahamsen
@ 2011-07-05  9:05     ` Bastien
  0 siblings, 0 replies; 8+ messages in thread
From: Bastien @ 2011-07-05  9:05 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: emacs-orgmode

Hi Eric,

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Thanks, but this introduces new problems for me -- the regexp matches on
> every line, so it trucks along past both drawers and regular text to the
> next heading, and stops there. I think the test for the drawer end is
> necessary, which probably means the regexp grouping is also necessary…

This should be fixed now.

Thanks for the careful testing!

> PS My own use case (another version of org word count) didn't rely on a
> return value from the function, but it strikes me that, all else being
> equal, a return value of point could be more useful than nothing…

Yes, I left the (point) call at the end.

Best,

-- 
 Bastien

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

end of thread, other threads:[~2011-07-05  9:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-08 22:47 [PATCH] org-end-of-meta-data-and-drawers Eric Abrahamsen
2011-06-09  0:34 ` Eric Abrahamsen
2011-06-09  0:43   ` Eric Abrahamsen
2011-06-29 15:52     ` Eric Abrahamsen
2011-06-30 16:03       ` Bastien
2011-06-30 16:02 ` Bastien
2011-07-01  0:46   ` Eric Abrahamsen
2011-07-05  9:05     ` Bastien

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.