我想使用 emacs 自动保存功能与 tramp,但仅限于我不使用 sudo 打开的文件。我当前的配置基于流浪汉文档,如下所示:
;;;;;;;; BAKUCP ;;;;;;;;
;; Backup remote files locally to stop autosave pain
(setq tramp-backup-directory "~/.emacs-backup")
(unless (file-directory-p tramp-backup-directory)
(make-directory tramp-backup-directory))
(if (file-accessible-directory-p tramp-backup-directory)
(setq tramp-auto-save-directory tramp-backup-directory)
(error "Cannot write to ~/.emacs-backup"))
;; Don't backup su and sudo files
(setq backup-enable-predicate
(lambda (name)
(and (normal-backup-enable-predicate name)
(not
(let ((method (file-remote-p name 'method)))
(when (stringp method)
(member method '("su" "sudo"))))))))
禁止创建以超级用户身份编辑的文件的远程备份,但自动保存的文件仍会在我的本地计算机上创建。有没有办法禁用该功能而不禁用自动保存?