emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PATCH to add-log.el for bug with re-use of empty items


From: Jason Merrill
Subject: PATCH to add-log.el for bug with re-use of empty items
Date: Wed, 30 Mar 2011 15:15:12 -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

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.
2011-03-30  Jason Merrill  <address@hidden>

        * 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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]