Permalink
Browse files

Fixed C-g issue when setting keybindings.

Made keybindings only message out when set interactively. Otherwise, initial setup is very slow.
Made keybindings only save to customize when set interactively.
Added advise for custom-set-variables so that setup only gets run after customize values have been set.
This allows for the user's .emacs to only have to load-file on emacs-setup.el.
  • Loading branch information...
1 parent fc7880c commit da61645d3d23b1bf6f23927b2c88a578f762b6df Brian Zwahr committed Jul 26, 2012
Showing with 26 additions and 16 deletions.
  1. +16 −10 emacs-setup-keys.el
  2. +2 −3 emacs-setup-util.el
  3. +8 −3 emacs-setup.el
View
@@ -6,6 +6,8 @@
;;; Code:
+(require 'cl)
+
;;; **************
;;; CUSTOMIZATIONS
;;; **************
@@ -40,23 +42,27 @@ The binding is saved in `emacs-setup-keybindings'."
(equal function "keyboard-escape-quit"))
(keyboard-quit))
(while (and (not allow-override-p) (key-binding binding))
+ (when (or (equal binding "")
+ (equal function "keyboard-escape-quit"))
+ (keyboard-quit))
(setq binding (read-key-sequence (concat
(key-description binding)
" is already bound to "
(symbol-name (key-binding binding))
". Choose another key binding: "))))
(when (fboundp function)
- (set-variable
- 'emacs-setup-keybindings
- (remove (rassoc (key-description binding) emacs-setup-keybindings)
- emacs-setup-keybindings))
- (emacs-setup-custom-save
- 'emacs-setup-keybindings
- (add-to-list 'emacs-setup-keybindings
- (cons (symbol-name function) (key-description binding))
- t))
(global-set-key binding function)
- (message "%s bound to %s" function (key-description binding))))
+ (when (called-interactively-p 'interactive)
+ (set-variable
+ 'emacs-setup-keybindings
+ (remove (rassoc (key-description binding) emacs-setup-keybindings)
+ emacs-setup-keybindings))
+ (emacs-setup-custom-save
+ 'emacs-setup-keybindings
+ (add-to-list 'emacs-setup-keybindings
+ (cons (symbol-name function) (key-description binding))
+ t))
+ (message "%s bound to %s" function (key-description binding)))))
(defun emacs-setup-unbind-key-by-key ()
"Interactively unbind a key from `emacs-setup-keybindings'."
View
@@ -13,9 +13,8 @@
(defun emacs-setup-custom-save (variable value)
"Saves the VALUE into VARIABLE in customize and sets the value for the current
running emacs."
- (let ((var-symbol (make-symbol variable)))
- (set-variable var-symbol value)
- (customize-save-variable var-symbol variable)))
+ (set-variable variable value)
+ (customize-save-variable variable (eval variable)))
(provide 'emacs-setup-util)
View
@@ -1,7 +1,5 @@
;;; emacs-setup.el --- Package for maintaining your emacs configuration. Clean up your .emacs!
-;; Package-Requires: ((revive "2.19"))
-
;;; Commentary:
;; emacs-setup is an emacs package that is meant to help make maintaining your
@@ -113,7 +111,7 @@
:group 'emacs-setup
:type '(file :must-match t))
-(defcustom emacs-setup-elisp-ignore-dirs (".svn" ".git")
+(defcustom emacs-setup-elisp-ignore-dirs '(".svn" ".git")
"Sub-directories of emacs-setup-base-elisp-dir to ignore when loading
(i.e. .svn, .git, etc.)."
:group 'emacs-setup
@@ -144,6 +142,7 @@ after-make-frame-hook."
(let ((dir (file-name-directory
(find-lisp-object-file-name 'emacs-setup-base 'function))))
(add-to-list 'load-path dir)
+ (message "Path: %s" 'load-path)
(require 'emacs-setup-require)
(require 'emacs-setup-keys))
(when the-custom-file
@@ -175,6 +174,12 @@ after-make-frame-hook."
(message "Setup complete, with errors. Check the *Messages* buffer.")
(message "Setup complete. Emacs is ready to go!"))))
+(defadvice custom-set-variables (after my-advice-custom-setup)
+ (emacs-setup-base)
+ (emacs-setup))
+
+(ad-activate 'custom-set-variables)
+
(provide 'emacs-setup)
;;; emacs-setup.el ends here

0 comments on commit da61645

Please sign in to comment.