From f8de1b7060213176b0d7447fd283c8a7bc617e86 Mon Sep 17 00:00:00 2001 From: Luke Randall Date: Sun, 28 Apr 2013 21:18:38 +0200 Subject: [PATCH 1/2] Don't try edit dired buffer as root --- core/prelude-core.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/prelude-core.el b/core/prelude-core.el index e3e0748..49045b8 100644 --- a/core/prelude-core.el +++ b/core/prelude-core.el @@ -264,8 +264,9 @@ buffer is not visiting a file." (defadvice ido-find-file (after find-file-sudo activate) "Find file as root if necessary." - (unless (and buffer-file-name - (file-writable-p buffer-file-name)) + (unless (or (equal major-mode 'dired-mode) + (and (buffer-file-name) + (file-writable-p buffer-file-name))) (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name)))) (defun prelude-switch-or-start (function buffer) From f69c6d5713f19d64b5766e50a7bac6eb5d86d02f Mon Sep 17 00:00:00 2001 From: Luke Randall Date: Sun, 28 Apr 2013 21:49:01 +0200 Subject: [PATCH 2/2] Fix indentation --- core/prelude-core.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/prelude-core.el b/core/prelude-core.el index 49045b8..ee0f9bd 100644 --- a/core/prelude-core.el +++ b/core/prelude-core.el @@ -265,8 +265,8 @@ buffer is not visiting a file." (defadvice ido-find-file (after find-file-sudo activate) "Find file as root if necessary." (unless (or (equal major-mode 'dired-mode) - (and (buffer-file-name) - (file-writable-p buffer-file-name))) + (and (buffer-file-name) + (file-writable-p buffer-file-name))) (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name)))) (defun prelude-switch-or-start (function buffer)