* org-capture: Capture template ‘g’: Match data clobbered by buffer modification hooks
@ 2016-07-15 16:39 Alex Bennée
2016-07-15 17:39 ` Eli Zaretskii
0 siblings, 1 reply; 10+ messages in thread
From: Alex Bennée @ 2016-07-15 16:39 UTC (permalink / raw)
To: emacs-devel; +Cc: Eli Zaretskii
Hi,
This seems to have been introduced by commit:
3a9d6296b35e5317c497674d5725eb52699bd3b8
Author: Eli Zaretskii <eliz@gnu.org>
Avoid crashes when buffer modification hooks clobber match data
* src/search.c (Freplace_match): Error out if buffer modification
hooks triggered by buffer changes in replace_range, upcase-region,
and upcase-initials-region clobber the match data needed to be
adjusted for the replacement. (Bug#23869)
1 file changed, 13 insertions(+)
src/search.c | 13 +++++++++++++
I have a org-capture template set up that's triggered by a helper
function:
(defun my-capture-review-tags ()
"Return a list of DCO style tags for current buffer."
(let ((tags))
(save-excursion
(goto-char (point-min))
(while (re-search-forward my-dco-tag-re (point-max) t)
(add-to-list 'tags (match-string-no-properties 0))))
tags))
(defun my-org-maybe-capture-review-tag ()
"Check buffer for DCO tags and if found queue a review comment."
(interactive)
(let ((tags (my-capture-review-tags)))
(when tags
(kill-new (mapconcat 'identity tags "\n"))
(org-capture nil "g"))))
And the following template:
("g" "Save reference to review tag"
entry
(file+headline "review.org" "Review Tags")
"** %a\n%c" :immediate-finish t)
But I'm not sure what's going on. Obviously there is match data setup as
I snarf the tags but I don't care about them by the time I run the
template insert. It's hard to tell what hooks are running that might be
doing something like this.
I tried setting debug-on-message to:
(setq debug-on-message "\\(?:Match data clobbered by\\)")
But it wouldn't trigger at all so I'm a little stumped by what is going
on? Have I done something wrong in my code or triggered a bug somewhere else?
--
Alex Bennée
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: org-capture: Capture template ‘g’: Match data clobbered by buffer modification hooks
2016-07-15 16:39 org-capture: Capture template ‘g’: Match data clobbered by buffer modification hooks Alex Bennée
@ 2016-07-15 17:39 ` Eli Zaretskii
2016-07-15 19:12 ` Alex Bennée
0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2016-07-15 17:39 UTC (permalink / raw)
To: Alex Bennée; +Cc: emacs-devel
> From: Alex Bennée <alex.bennee@linaro.org>
> Cc: Eli Zaretskii <eliz@gnu.org>
> Date: Fri, 15 Jul 2016 17:39:48 +0100
>
> This seems to have been introduced by commit:
>
> 3a9d6296b35e5317c497674d5725eb52699bd3b8
> Author: Eli Zaretskii <eliz@gnu.org>
>
> Avoid crashes when buffer modification hooks clobber match data
>
> * src/search.c (Freplace_match): Error out if buffer modification
> hooks triggered by buffer changes in replace_range, upcase-region,
> and upcase-initials-region clobber the match data needed to be
> adjusted for the replacement. (Bug#23869)
>
> 1 file changed, 13 insertions(+)
> src/search.c | 13 +++++++++++++
>
> I have a org-capture template set up that's triggered by a helper
> function:
>
> (defun my-capture-review-tags ()
> "Return a list of DCO style tags for current buffer."
> (let ((tags))
> (save-excursion
> (goto-char (point-min))
> (while (re-search-forward my-dco-tag-re (point-max) t)
> (add-to-list 'tags (match-string-no-properties 0))))
> tags))
>
> (defun my-org-maybe-capture-review-tag ()
> "Check buffer for DCO tags and if found queue a review comment."
> (interactive)
> (let ((tags (my-capture-review-tags)))
> (when tags
> (kill-new (mapconcat 'identity tags "\n"))
> (org-capture nil "g"))))
>
> And the following template:
>
> ("g" "Save reference to review tag"
> entry
> (file+headline "review.org" "Review Tags")
> "** %a\n%c" :immediate-finish t)
>
> But I'm not sure what's going on.
You need to use save-match-data.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: org-capture: Capture template ‘g’: Match data clobbered by buffer modification hooks
2016-07-15 17:39 ` Eli Zaretskii
@ 2016-07-15 19:12 ` Alex Bennée
2016-07-15 19:37 ` Noam Postavsky
0 siblings, 1 reply; 10+ messages in thread
From: Alex Bennée @ 2016-07-15 19:12 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: emacs-devel
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Alex Bennée <alex.bennee@linaro.org>
>> Cc: Eli Zaretskii <eliz@gnu.org>
>> Date: Fri, 15 Jul 2016 17:39:48 +0100
>>
>> This seems to have been introduced by commit:
>>
>> 3a9d6296b35e5317c497674d5725eb52699bd3b8
>> Author: Eli Zaretskii <eliz@gnu.org>
>>
>> Avoid crashes when buffer modification hooks clobber match data
>>
>> * src/search.c (Freplace_match): Error out if buffer modification
>> hooks triggered by buffer changes in replace_range, upcase-region,
>> and upcase-initials-region clobber the match data needed to be
>> adjusted for the replacement. (Bug#23869)
>>
>> 1 file changed, 13 insertions(+)
>> src/search.c | 13 +++++++++++++
>>
>> I have a org-capture template set up that's triggered by a helper
>> function:
>>
>> (defun my-capture-review-tags ()
>> "Return a list of DCO style tags for current buffer."
>> (let ((tags))
>> (save-excursion
>> (goto-char (point-min))
>> (while (re-search-forward my-dco-tag-re (point-max) t)
>> (add-to-list 'tags (match-string-no-properties 0))))
>> tags))
>>
>> (defun my-org-maybe-capture-review-tag ()
>> "Check buffer for DCO tags and if found queue a review comment."
>> (interactive)
>> (let ((tags (my-capture-review-tags)))
>> (when tags
>> (kill-new (mapconcat 'identity tags "\n"))
>> (org-capture nil "g"))))
>>
>> And the following template:
>>
>> ("g" "Save reference to review tag"
>> entry
>> (file+headline "review.org" "Review Tags")
>> "** %a\n%c" :immediate-finish t)
>>
>> But I'm not sure what's going on.
>
> You need to use save-match-data.
Wrapping the org-capture with save-match-data or even just clearing it:
(defun my-org-maybe-capture-review-tag ()
"Check buffer for DCO tags and if found queue a review comment."
(interactive)
(let ((tags (my-capture-review-tags)))
(when tags
(kill-new (mapconcat 'identity tags "\n"))
(set-match-data nil)
(org-capture nil "g"))))
Had no effect. I'm guessing this must be something happening in org-mode then....
--
Alex Bennée
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: org-capture: Capture template ‘g’: Match data clobbered by buffer modification hooks
2016-07-15 19:12 ` Alex Bennée
@ 2016-07-15 19:37 ` Noam Postavsky
2016-07-15 21:56 ` Alex Bennée
2016-07-16 16:01 ` Please consider making Bug #23917 a blocker for 25.1 (was Re: org-capture: Capture template ‘g’: Match data clobbered by buffer modification hooks) N. Jackson
0 siblings, 2 replies; 10+ messages in thread
From: Noam Postavsky @ 2016-07-15 19:37 UTC (permalink / raw)
To: Alex Bennée; +Cc: Eli Zaretskii, Emacs developers
On Fri, Jul 15, 2016 at 3:12 PM, Alex Bennée <alex.bennee@linaro.org> wrote:
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> From: Alex Bennée <alex.bennee@linaro.org>
>>> Cc: Eli Zaretskii <eliz@gnu.org>
>>> Date: Fri, 15 Jul 2016 17:39:48 +0100
>>>
>>> This seems to have been introduced by commit:
>>>
>>> 3a9d6296b35e5317c497674d5725eb52699bd3b8
> Wrapping the org-capture with save-match-data or even just clearing it:
>
> (defun my-org-maybe-capture-review-tag ()
> "Check buffer for DCO tags and if found queue a review comment."
> (interactive)
> (let ((tags (my-capture-review-tags)))
> (when tags
> (kill-new (mapconcat 'identity tags "\n"))
> (set-match-data nil)
> (org-capture nil "g"))))
>
> Had no effect. I'm guessing this must be something happening in org-mode then....
See Bug #23917 "commit 3a9d6296b35e5317c497674d5725eb52699bd3b8
causing org-capture to error out"
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: org-capture: Capture template ‘g’: Match data clobbered by buffer modification hooks
2016-07-15 19:37 ` Noam Postavsky
@ 2016-07-15 21:56 ` Alex Bennée
2016-07-16 16:01 ` Please consider making Bug #23917 a blocker for 25.1 (was Re: org-capture: Capture template ‘g’: Match data clobbered by buffer modification hooks) N. Jackson
1 sibling, 0 replies; 10+ messages in thread
From: Alex Bennée @ 2016-07-15 21:56 UTC (permalink / raw)
To: Noam Postavsky; +Cc: Eli Zaretskii, Emacs developers
Noam Postavsky <npostavs@users.sourceforge.net> writes:
> On Fri, Jul 15, 2016 at 3:12 PM, Alex Bennée <alex.bennee@linaro.org> wrote:
>>
>> Eli Zaretskii <eliz@gnu.org> writes:
>>
>>>> From: Alex Bennée <alex.bennee@linaro.org>
>>>> Cc: Eli Zaretskii <eliz@gnu.org>
>>>> Date: Fri, 15 Jul 2016 17:39:48 +0100
>>>>
>>>> This seems to have been introduced by commit:
>>>>
>>>> 3a9d6296b35e5317c497674d5725eb52699bd3b8
>
>> Wrapping the org-capture with save-match-data or even just clearing it:
>>
>> (defun my-org-maybe-capture-review-tag ()
>> "Check buffer for DCO tags and if found queue a review comment."
>> (interactive)
>> (let ((tags (my-capture-review-tags)))
>> (when tags
>> (kill-new (mapconcat 'identity tags "\n"))
>> (set-match-data nil)
>> (org-capture nil "g"))))
>>
>> Had no effect. I'm guessing this must be something happening in org-mode then....
>
> See Bug #23917 "commit 3a9d6296b35e5317c497674d5725eb52699bd3b8
> causing org-capture to error out"
OK thanks, will watch the bug and see if I can diagnose.
--
Alex Bennée
^ permalink raw reply [flat|nested] 10+ messages in thread
* Please consider making Bug #23917 a blocker for 25.1 (was Re: org-capture: Capture template ‘g’: Match data clobbered by buffer modification hooks)
2016-07-15 19:37 ` Noam Postavsky
2016-07-15 21:56 ` Alex Bennée
@ 2016-07-16 16:01 ` N. Jackson
2016-07-16 16:11 ` Eli Zaretskii
1 sibling, 1 reply; 10+ messages in thread
From: N. Jackson @ 2016-07-16 16:01 UTC (permalink / raw)
To: emacs-devel
At 15:37 -0400 on Friday 2016-07-15, Noam Postavsky wrote:
> On Fri, Jul 15, 2016 at 3:12 PM, Alex Bennée <alex.bennee@linaro.org> wrote:
>
> See Bug #23917 "commit 3a9d6296b35e5317c497674d5725eb52699bd3b8
> causing org-capture to error out"
Please consider making this bug (Bug #23917
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=23917) a blocker for
release of Emacs 25.1.
I use Org capture dozens of times a day -- it is central to my workflows
-- and this bug breaks all of my captures, even the very simplest ones.
An Emacs with this bug is unusable for me.
I don't think my pattern of using Org Mode is particularly unusual, at
least among those who use it is as an organizer. [Those who use it for
publication or for reproducible research or for literate programming may
have different usage patterns.] So this bug potentially impacts a
large number of Emacs users.
It seems clear from the discussion in the bug report that a change in
Emacs triggered the bug. (For me it was not present in the 25.0.95
pretest tarball with latest Org Mode, but is present in yesterday's
Emacs 25 branch with latest Org Mode.) But apparently with the version
of Org built in to Emacs the bug does not manifest. So it isn't clear if
the bug is in Emacs or if the change in Emacs just uncovered a bug in
Org Mode (or both). Either way, please can we wait until it's fixed
before the release (which otherwise feels like it's going to happen in
the next three to five weeks).
Thanks.
N.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Please consider making Bug #23917 a blocker for 25.1 (was Re: org-capture: Capture template ‘g’: Match data clobbered by buffer modification hooks)
2016-07-16 16:01 ` Please consider making Bug #23917 a blocker for 25.1 (was Re: org-capture: Capture template ‘g’: Match data clobbered by buffer modification hooks) N. Jackson
@ 2016-07-16 16:11 ` Eli Zaretskii
2016-07-16 17:09 ` John Wiegley
0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2016-07-16 16:11 UTC (permalink / raw)
To: N. Jackson; +Cc: emacs-devel
> From: nljlistbox2@gmail.com (N. Jackson)
> Date: Sat, 16 Jul 2016 13:01:50 -0300
>
> It seems clear from the discussion in the bug report that a change in
> Emacs triggered the bug. (For me it was not present in the 25.0.95
> pretest tarball with latest Org Mode, but is present in yesterday's
> Emacs 25 branch with latest Org Mode.) But apparently with the version
> of Org built in to Emacs the bug does not manifest. So it isn't clear if
> the bug is in Emacs or if the change in Emacs just uncovered a bug in
> Org Mode (or both). Either way, please can we wait until it's fixed
> before the release (which otherwise feels like it's going to happen in
> the next three to five weeks).
If the bug only happens with a version of Org that is not bundled with
Emacs, how can waiting with the release help fixing the bug? The bug
needs to be fixed in Org that was not yet imported into the Emacs
tree.
Maybe I'm missing something.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Please consider making Bug #23917 a blocker for 25.1 (was Re: org-capture: Capture template ‘g’: Match data clobbered by buffer modification hooks)
2016-07-16 16:11 ` Eli Zaretskii
@ 2016-07-16 17:09 ` John Wiegley
2016-07-17 17:28 ` Alex Bennée
0 siblings, 1 reply; 10+ messages in thread
From: John Wiegley @ 2016-07-16 17:09 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: N. Jackson, emacs-devel
>>>>> "EZ" == Eli Zaretskii <eliz@gnu.org> writes:
EZ> If the bug only happens with a version of Org that is not bundled with
EZ> Emacs, how can waiting with the release help fixing the bug? The bug needs
EZ> to be fixed in Org that was not yet imported into the Emacs tree.
Indeed. I use Org 8.2.11 (the version to be released with 25.1) with the
current emacs-25 branch, and I never have any problems with org-capture.
--
John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Please consider making Bug #23917 a blocker for 25.1 (was Re: org-capture: Capture template ‘g’: Match data clobbered by buffer modification hooks)
2016-07-16 17:09 ` John Wiegley
@ 2016-07-17 17:28 ` Alex Bennée
2016-07-17 17:41 ` Eli Zaretskii
0 siblings, 1 reply; 10+ messages in thread
From: Alex Bennée @ 2016-07-17 17:28 UTC (permalink / raw)
To: John Wiegley; +Cc: N. Jackson, Eli Zaretskii, emacs-devel
John Wiegley <jwiegley@gmail.com> writes:
>>>>>> "EZ" == Eli Zaretskii <eliz@gnu.org> writes:
>
> EZ> If the bug only happens with a version of Org that is not bundled with
> EZ> Emacs, how can waiting with the release help fixing the bug? The bug needs
> EZ> to be fixed in Org that was not yet imported into the Emacs tree.
>
> Indeed. I use Org 8.2.11 (the version to be released with 25.1) with the
> current emacs-25 branch, and I never have any problems with org-capture.
I've just uninstalled the ELPA installed org and run into the same
problem with the bundled version. It certainly doesn't happen with all
my capture templates but this particular entry with %a and %c does
trigger the error. From my *Messages:
Clipboard pasted as level 2 subtree
org-capture: Capture template ‘g’: Match data clobbered by buffer modification hooks
"/home/alex/src/emacs/install/share/emacs/25.0.95/lisp/org/org.elc"
--
Alex Bennée
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Please consider making Bug #23917 a blocker for 25.1 (was Re: org-capture: Capture template ‘g’: Match data clobbered by buffer modification hooks)
2016-07-17 17:28 ` Alex Bennée
@ 2016-07-17 17:41 ` Eli Zaretskii
0 siblings, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2016-07-17 17:41 UTC (permalink / raw)
To: Alex Bennée; +Cc: jwiegley, emacs-devel, nljlistbox2
> From: Alex Bennée <alex.bennee@linaro.org>
> Cc: Eli Zaretskii <eliz@gnu.org>, "N. Jackson" <nljlistbox2@gmail.com>, emacs-devel@gnu.org
> Date: Sun, 17 Jul 2016 18:28:36 +0100
>
> I've just uninstalled the ELPA installed org and run into the same
> problem with the bundled version. It certainly doesn't happen with all
> my capture templates but this particular entry with %a and %c does
> trigger the error. From my *Messages:
>
> Clipboard pasted as level 2 subtree
> org-capture: Capture template ‘g’: Match data clobbered by buffer modification hooks
> "/home/alex/src/emacs/install/share/emacs/25.0.95/lisp/org/org.elc"
Can you come up with a reproducible recipe, starting with "emacs -Q",
and then loading everything required for the reproduction? Otherwise,
I don't see how this problem could be resolved, given the sadly small
number of people on board who are capable of debugging such problems.
TIA
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2016-07-17 17:41 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-15 16:39 org-capture: Capture template ‘g’: Match data clobbered by buffer modification hooks Alex Bennée
2016-07-15 17:39 ` Eli Zaretskii
2016-07-15 19:12 ` Alex Bennée
2016-07-15 19:37 ` Noam Postavsky
2016-07-15 21:56 ` Alex Bennée
2016-07-16 16:01 ` Please consider making Bug #23917 a blocker for 25.1 (was Re: org-capture: Capture template ‘g’: Match data clobbered by buffer modification hooks) N. Jackson
2016-07-16 16:11 ` Eli Zaretskii
2016-07-16 17:09 ` John Wiegley
2016-07-17 17:28 ` Alex Bennée
2016-07-17 17:41 ` Eli Zaretskii
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.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).