[Top][All Lists]

[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: Stefan Monnier
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: Sun, 15 Jul 2018 22:15:11 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> +(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.

> +(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.
[ 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.  ]

> +(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

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

> +      (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".


reply via email to

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