# HG changeset patch # User Oleksandr Gavenko # Date 1472146231 -10800 # Node ID 6f00eaa73a10bb3fb2871bab00665cf7a8338a91 # Parent 26553c2093b15aeb5faaf961f3a4ff978cc3a879 Functions to re-evaluate buffer/library with re-assigning `defvar` values. diff -r 26553c2093b1 -r 6f00eaa73a10 .emacs-my --- a/.emacs-my Sat Aug 13 18:35:26 2016 +0300 +++ b/.emacs-my Thu Aug 25 20:30:31 2016 +0300 @@ -81,6 +81,28 @@ (setq debug-on-event lvl2) (setq debug-on-signal lvl2))) +(defun my/eval-buffer () + "Evaluate entire buffer with re-assigning values to `defvar' / `defcustom'. +Useful during package development." + (interactive) + (save-excursion + (beginning-of-buffer) + (while (not (eobp)) + (eval-defun nil) + (end-of-defun)))) + +(defun my/load-library (library) + "Evaluate entire library with re-assigning values to `defvar' / `defcustom'. +Useful during package development." + (interactive + (list (completing-read "Load library: " + (apply-partially 'locate-file-completion-table + load-path + '("" ".el"))))) + (with-temp-buffer + (insert-file-contents (locate-file library load-path '("" ".el"))) + (my/eval-buffer))) + (my-debug nil) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;