diff --git a/configuration.org b/configuration.org index 68b232a..4c937a4 100644 --- a/configuration.org +++ b/configuration.org @@ -830,16 +830,10 @@ Suppress =Save auth info to file ~/.authinfo? [y/n/N/e/?]=. See [[info:tramp#Pa #+end_src ** Find the current buffer as root via TRAMP #+BEGIN_SRC emacs-lisp - (defun winny/find-current-buffer-as-root () - "Find the current buffer as root using TRAMP sudo." - (interactive) - (when (file-remote-p default-directory) - (error "Already a TRAMP buffer. Giving up")) - (let ((path (expand-file-name - (if (eq major-mode 'dired-mode) - default-directory ; Dired does not use buffer-file-name to represent a path - buffer-file-name)))) - (find-alternate-file (concat "/sudo:root@localhost:" path)))) + (use-package sudo-edit + :ensure t + :init + (defalias 'winny/find-current-buffer-as-root #'sudo-edit)) #+END_SRC * Hex editing