From 59c68e516f80770e21ff57f257d4d50ccb3716a0 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Tue, 18 May 2010 09:47:18 -0700 Subject: [PATCH] new function to revert buffer without confirmation if not modified. --- emacs | 24 +++++++++++++++--------- emacs.d/color-theme/color-theme.el | 2 +- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/emacs b/emacs index 76ba3e9..b104575 100644 --- a/emacs +++ b/emacs @@ -314,9 +314,10 @@ (global-set-key "\M-`" 'other-window-in-any-frame) ;; custom key bindings under a common prefix +;; (Suspend is useless. Give me C-z!) (global-unset-key "\C-z") -(global-set-key "\C-z" nil) ; Suspend is useless. Give me C-z! -(global-set-key "\C-zc" 'comment-line) +(global-set-key "\C-z" nil) +(global-set-key "\C-zc" 'compile) (global-set-key "\C-zf" 'find-file-at-point) (global-set-key "\C-zg" 'goto-line) (global-set-key "\C-zj" 'run-js) @@ -324,6 +325,7 @@ (global-set-key "\C-zm" 'minimap-create) (global-set-key "\C-zM" 'minimap-kill) (global-set-key "\C-zr" 'query-replace-regexp) +(global-set-key "\C-zR" 'revert-buffer-without-confirmation) (global-set-key "\C-zs" 'run-scheme) (global-set-key "\C-zt" 'tagify-region-or-insert-tag) (global-set-key "\C-zz" 'shell) ; z for zsh @@ -342,18 +344,22 @@ ;; wrap a region with an HTML/XML tag (global-set-key "<" 'tagify-region-or-insert-self) -(global-set-key [f5] 'compile) - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; utilities & customizations ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(fset 'comment-line - (lambda (&optional arg) - "Comment or uncomment the current line using `comment-dwim'." - (interactive "p") - (kmacro-call-macro (quote ([1 67108896 14 134217787 16] 0 "%d")) arg))) +;; now, how can I call this automatically when a file is changed out +;; from under a buffer? (like textmate) +(defun revert-buffer-without-confirmation (&optional prefix) + "If the current buffer has no unsaved changes, revert it + without confirmation, and ignoring auto-save files. If there + are unsaved changes then revert with confirmation." + (interactive "P") + (let ((no-confirm (or prefix + (not (buffer-modified-p))))) + (revert-buffer t no-confirm) + (when no-confirm (message (concat "Reverted " (buffer-name)))))) (defun duplicate-line (&optional arg) "Duplicate the current line." diff --git a/emacs.d/color-theme/color-theme.el b/emacs.d/color-theme/color-theme.el index 87e8cab..4579606 100644 --- a/emacs.d/color-theme/color-theme.el +++ b/emacs.d/color-theme/color-theme.el @@ -4610,7 +4610,7 @@ Wheat on black. Includes faces for font-lock, gnus, paren." (interactive) (color-theme-install '(color-theme-taylor - ((background-color . "black") + ((background-color . "#111") (background-mode . dark) (border-color . "black") (cursor-color . "red")