From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel 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 Message-ID: References: <87efnan46u.fsf@linux-m68k.org> <86wp12qtgo.fsf@dod.no> <83tvw6chqv.fsf@gnu.org> <86shbprix7.fsf_-_@dod.no> <838t6jgl1k.fsf@gnu.org> <601m6cc6.fsf@lifelogs.com> <83o9fefnv9.fsf@gnu.org> <83in5lg4ol.fsf@gnu.org> <83efg9fxnj.fsf@gnu.org> <838t6hfa4h.fsf@gnu.org> <87h8l4lt9q.fsf@gmail.com> <831sc8fttu.fsf@gnu.org> <87sh4lwwg6.fsf_-_@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1531707249 32587 195.159.176.226 (16 Jul 2018 02:14:09 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 16 Jul 2018 02:14:09 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 16 04:14:05 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fet1Z-0008P3-G8 for ged-emacs-devel@m.gmane.org; Mon, 16 Jul 2018 04:14:05 +0200 Original-Received: from localhost ([::1]:48530 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fet3g-0005Kw-EF for ged-emacs-devel@m.gmane.org; Sun, 15 Jul 2018 22:16:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59559) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fet2u-0005Kg-C5 for emacs-devel@gnu.org; Sun, 15 Jul 2018 22:15:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fet2r-0008Rs-6K for emacs-devel@gnu.org; Sun, 15 Jul 2018 22:15:28 -0400 Original-Received: from [195.159.176.226] (port=43735 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fet2q-0008RE-U9 for emacs-devel@gnu.org; Sun, 15 Jul 2018 22:15:25 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1fet0d-0007Ra-FZ for emacs-devel@gnu.org; Mon, 16 Jul 2018 04:13:07 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 52 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:QivxI7sOFz/EklQ8BuBBUf43OT0= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:227442 Archived-At: > +(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 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"? > + (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". Stefan