GNU bug report logs - #17970
log-edit creates unwanted ChangeLog buffers

Previous Next

Package: emacs;

Reported by: Glenn Morris <rgm <at> gnu.org>

Date: Tue, 8 Jul 2014 02:36:02 UTC

Severity: important

Found in version 24.3.92

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 17970 in the body.
You can then email your comments to 17970 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#17970; Package emacs. (Tue, 08 Jul 2014 02:36:02 GMT) Full text and rfc822 format available.

Message #3 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: submit <at> debbugs.gnu.org
Subject: log-edit creates unwanted ChangeLog buffers
Date: Mon, 07 Jul 2014 22:35:39 -0400
Package: emacs
Version: 24.3.92
Severity: minor

## Just making a test repo:
mkdir /tmp/foo
cd /tmp/foo
bzr init
touch 1
bzr add 1

emacs -Q 1
C-x v v
enter some log message
C-c C-c

C-x C-b
  -> Now there is an empty, unwanted "/tmp/foo/ChangeLog" buffer.


I wish it would not create the ChangeLog buffer (especially when the
the repo does not use ChangeLogs).

Emacs 24.3 does not create these buffers.




Severity set to 'important' from 'minor' Request was from Stefan Monnier <monnier <at> iro.umontreal.ca> to control <at> debbugs.gnu.org. (Tue, 08 Jul 2014 18:09:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17970; Package emacs. (Wed, 09 Jul 2014 07:10:02 GMT) Full text and rfc822 format available.

Message #8 received at 17970 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 17970 <at> debbugs.gnu.org
Subject: Re: bug#17970: log-edit creates unwanted ChangeLog buffers
Date: Wed, 09 Jul 2014 03:09:23 -0400
Glenn Morris wrote:

> C-x v v
[...]
>   -> Now there is an empty, unwanted "/tmp/foo/ChangeLog" buffer.

It looks like this has the same cause as http://debbugs.gnu.org/17884,
namely the fact that vc-next-action now calls log-edit with SETUP = t.
This runs log-edit-hook, which runs log-edit-insert-changelog, which
ends up running log-edit-changelog-entries, which visits the ChangeLog
files, even if they don't exist.

Perhaps log-edit-changelog-entries should not bother visiting
non-existent files. (Could it use invisible buffers?)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17970; Package emacs. (Wed, 09 Jul 2014 13:56:02 GMT) Full text and rfc822 format available.

Message #11 received at 17970 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 17970 <at> debbugs.gnu.org
Subject: Re: bug#17970: log-edit creates unwanted ChangeLog buffers
Date: Wed, 09 Jul 2014 16:55:24 +0300
> From: Glenn Morris <rgm <at> gnu.org>
> Date: Wed, 09 Jul 2014 03:09:23 -0400
> 
> Perhaps log-edit-changelog-entries should not bother visiting
> non-existent files.

That wouldn't be TRT when starting a new repository, or a new
directory in an existing one.

It sounds like a user option is in order.  In addition, if the ignore
file mentions ChangeLog, the command could deduce automatically what
is TRT.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17970; Package emacs. (Wed, 09 Jul 2014 15:42:01 GMT) Full text and rfc822 format available.

Message #14 received at 17970 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 17970 <at> debbugs.gnu.org
Subject: Re: bug#17970: log-edit creates unwanted ChangeLog buffers
Date: Wed, 09 Jul 2014 11:41:35 -0400
Eli Zaretskii wrote:

>> Perhaps log-edit-changelog-entries should not bother visiting
>> non-existent files.
>
> That wouldn't be TRT when starting a new repository, or a new
> directory in an existing one.

What benefit is there to vc-next-action creating empty ChangeLog buffers
in such cases?

> In addition, if the ignore file mentions ChangeLog, the command could
> deduce automatically what is TRT.

(Then we need an ignore-file parser.)
Why would you have an unversioned ChangeLog, and why would this matter
to vc-next-action?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17970; Package emacs. (Wed, 09 Jul 2014 16:29:01 GMT) Full text and rfc822 format available.

Message #17 received at 17970 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 17970 <at> debbugs.gnu.org
Subject: Re: bug#17970: log-edit creates unwanted ChangeLog buffers
Date: Wed, 09 Jul 2014 19:28:07 +0300
> From: Glenn Morris <rgm <at> gnu.org>
> Cc: 17970 <at> debbugs.gnu.org
> Date: Wed, 09 Jul 2014 11:41:35 -0400
> 
> Eli Zaretskii wrote:
> 
> >> Perhaps log-edit-changelog-entries should not bother visiting
> >> non-existent files.
> >
> > That wouldn't be TRT when starting a new repository, or a new
> > directory in an existing one.
> 
> What benefit is there to vc-next-action creating empty ChangeLog buffers
> in such cases?

To let me _create_ one.

> > In addition, if the ignore file mentions ChangeLog, the command could
> > deduce automatically what is TRT.
> 
> (Then we need an ignore-file parser.)

With one file name per line, I wouldn't call it a "parser", really.

> Why would you have an unversioned ChangeLog

I didn't say I would.  What I meant was that if ChangeLog is in the
ignore file, that's a sign that a non-existent ChangeLog file should
not be visited, since this repository doesn't want such files.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17970; Package emacs. (Wed, 09 Jul 2014 16:40:02 GMT) Full text and rfc822 format available.

Message #20 received at 17970 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 17970 <at> debbugs.gnu.org
Subject: Re: bug#17970: log-edit creates unwanted ChangeLog buffers
Date: Wed, 09 Jul 2014 12:39:28 -0400
Eli Zaretskii wrote:

>> What benefit is there to vc-next-action creating empty ChangeLog buffers
>> in such cases?
>
> To let me _create_ one.

The point of this stuff is to prepopulate the vc log buffer with the
relevant ChangeLog entries. If the ChangeLog does not exist, then
obviously it is not going to find any. It does not show you the
ChangeLog buffer that it creates or in any way notify you, so I do not
see how this would help you in the scenario that you meant to write a
ChangeLog entry but forgot, which I presume is what you were referring
to. Could you give an example?

>> (Then we need an ignore-file parser.)
>
> With one file name per line, I wouldn't call it a "parser", really.

They contain wildcards, ! and ** patterns, etc.

>> Why would you have an unversioned ChangeLog
>
> I didn't say I would.  What I meant was that if ChangeLog is in the
> ignore file, that's a sign that a non-existent ChangeLog file should
> not be visited, since this repository doesn't want such files.

Why would you ignore a file that it not expected to exist in your repo?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17970; Package emacs. (Wed, 09 Jul 2014 16:55:01 GMT) Full text and rfc822 format available.

Message #23 received at 17970 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 17970 <at> debbugs.gnu.org
Subject: Re: bug#17970: log-edit creates unwanted ChangeLog buffers
Date: Wed, 09 Jul 2014 19:54:16 +0300
> From: Glenn Morris <rgm <at> gnu.org>
> Cc: 17970 <at> debbugs.gnu.org
> Date: Wed, 09 Jul 2014 12:39:28 -0400
> 
> The point of this stuff is to prepopulate the vc log buffer with the
> relevant ChangeLog entries. If the ChangeLog does not exist, then
> obviously it is not going to find any. It does not show you the
> ChangeLog buffer that it creates or in any way notify you, so I do not
> see how this would help you in the scenario that you meant to write a
> ChangeLog entry but forgot, which I presume is what you were referring
> to. Could you give an example?
> 
> >> (Then we need an ignore-file parser.)
> >
> > With one file name per line, I wouldn't call it a "parser", really.
> 
> They contain wildcards, ! and ** patterns, etc.
> 
> >> Why would you have an unversioned ChangeLog
> >
> > I didn't say I would.  What I meant was that if ChangeLog is in the
> > ignore file, that's a sign that a non-existent ChangeLog file should
> > not be visited, since this repository doesn't want such files.
> 
> Why would you ignore a file that it not expected to exist in your repo?

I don't really know what else to say.  I've written everything I could
about this, and it sounds pretty clear to me.  If none of that makes
sense, feel free to ignore.  I will know to keep my mouth shut next
time.




Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Wed, 09 Jul 2014 18:56:02 GMT) Full text and rfc822 format available.

