diff options
author | Case Duckworth | 2021-10-07 16:01:38 -0500 |
---|---|---|
committer | Case Duckworth | 2021-10-07 16:01:38 -0500 |
commit | 237cdfa27c344cdaaf59cd9cc3174f187f8d38dc (patch) | |
tree | 588e0020d6f21228c49145faf0b2acd55f9ce3d7 | |
parent | Disable nyan mode sometimes (diff) | |
download | emacs-237cdfa27c344cdaaf59cd9cc3174f187f8d38dc.tar.gz emacs-237cdfa27c344cdaaf59cd9cc3174f187f8d38dc.zip |
Fix crux-open-file-as-root
-rw-r--r-- | init.el | 17 |
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 | |||
1261 | Meant to be used as `find-file-hook'. | ||
1262 | See 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 |