diff options
author | Alan Pearce | 2015-10-16 11:25:11 +0200 |
---|---|---|
committer | Alan Pearce | 2015-10-16 11:25:11 +0200 |
commit | 4eb68236f9bd69752e609789bd22564a573683b3 (patch) | |
tree | 7e090a4037958a09170679b64fb895e407ba3296 /tag-emacs | |
parent | 88b381faace9ac226e340cc4db8fba6dd329b9a7 (diff) | |
download | dotfiles-4eb68236f9bd69752e609789bd22564a573683b3.tar.lz dotfiles-4eb68236f9bd69752e609789bd22564a573683b3.tar.zst dotfiles-4eb68236f9bd69752e609789bd22564a573683b3.zip |
Emacs: Re-add find-file-as-root advice for counsel
Diffstat (limited to 'tag-emacs')
-rw-r--r-- | tag-emacs/emacs.d/init.org | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 008b5b1..dd19554 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1246,6 +1246,11 @@ replace helm and ido. ("C-x C-f" . counsel-find-file) ("C-x b" . counsel-switch-to-projectile-buffer)) :config (progn + (defadvice counsel-find-file (after find-file-sudo activate) + "Find file as root if necessary." + (unless (and buffer-file-name + (file-writable-p buffer-file-name)) + (find-alternate-file (concat "/sudo::" buffer-file-name)))) (defun counsel-switch-to-projectile-buffer (arg) "Forward to `projectile-switch-to-buffer'." (interactive "P") |