From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= 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: Mon, 16 Jul 2018 11:10:01 +0100 Message-ID: <87wotvebk6.fsf@gmail.com> References: <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; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1531735730 32353 195.159.176.226 (16 Jul 2018 10:08:50 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 16 Jul 2018 10:08:50 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 16 12:08:46 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 1ff0Qs-0008Fy-JK for ged-emacs-devel@m.gmane.org; Mon, 16 Jul 2018 12:08:42 +0200 Original-Received: from localhost ([::1]:50254 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ff0Sx-0008OV-PA for ged-emacs-devel@m.gmane.org; Mon, 16 Jul 2018 06:10:51 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36333) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ff0SH-0008My-TR for emacs-devel@gnu.org; Mon, 16 Jul 2018 06:10:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ff0SE-0006HQ-Fx for emacs-devel@gnu.org; Mon, 16 Jul 2018 06:10:09 -0400 Original-Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:37003) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ff0SE-0006H1-5O for emacs-devel@gnu.org; Mon, 16 Jul 2018 06:10:06 -0400 Original-Received: by mail-wr1-x441.google.com with SMTP id q10-v6so31261903wrd.4 for ; Mon, 16 Jul 2018 03:10:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=GW6V9rLJo/LbkPr9qj8YsGth6sEqjiS8lpBt9WvQqo0=; b=U+8iahfRyH/9c4o7cU82YirklrxqrCb3Bwwhvr4x23KzTPjZJJDeglcNIk5hE6yV3J krp7rEHb3kkySpJ/4ltUfsPJCT13abElFBkYL+0bhao+ZNwl70B049p0jyNjUT/P2P3U ebsrwW04+LwNggn816WxTBZbSnxu27KWPNxNNLmJRs/TjQPwc87N4xPdqpP72U+jieyf wt3+AQ4J86gvzt/NcTMtb1TkO+fgmG2tY8jSDYYVs3/U0adRGbL1UBHeVkJS4zVZAKh9 FOozaMmQsRCfAP3jidH28lxi4QVyx6/gFGND25jzCrGhUd4z56o4l3+yTrX4QTRfvx9z pwPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=GW6V9rLJo/LbkPr9qj8YsGth6sEqjiS8lpBt9WvQqo0=; b=ew+gx1bQPXyDDLtarxw59nOeW3os6YfcmMfPexcpK+ubSRQ6tiyjueJ6h1IFCwX96x GmiT2iaLCOQ/Bxqykw/Ndq5FiAElYIpl1nT7iBDBPigNKAghJoSCrKhxb4gFNivjfkHE vojxDWXf8EQ+WxLiQ4J/uexJuD4PesmcmFSSWE2NFcd+4flJIRoGpNOyE7+++Z+4FXaT c4OOcvBBdclgr1epJItJ5tbTb1Luti+b8+En+roBOR8esqFfFDgOZOX4fmYVcJoJDJiB t32/co4oPEz02R66gxs83gefQ9o89WQMB/boZ1udpoxoWzxUs0yTeBCSfeXzz7bSmMeB 7oRQ== X-Gm-Message-State: AOUpUlFQFRjen38CS4GUJ+oilY6cztVbS4vkUZY62N7nejbH40rgEzIO QW1pITXZvEw0rLq5Aq+SpSKgyrY+ X-Google-Smtp-Source: AAOMgpeU/YZc3RWh3wK7ys+WtGOVyt+CBaRyeiGLi3EOckrKugTIENNroWGwIaa4FDd9dLcLH0p6SQ== X-Received: by 2002:a5d:40c4:: with SMTP id b4-v6mr10553072wrq.133.1531735804726; Mon, 16 Jul 2018 03:10:04 -0700 (PDT) Original-Received: from lolita.yourcompany.com (188.139.62.94.rev.vodafone.pt. [94.62.139.188]) by smtp.gmail.com with ESMTPSA id z3-v6sm29797968wru.27.2018.07.16.03.10.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Jul 2018 03:10:03 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Sun, 15 Jul 2018 22:15:11 -0400") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 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:227446 Archived-At: Stefan Monnier 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 "|" 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?=20 >> + (equal (add-log--pseudo-changelog-buffer-name changelog-file-name) >> + (buffer-name))))) > > With uniquification, this test will have to be changed since the buffer-n= ame > can change from "*ChangeLog*" to, say, "*ChangeLog*|emacs". As I said, I was hoping to avoid this. "*ChangeLog for *" seems acceptable to me, but we could shorten it to $HOME or sth (how?). Jo=C3=A3o