From 8a96983b3f9ac007ead3a8861543d7ee4f26fab2 Mon Sep 17 00:00:00 2001 From: Drew Short Date: Tue, 26 Jul 2016 19:43:33 -0500 Subject: [PATCH] Updated emacs config to alow editing of root files with password. Added ec alias to emacsclient --- home/.emacs.d/init.el | 11 +++++++++-- home/.zshrc | 3 +++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/home/.emacs.d/init.el b/home/.emacs.d/init.el index 2d98a0c..5624d67 100644 --- a/home/.emacs.d/init.el +++ b/home/.emacs.d/init.el @@ -43,7 +43,7 @@ "Org Mode Packages") ;; Combine the package lists -(defvar sothr/packages (append sothr/tools sothr/modes sothr/org) "Default Packages") +(defvar sothr/packages (append sothr/themes sothr/tools sothr/modes sothr/org) "Default Packages") ;; Repositories (add-to-list 'package-archives @@ -163,7 +163,14 @@ ;; Windows specific configurations ;(cond ;((string-equal system-type "windows-nt") ; MS Windows System - ;(windows-config))) + ;(windows-config))) + +;; Advice for open files as root if we don't have enough permissions +(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)) + (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name)))) (custom-set-variables ;; custom-set-variables was added by Custom. diff --git a/home/.zshrc b/home/.zshrc index f98e673..16cc941 100644 --- a/home/.zshrc +++ b/home/.zshrc @@ -36,6 +36,9 @@ function append_if_exists() { echo $result } +# Alias to emacsclient +alias ec="emacsclient" + # Don't use the embedded shell time. Use GNU time. alias time="/usr/bin/time" # Alias for GNU Time with pretty output.