Notification sent to Glenn Morris <rgm <at> gnu.org>:
bug acknowledged by developer. (Wed, 09 Jul 2014 18:56:03 GMT) Full text and rfc822 format available.

Message #28 received at 17970-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 17970-done <at> debbugs.gnu.org
Subject: Re: bug#17970: log-edit creates unwanted ChangeLog buffers
Date: Wed, 09 Jul 2014 14:54:57 -0400
> C-x C-b
-> Now there is an empty, unwanted "/tmp/foo/ChangeLog" buffer.

I installed the patch below which seems to fix this problem.


        Stefan


=== modified file 'lisp/vc/log-edit.el'
--- lisp/vc/log-edit.el	2014-07-01 15:15:03 +0000
+++ lisp/vc/log-edit.el	2014-07-09 18:52:47 +0000
@@ -905,6 +905,7 @@
              ;; that memoizing which is undesired here.
              (setq change-log-default-name nil)
              (find-change-log)))))
+    (when (file-exists-p changelog-file-name)
     (with-current-buffer (find-file-noselect changelog-file-name)
       (unless (eq major-mode 'change-log-mode) (change-log-mode))
       (goto-char (point-min))
@@ -942,7 +943,7 @@
                   (setq pos (max (1+ pos) (elt entry 1)))
 		  (goto-char pos)))
 
-	      (cons (current-buffer) texts))))))))
+                (cons (current-buffer) texts)))))))))
 
 (defun log-edit-changelog-insert-entries (buffer beg end &rest files)
   "Insert the text from BUFFER between BEG and END.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17970; Package emacs. (Wed, 09 Jul 2014 20:18:01 GMT) Full text and rfc822 format available.

Message #31 received at 17970 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 17970 <at> debbugs.gnu.org
Subject: Re: bug#17970: log-edit creates unwanted ChangeLog buffers
Date: Wed, 09 Jul 2014 16:17:20 -0400
Eli Zaretskii wrote:

> I don't really know what else to say.  I've written everything I could
> about this, and it sounds pretty clear to me.  If none of that makes
> sense, feel free to ignore.  I will know to keep my mouth shut next
> time.

Sorry, but it basically made no sense to me.
It didn't seem to bear any relation to what this report was (IMO) about.
I wasn't trying to be difficult or anything like that.
Never mind! :)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17970; Package emacs. (Wed, 09 Jul 2014 20:20:02 GMT) Full text and rfc822 format available.

