Quantcast
Viewing all articles
Browse latest Browse all 21

How to disable auto-save in emacs only for files opened as root

I want to use emacs auto-save feature with tramp, but only for file that I don't open using sudo. My current configuration, based on the tramp documentation, looks like this:

;;;;;;;; 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"))))))))

It is forbidding creating remote backups of files edited as superuser but auto-saved files are still created on my local machine. Is there any way to disable that without disabling auto-save at all?


Viewing all articles
Browse latest Browse all 21

Trending Articles