From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alex Kost Newsgroups: gmane.emacs.help Subject: Re: Changing name format for backup files Date: Wed, 13 Jan 2016 17:34:10 +0300 Message-ID: <874mehblb1.fsf@gmail.com> References: <87io2zem06.fsf@wanadoo.es> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1452695683 28776 80.91.229.3 (13 Jan 2016 14:34:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 13 Jan 2016 14:34:43 +0000 (UTC) Cc: =?utf-8?Q?=C3=93scar?= Fuentes , help-gnu-emacs@gnu.org To: Nick Helm Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jan 13 15:34:39 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aJMVS-0005wv-IF for geh-help-gnu-emacs@m.gmane.org; Wed, 13 Jan 2016 15:34:38 +0100 Original-Received: from localhost ([::1]:37423 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJMVH-0003Aj-HR for geh-help-gnu-emacs@m.gmane.org; Wed, 13 Jan 2016 09:34:27 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47027) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJMV4-00039q-6P for help-gnu-emacs@gnu.org; Wed, 13 Jan 2016 09:34:15 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aJMV0-0007tN-Tz for help-gnu-emacs@gnu.org; Wed, 13 Jan 2016 09:34:14 -0500 Original-Received: from mail-lf0-x22a.google.com ([2a00:1450:4010:c07::22a]:34560) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJMV0-0007tE-Mj for help-gnu-emacs@gnu.org; Wed, 13 Jan 2016 09:34:10 -0500 Original-Received: by mail-lf0-x22a.google.com with SMTP id 17so54248065lfz.1 for ; Wed, 13 Jan 2016 06:34:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type:content-transfer-encoding; bh=z5+jHrPhIAhzUy3OrpcUynqKvaARBDoMIlWlJOkRG9Q=; b=uqodw0wkyT19AOR+okfjmA6L2CRNKH+IZo3sZ9RxcZPCcEcAW9IJsr9KWo/cXIrVBK zFaU+Kcpcp5nyTI7d9n9mOwQLvuSrd8LV+FhWvmWdQ4xgr+vAJRqj/8Eh0Mrdr0RG/FK LU3KfICwOcxJyqm6B80nbbpHcK1/IAhHQFKtMMpeb5bT0GG1/RSaP9OyRwvXXdvLkdK5 1ESeF8KeGGX7eOKP52096O1OUxl7BMKkdp96VrqkVpYkKRvtatywc8N/GRipsv+cZ9Et 1+5M3g5m6vWY+q7Z6Jfggsk46jDQx7YLl9pULjQpl5p5aMCz21RBRKZ5MiDrGH/j4lvR XMAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type :content-transfer-encoding; bh=z5+jHrPhIAhzUy3OrpcUynqKvaARBDoMIlWlJOkRG9Q=; b=GYXeZYiho+qmAMGe+CTps4TSSfpqzgOITmgf5HXQKoSDG4fyFmhE6FrePb2gmfGnOR Ce5FX9WpH8jAVjOvLPEPw5W+7/kHJojkP2chMO5uiIe32X1OdYsR48LSSsLV7LLkq6gz Bab8deqxUVZ34grE7WJLIpUbcqmyW4PgYpKYMDXW5AOE+MQqRlDT/Gt/IvDYuDAMzN2o Oo5dHIfHn3cKWeDFi4LU6VN8qna3ZDfaU5T/0xbyYhj3wAP54uZgIZzZ+FPzkAiriLYm /AYVL876R35XWlvxaCs3O615FyAs0L/m3f+2Y4UhwiKYXRlJSXZNWzBNinucDlHCc617 7V1w== X-Gm-Message-State: ALoCoQnV4XyjQf0+MXJ5xgHslVue3nXycCxM2g2FJ5f6neLWF6u9+VQ3WibcV2Ed4d2cV6/EMzbf5uWXC3qaWmfwauGCjhU2mw== X-Received: by 10.25.136.139 with SMTP id k133mr13376242lfd.157.1452695649651; Wed, 13 Jan 2016 06:34:09 -0800 (PST) Original-Received: from leviafan ([217.107.192.146]) by smtp.gmail.com with ESMTPSA id o9sm222828lfe.15.2016.01.13.06.34.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jan 2016 06:34:08 -0800 (PST) In-Reply-To: (Nick Helm's message of "Wed, 13 Jan 2016 11:32:42 +1300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::22a X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:108711 Archived-At: Nick Helm (2016-01-13 01:32 +0300) wrote: >> However, often there are variables that control how some feature works. >> For your case, those seems to apply: >> >> C-h v make-backup-file-name-function > > Thanks, > > The trouble is, I also use numbered backups and in this case, when I set > make-backup-file-name-function to a custom function (as described in help= ), it > has no effect. For example, if I eval this: > > (defun nick-backup-file-naming-function (file) > "Return a backup file name with prefix dot and suffix tilde." > (concat (file-name-directory file) "." (file-name-nondirectory file)= "~")) > > (setq make-backup-file-name-function 'nick-backup-file-naming-function) > > (setq version-control 'never) ;; or nil > > (make-backup-file-name "/Users/nick/Desktop/sample.txt") > > it returns "/Users/nick/Desktop/.sample.txt~" as expected. However, with > > (setq version-control t) > > it returns "/Users/nick/Desktop/sample.txt.~1~" , that is, backup names a= re > correctly versioned, but the name is missing the prefix dot. It appears a= s if > `make-backup-file-name' is not being called in this case. > > Looking at `files.el' it seems like `find-backup-file-name' calls > `make-backup-file-name-1' directly, bypassing the custom fuction. When I was messing with backing up, I also noticed this thing. So what I did is: I just replaced `make-backup-file-name-1' with my own `utl-make-backup-file-name-1' function=C2=B9 that does what I need: (advice-add 'make-backup-file-name-1 :override 'utl-make-backup-file-name-1) I didn't follow this thread closely, so I'm sorry if this reply is useless. =C2=B9 https://github.com/alezost/emacs-utils/blob/master/utl-file.el#L76-L= 102 --=20 Alex