Message #34 received at 17970 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 17970 <at> debbugs.gnu.org
Subject: Re: bug#17970: log-edit creates unwanted ChangeLog buffers
Date: Wed, 09 Jul 2014 16:19:19 -0400
Stefan Monnier wrote:

> I installed the patch below which seems to fix this problem.

Thanks.
I'm still going to find it a bit irritating when the file _does_ exist.
Why can't it use hidden buffers?
Is it in case you have edited but not saved the ChangeLog?
If so, could it use (or (find-buffer-visiting ...) <hidden buffer>)?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17970; Package emacs. (Wed, 09 Jul 2014 22:23:01 GMT) Full text and rfc822 format available.

Message #37 received at 17970 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 17970 <at> debbugs.gnu.org
Subject: Re: bug#17970: log-edit creates unwanted ChangeLog buffers
Date: Wed, 09 Jul 2014 18:22:12 -0400
>> I installed the patch below which seems to fix this problem.
> Thanks.
> I'm still going to find it a bit irritating when the file _does_ exist.

Indeed for those very projects that don't use a ChangeLog but do
auto-generate one, it could be a bit annoying.  But I don't think it's
a very serious issue.

> Why can't it use hidden buffers?
> Is it in case you have edited but not saved the ChangeLog?

Yes.

> If so, could it use (or (find-buffer-visiting ...) <hidden buffer>)?

It could do that, indeed.  Or it could kill the buffer at the end if the
buffer didn't exist earlier.  It seems more trouble than it's
worth, tho.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17970; Package emacs. (Thu, 10 Jul 2014 03:10:02 GMT) Full text and rfc822 format available.

Message #40 received at 17970 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Glenn Morris <rgm <at> gnu.org>, 17970 <at> debbugs.gnu.org
Subject: Re: bug#17970: log-edit creates unwanted ChangeLog buffers
Date: Wed, 09 Jul 2014 23:09:02 -0400
>> Perhaps log-edit-changelog-entries should not bother visiting
>> non-existent files.
> That wouldn't be TRT when starting a new repository, or a new
> directory in an existing one.

Of course it's correct.  You misunderstand the purpose of
log-edit-changelog-entries: it's not there to fill the ChangeLog but to
extract pre-existing text from it to fill the *VC-Log* buffer.
So if the file doesn't exist, there's nothing to get from it and we
might as well not visit the file.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17970; Package emacs. (Thu, 10 Jul 2014 15:00:02 GMT) Full text and rfc822 format available.

Message #43 received at 17970 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: rgm <at> gnu.org, 17970 <at> debbugs.gnu.org
Subject: Re: bug#17970: log-edit creates unwanted ChangeLog buffers
Date: Thu, 10 Jul 2014 17:59:43 +0300
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: Glenn Morris <rgm <at> gnu.org>,  17970 <at> debbugs.gnu.org
> Date: Wed, 09 Jul 2014 23:09:02 -0400
> 
> You misunderstand the purpose of log-edit-changelog-entries

No, I don't misunderstand.

> So if the file doesn't exist, there's nothing to get from it and we
> might as well not visit the file.

What if I already did "C-x 4 a", which visited a non-existing
ChangeLog, and wrote my entry, but didn't yet save that buffer?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17970; Package emacs. (Thu, 10 Jul 2014 16:47:02 GMT) Full text and rfc822 format available.

