[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: org-capture: Capture template ‘g’: Match data clobbered by buffer mo
From: |
Eli Zaretskii |
Subject: |
Re: org-capture: Capture template ‘g’: Match data clobbered by buffer modification hooks |
Date: |
Fri, 15 Jul 2016 20:39:34 +0300 |
> From: Alex Bennée <address@hidden>
> Cc: Eli Zaretskii <address@hidden>
> Date: Fri, 15 Jul 2016 17:39:48 +0100
>
> This seems to have been introduced by commit:
>
> 3a9d6296b35e5317c497674d5725eb52699bd3b8
> Author: Eli Zaretskii <address@hidden>
>
> 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.
- org-capture: Capture template ‘g’: Match data clobbered by buffer modification hooks, Alex Bennée, 2016/07/15
- Re: org-capture: Capture template ‘g’: Match data clobbered by buffer modification hooks,
Eli Zaretskii <=
- Re: org-capture: Capture template ‘g’: Match data clobbered by buffer modification hooks, Alex Bennée, 2016/07/15
- Re: org-capture: Capture template ‘g’: Match data clobbered by buffer modification hooks, Noam Postavsky, 2016/07/15
- Re: org-capture: Capture template ‘g’: Match data clobbered by buffer modification hooks, Alex Bennée, 2016/07/15
- 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
- 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), Eli Zaretskii, 2016/07/16
- 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), John Wiegley, 2016/07/16
- 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), Alex Bennée, 2016/07/17
- 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), Eli Zaretskii, 2016/07/17