Emacs: Fix spurious sudo prompts
Alan Pearce alan.pearce@spotcap.com
Tue, 24 Nov 2015 17:25:28 +0100
1 files changed, 3 insertions(+), 2 deletions(-)
jump to
M tag-emacs/emacs.d/init.org → tag-emacs/emacs.d/init.org
@@ -1226,8 +1226,9 @@ ("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)) + (when (and buffer-file-name + (not (file-writable-p buffer-file-name))) + (message "File not writable %s" buffer-file-name) (find-alternate-file (concat "/sudo::" buffer-file-name)))) (defun counsel-switch-to-projectile-buffer (arg) "Forward to `projectile-switch-to-buffer'."