Message #46 received at 17970 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: rgm <at> gnu.org, 17970 <at> debbugs.gnu.org
Subject: Re: bug#17970: log-edit creates unwanted ChangeLog buffers
Date: Thu, 10 Jul 2014 12:45:49 -0400
>> So if the file doesn't exist, there's nothing to get from it and we
>> might as well not visit the file.
> What if I already did "C-x 4 a", which visited a non-existing
> ChangeLog, and wrote my entry, but didn't yet save that buffer?

I guess that would make sense, indeed.  Could you refine my patch so
as to handle that case?


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17970; Package emacs. (Thu, 10 Jul 2014 16:55:02 GMT) Full text and rfc822 format available.

Message #49 received at 17970 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 17970 <at> debbugs.gnu.org
Subject: Re: bug#17970: log-edit creates unwanted ChangeLog buffers
Date: Thu, 10 Jul 2014 12:54:43 -0400
Stefan Monnier wrote:

>> What if I already did "C-x 4 a", which visited a non-existing
>> ChangeLog, and wrote my entry, but didn't yet save that buffer?

Then you get punished for not committing your ChangeLog at the same time
as the associated commit. ;)

> I guess that would make sense, indeed.  Could you refine my patch so
> as to handle that case?

(or (find-buffer-visiting changelog-file-name)
    (file-exists-p changelog-file-name))





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17970; Package emacs. (Thu, 10 Jul 2014 17:19:02 GMT) Full text and rfc822 format available.

Message #52 received at 17970 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 17970 <at> debbugs.gnu.org
Subject: Re: bug#17970: log-edit creates unwanted ChangeLog buffers
Date: Thu, 10 Jul 2014 13:18:05 -0400
>>> What if I already did "C-x 4 a", which visited a non-existing
>>> ChangeLog, and wrote my entry, but didn't yet save that buffer?
> Then you get punished for not committing your ChangeLog at the same time
> as the associated commit. ;)

But this case is actually interesting because for repositories such as
`elpa' which don't use ChangeLogs but do want to use the ChangeLog
conventions in the commit message, a way to do that is to use C-x 4 a to
fill the ChangeLog buffer but you won't want to save this buffer.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17970; Package emacs. (Thu, 10 Jul 2014 17:23:02 GMT) Full text and rfc822 format available.

Message #55 received at 17970 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: rgm <at> gnu.org, 17970 <at> debbugs.gnu.org
Subject: Re: bug#17970: log-edit creates unwanted ChangeLog buffers
Date: Thu, 10 Jul 2014 20:22:51 +0300
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: Eli Zaretskii <eliz <at> gnu.org>,  17970 <at> debbugs.gnu.org
> Date: Thu, 10 Jul 2014 13:18:05 -0400
> 
> >>> What if I already did "C-x 4 a", which visited a non-existing
> >>> ChangeLog, and wrote my entry, but didn't yet save that buffer?
> > Then you get punished for not committing your ChangeLog at the same time
> > as the associated commit. ;)
> 
> But this case is actually interesting because for repositories such as
> `elpa' which don't use ChangeLogs but do want to use the ChangeLog
> conventions in the commit message, a way to do that is to use C-x 4 a to
> fill the ChangeLog buffer but you won't want to save this buffer.

Not just elpa, but other projects as well.  Guile and Coreutils, for
example.  That's how I bumped into this use case.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17970; Package emacs. (Thu, 10 Jul 2014 17:47:02 GMT) Full text and rfc822 format available.

Message #58 received at 17970 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 17970 <at> debbugs.gnu.org
Subject: Re: bug#17970: log-edit creates unwanted ChangeLog buffers
Date: Thu, 10 Jul 2014 13:46:00 -0400
Stefan Monnier wrote:

> But this case is actually interesting because for repositories such as
> `elpa' which don't use ChangeLogs but do want to use the ChangeLog
> conventions in the commit message, a way to do that is to use C-x 4 a to
> fill the ChangeLog buffer but you won't want to save this buffer.

Sounds like Emacs should provide a better mechanism for this,
rather than one that could eg leave unwanted auto-saves around.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17970; Package emacs. (Thu, 10 Jul 2014 18:21:02 GMT) Full text and rfc822 format available.

Message #61 received at 17970 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 17970 <at> debbugs.gnu.org
Subject: Re: bug#17970: log-edit creates unwanted ChangeLog buffers
Date: Thu, 10 Jul 2014 14:19:54 -0400
> Sounds like Emacs should provide a better mechanism for this,
> rather than one that could eg leave unwanted auto-saves around.

Indeed it should.


        Stefan




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 08 Aug 2014 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 314 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.