emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] New option to make C-x 4 a use file-less ChangeLog buffers (


From: João Távora
Subject: Re: [PATCH] New option to make C-x 4 a use file-less ChangeLog buffers (was Re: git history tracking across renames (and emacs support))
Date: Mon, 16 Jul 2018 11:10:01 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> +(defcustom add-log-use-pseudo-changelog nil
>> +  "If non-nil, don't create ChangeLog files for log entries."
>> +  :type :boolean)
>> +
>> +(put 'add-log-use-pseudo-changelog 'safe-local-variable 'booleanp)
>
> Regarding the use of `put` instead of `:safep`, the advantage of `put`
> is that you can add an autoload cookie to it, which can be useful if the
> var's safety might be tested before the package is loaded.
>
> But to tell you the truth, I think the default should be t and those
> very rare users who might need it to be nil will probably just be happy
> to set it to nil globally once and for all, so I think the safety
> specification is a case of overengineering.

OK.  If noone strongly objects to setting this t, I will do so in the
next iteration.  I think it should be safe for people like Eli who
have/like a local .gitignored ChangeLog file, because in that case the
existing file will be used.

IOW, only if the option is t and there is no such file is a fileless
ChangeLog created.

>> +(defun add-log--pseudo-changelog-buffer-name (changelog-file-name)
>> +  "Compute suitable name for a pseudo-ChangeLog buffer."
>> +  (format "*PseudoChangeLog for %s*"
>> +          (file-name-directory changelog-file-name)))
>
> I'd drop the "pseudo" part.

Yeah, it's clunky.  I added it for clarity during the implementation,
but it's not needed.

> [ Ideally, it would interact with uniquify to show only the relevant part
>   of the directory name.  I.e. you can use a name like "*ChangeLog*"
>   and have it uniquified by setting
>
>       (setq list-buffers-directory
>             (expand-file-name "*ChangeLog*" default-directory))
>
>   it's a bit tricky to get it to work, IIRC, but you can take a look at
>   vc-dir-mode (in vc-dir.el) and cvs-get-buffer-create (in pcvs-util.el)
>   for examples.  ]

To tell you the truth, I was hoping to *avoid* uniquify here.  IMO, it
is designed for those cases where the file creator could reasonably be
convinced that his/her file would be unique (probably within a
dir/project).  This is not one of these cases, since Emacs is generally
useful for working more than one project at the same time.  In practice,
I find the "|<uniqueness>" much harder to read, and I prefer to save it
for when it can't be avoided.

This would also avoid the added complexity that you foresee.

>> +(defun add-log--changelog-buffer-p (changelog-file-name buffer)
>> +  "Tell if BUFFER is a ChangeLog for CHANGELOG-FILE-NAME."
>
> Not clear: is CHANGELOG-FILE-NAME supposed to be the name of a ChangeLog
> file?
>
> I believe it is the case, but if so "BUFFER is a ChangeLog for" doesn't
> sound quite right (it suggests that BUFFER holds the changelog that
> describes changes applied to CHANGELOG-FILE-NAME).  Instead, you might
> say something like "BUFFER is the buffer holding the contents of
> CHANGELOG-FILE-NAME"?

Right, that is clearer.  But will it fit in the miniscule column limit? 

>> +      (equal (add-log--pseudo-changelog-buffer-name changelog-file-name)
>> +             (buffer-name)))))
>
> With uniquification, this test will have to be changed since the buffer-name
> can change from "*ChangeLog*" to, say, "*ChangeLog*|emacs".

As I said, I was hoping to avoid this.  "*ChangeLog for
<full-project-path>*" seems acceptable to me, but we could shorten it to
$HOME or sth (how?).

João



reply via email to

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