summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2021-10-07 16:01:38 -0500
committerCase Duckworth2021-10-07 16:01:38 -0500
commit237cdfa27c344cdaaf59cd9cc3174f187f8d38dc (patch)
tree588e0020d6f21228c49145faf0b2acd55f9ce3d7
parentDisable nyan mode sometimes (diff)
downloademacs-237cdfa27c344cdaaf59cd9cc3174f187f8d38dc.tar.gz
emacs-237cdfa27c344cdaaf59cd9cc3174f187f8d38dc.zip
Fix crux-open-file-as-root
-rw-r--r--init.el17
1 files changed, 17 insertions, 0 deletions
diff --git a/init.el b/init.el index a633387..7fee7a3 100644 --- a/init.el +++ b/init.el
@@ -1253,6 +1253,23 @@ specific to most general, they are these:
1253 "C-M-\\" #'crux-cleanup-buffer-or-region 1253 "C-M-\\" #'crux-cleanup-buffer-or-region
1254 "C-x 4 t" #'crux-transpose-windows) 1254 "C-x 4 t" #'crux-transpose-windows)
1255 1255
1256 (el-patch-feature crux)
1257 (with-eval-after-load 'crux
1258 (el-patch-defun crux-reopen-as-root ()
1259 "Find file as root if necessary.
1260
1261Meant to be used as `find-file-hook'.
1262See also `crux-reopen-as-root-mode'."
1263 (unless (or
1264 ;; This helps fix for `nov-mode', and possibly others.
1265 (el-patch-add (null buffer-file-name))
1266 (tramp-tramp-file-p buffer-file-name)
1267 (equal major-mode 'dired-mode)
1268 (not (file-exists-p (file-name-directory buffer-file-name)))
1269 (file-writable-p buffer-file-name)
1270 (crux-file-owned-by-user-p buffer-file-name))
1271 (crux-find-alternate-file-as-root buffer-file-name))))
1272
1256 (crux-reopen-as-root-mode +1)) 1273 (crux-reopen-as-root-mode +1))
1257 1274
1258;; (setup (:straight-when 1275;; (setup (:straight-when