* PATCH to add-log.el for bug with re-use of empty items
@ 2011-03-30 19:15 Jason Merrill
2011-03-30 21:56 ` Stefan Monnier
0 siblings, 1 reply; 2+ messages in thread
From: Jason Merrill @ 2011-03-30 19:15 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 836 bytes --]
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.
[-- Attachment #2: add-cl-entry.patch --]
[-- Type: text/plain, Size: 1536 bytes --]
2011-03-30 Jason Merrill <jason@redhat.com>
* 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.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: PATCH to add-log.el for bug with re-use of empty items
2011-03-30 19:15 PATCH to add-log.el for bug with re-use of empty items Jason Merrill
@ 2011-03-30 21:56 ` Stefan Monnier
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2011-03-30 21:56 UTC (permalink / raw)
To: Jason Merrill; +Cc: emacs-devel
> If I then switch to another source file in the same directory and do C-x
> 4 a again, I get
> *
> myfile.c (somefn):
Thanks for tracking it down. I regularly bump into it but never found
the motivation to dig into the code to figure it out.
Installed into trunk,
Stefan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-03-30 21:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-30 19:15 PATCH to add-log.el for bug with re-use of empty items Jason Merrill
2011-03-30 21:56 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.