unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Manuel Giraud via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: Steinar Bang <sb@dod.no>
Cc: help-gnu-emacs@gnu.org
Subject: Re: How to switch off autobackup for files loaded from tramp?
Date: Tue, 30 Jan 2024 10:21:40 +0100	[thread overview]
Message-ID: <87r0hztbvf.fsf@ledu-giraud.fr> (raw)
In-Reply-To: <yqoonklmssnck7q.fsf@dod.no> (Steinar Bang's message of "Tue, 30 Jan 2024 09:13:29 +0100")

Steinar Bang <sb@dod.no> writes:

>>>>>> Manuel Giraud via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>:
>
>> I have this in my init file:
>
>> (setq backup-enable-predicate
>>       (lambda (name)
>> 	(and (normal-backup-enable-predicate name)
>> 	     (not (file-remote-p name)))))
>
> Thanks! This looked good and from the variable and function
> documentation it really looked like it should work.
>
> Unfortunately it didn't... emacs still autosaves for me a file loaded
> with tramp over a plink (putty SSH) connection.

Hi,

It is expected.  Autosaves and backups are two differents things (I
thought you were talking about backups).  Backups is about keeping a
copy(ies) of previous version of your file *at saving time* and
autosaves is about keeping the modifications you've made *until you
save* them.  You could read for more details in the info Emacs manual.

> Some versions:
>  GNU Emacs 29.1 (build 2, x86_64-w64-mingw32) of 2023-07-31 (windows 11 enterprise)
>  tramp version 2.6.0.29.1
>
> Are there good ways to debug this in an "offending" buffer (ie. a buffer
> holding a modified remote file)?
>
> I.e. how to I check what the predicate returns in this buffer?
>
> How do I check what (normal-backup-enable-predicate name) returns in
> this buffer?
>
> How do I check what (file-remote-p name) returns in this buffer?

You could do:
    M-: (normal-backup-enable-predicate (buffer-file-name))
and
    M-: (file-remote-p (buffer-file-name))

But it won't help you for autosaves ;-).  You should read the
corresponding section in the Emacs manual.

Best regards,
-- 
Manuel Giraud



  reply	other threads:[~2024-01-30  9:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-29 11:13 How to switch off autobackup for files loaded from tramp? Steinar Bang
2024-01-29 18:52 ` Manuel Giraud via Users list for the GNU Emacs text editor
2024-01-30  8:13   ` Steinar Bang
2024-01-30  9:21     ` Manuel Giraud via Users list for the GNU Emacs text editor [this message]
2024-01-30  9:48       ` Steinar Bang
2024-01-30 10:16         ` Manuel Giraud via Users list for the GNU Emacs text editor
2024-01-30 11:40           ` Steinar Bang
2024-01-30 11:53             ` Steinar Bang
2024-01-30 12:13               ` Steinar Bang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r0hztbvf.fsf@ledu-giraud.fr \
    --to=help-gnu-emacs@gnu.org \
    --cc=manuel@ledu-giraud.fr \
    --cc=sb@dod.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).