From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: org-capture: Capture template =?utf-8?B?4oCYZ+KAmTo=?= Match data clobbered by buffer modification hooks Date: Fri, 15 Jul 2016 20:39:34 +0300 Message-ID: <8360s67qcp.fsf@gnu.org> References: <87vb066ejv.fsf@linaro.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1468604444 10430 80.91.229.3 (15 Jul 2016 17:40:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 15 Jul 2016 17:40:44 +0000 (UTC) Cc: emacs-devel@gnu.org To: Alex =?utf-8?Q?Benn=C3=A9e?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jul 15 19:40:37 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bO76A-0006zt-Rq for ged-emacs-devel@m.gmane.org; Fri, 15 Jul 2016 19:40:26 +0200 Original-Received: from localhost ([::1]:34049 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bO769-0001uP-V4 for ged-emacs-devel@m.gmane.org; Fri, 15 Jul 2016 13:40:26 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45117) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bO75a-0001u5-0q for emacs-devel@gnu.org; Fri, 15 Jul 2016 13:39:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bO75U-0003Fs-RM for emacs-devel@gnu.org; Fri, 15 Jul 2016 13:39:48 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:37315) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bO75U-0003Fi-O3; Fri, 15 Jul 2016 13:39:44 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3767 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bO75T-0001bP-EL; Fri, 15 Jul 2016 13:39:43 -0400 In-reply-to: <87vb066ejv.fsf@linaro.org> (message from Alex =?utf-8?Q?Benn?= =?utf-8?Q?=C3=A9e?= on Fri, 15 Jul 2016 17:39:48 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:205739 Archived-At: > From: Alex Bennée > Cc: Eli Zaretskii > Date: Fri, 15 Jul 2016 17:39:48 +0100 > > This seems to have been introduced by commit: > > 3a9d6296b35e5317c497674d5725eb52699bd3b8 > Author: Eli Zaretskii > > 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.