From f22e54691dc0c0f43a3720bbcfdc50e40cd08f7b Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Tue, 5 Apr 2022 17:08:44 +0200 Subject: [PATCH] [Emacs] TRAMP optimisation Disable all-the-icons-dired for remote repositories Disable auto-save and backups for files opened with TRAMP --- org/config/emacs.org | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/org/config/emacs.org b/org/config/emacs.org index 9a830ee..c669e0e 100644 --- a/org/config/emacs.org +++ b/org/config/emacs.org @@ -2983,7 +2983,16 @@ And let’s add some fancy icons in dired! :after (all-the-icons) :straight (:build t) :defer t - :hook (dired-mode . all-the-icons-dired-mode)) + :hook (dired-mode . all-the-icons-dired-mode) + :config + (defun my/all-the-icons-dired--refresh (orig-fun &rest args) + (unless (or (not (file-remote-p default-directory)) + (<= (count-lines (point-min) + (point-max)) + 512)) + (apply orig-fun args))) + + (advice-add #'all-the-icons-dired--refresh :around #'my/all-the-icons-dired--refresh)) #+end_src #+begin_src emacs-lisp @@ -3328,7 +3337,9 @@ supported natively. I will describe them here. :init <> :config - (setq tramp-ssh-controlmaster-options "")) + (setq tramp-ssh-controlmaster-options "") + (add-to-list 'backup-directory-alist ; deactivate auto-save with TRAMP + (cons tramp-file-name-regexp nil))) #+end_src **** Yadm