From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jason Merrill Newsgroups: gmane.emacs.devel Subject: PATCH to add-log.el for bug with re-use of empty items Date: Wed, 30 Mar 2011 15:15:12 -0400 Message-ID: <4D938140.4030905@redhat.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------030205070304000403040106" X-Trace: dough.gmane.org 1301514990 31135 80.91.229.12 (30 Mar 2011 19:56:30 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 30 Mar 2011 19:56:30 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 30 21:56:26 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q51Uw-0001T6-Q8 for ged-emacs-devel@m.gmane.org; Wed, 30 Mar 2011 21:56:24 +0200 Original-Received: from localhost ([127.0.0.1]:43335 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q51Uj-00034E-NH for ged-emacs-devel@m.gmane.org; Wed, 30 Mar 2011 15:55:57 -0400 Original-Received: from [140.186.70.92] (port=60947 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q511r-0003LM-Vt for emacs-devel@gnu.org; Wed, 30 Mar 2011 15:26:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q50rN-0008DP-4K for emacs-devel@gnu.org; Wed, 30 Mar 2011 15:15:18 -0400 Original-Received: from mx1.redhat.com ([209.132.183.28]:10113) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q50rM-0008Cz-Rv for emacs-devel@gnu.org; Wed, 30 Mar 2011 15:15:17 -0400 Original-Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p2UJFETE030570 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 30 Mar 2011 15:15:15 -0400 Original-Received: from [127.0.0.1] (ovpn-113-113.phx2.redhat.com [10.3.113.113]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p2UJFDKG020231 for ; Wed, 30 Mar 2011 15:15:14 -0400 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Lightning/1.0b2 Thunderbird/3.1.9 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 X-Mailman-Approved-At: Wed, 30 Mar 2011 15:54:45 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:137929 Archived-At: This is a multi-part message in MIME format. --------------030205070304000403040106 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit This patch is against emacs 2.32 in Fedora 14, but the relevant regexp seems to be unchanged in the current source tree. When I do C-x 4 a in a ChangeLog file, it creates an empty item that looks like * If I then switch to another source file in the same directory and do C-x 4 a again, I get * myfile.c (somefn): rather than * myfile.c (somefn): This is due to the regular expression used to search for an empty item in add-change-log-entry. "^\\s *\\*\\s *$" looks for any whitespace followed by a *, followed by any whitespace, followed by the end of a line. Unfortunately, when faced with * this regexp matches not only the line with the * on it, but the newline at the end, and the $ matches the end of the following empty line. My patch changes the final "\\s *" to just " *" so it doesn't match newlines. --------------030205070304000403040106 Content-Type: text/plain; name="add-cl-entry.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="add-cl-entry.patch" 2011-03-30 Jason Merrill * add-log.el (add-change-log-entry): Don't use whitespace syntax class to search for whitespace on a single line. *** add-log.el.~1~ 2011-03-30 15:02:21.143716165 -0400 --- add-log.el 2011-03-30 15:02:53.717952332 -0400 *************** non-nil, otherwise in local time." *** 880,886 **** (point)))) ;; Now insert the new line for this item. ! (cond ((re-search-forward "^\\s *\\*\\s *$" bound t) ;; Put this file name into the existing empty item. (if item (insert item))) --- 880,886 ---- (point)))) ;; Now insert the new line for this item. ! (cond ((re-search-forward "^\\s *\\* *$" bound t) ;; Put this file name into the existing empty item. (if item (insert item))) *************** non-nil, otherwise in local time." *** 922,928 **** ;; No function name, so put in a colon unless we have just a star. (unless (save-excursion (beginning-of-line 1) ! (looking-at "\\s *\\(\\*\\s *\\)?$")) (insert ": ") (if version (insert version ?\s))) ;; Make it easy to get rid of the function name. --- 922,928 ---- ;; No function name, so put in a colon unless we have just a star. (unless (save-excursion (beginning-of-line 1) ! (looking-at "\\s *\\(\\* *\\)?$")) (insert ": ") (if version (insert version ?\s))) ;; Make it easy to get rid of the function name. --------------030205070304000403040106--