branch: elpa/macrostep
commit 8b89694ec40f7eda984cbc4a05b841fb1feebd4b
Author: joddie <[email protected]>
Commit: joddie <[email protected]>
Only enter macrostep-mode after successful macro expansion
This prevents a confusing situation where an error occurs in macro
expansion, leaving the buffer read-only and in macrostep-mode.
Also use `inhibit-read-only' instead of let-binding
`buffer-read-only'.
---
README.org | 2 ++
macrostep.el | 9 ++++++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/README.org b/README.org
index 17416ea..ce34396 100644
--- a/README.org
+++ b/README.org
@@ -127,6 +127,8 @@
under Emacs 24.
** Changelog
+ - v0.4, 2013-04-07: only enter macrostep-mode on successful
+ macro-expansion
- v0.3, 2012-10-30: print dotted lists correctly. autoload
definitions.
diff --git a/macrostep.el b/macrostep.el
index 7aa2c5c..0bb4d1d 100644
--- a/macrostep.el
+++ b/macrostep.el
@@ -163,6 +163,8 @@
;;
;; 1.6 Changelog
;; ==============
+;; - v0.4, 2013-04-07: only enter macrostep-mode on successful
+;; macro-expansion
;; - v0.3, 2012-10-30: print dotted lists correctly. autoload
;; definitions.
;;
@@ -192,7 +194,7 @@
;;; Faces
(defgroup macrostep nil
"Interactive macro stepper for Emacs Lisp."
- :version 0.1
+ :version 0.4
:group 'lisp
:link '(emacs-commentary-link :tag "commentary" "macrostep.el")
:link '(emacs-library-link :tag "lisp file" "macrostep.el")
@@ -316,13 +318,14 @@ buffer and expand the next macro form found, if any."
(if (consp sexp)
(error "(%s ...) is not a macro form" (car sexp))
(error "Text at point is not a macro form.")))))
- (unless macrostep-mode (macrostep-mode t))
- (let* ((buffer-read-only nil)
+
+ (let* ((inhibit-read-only t)
(expansion (macrostep-expand-1 sexp))
(existing-ol (macrostep-overlay-at-point))
(macrostep-gensym-depth macrostep-gensym-depth)
(macrostep-gensyms-this-level nil)
text priority)
+ (unless macrostep-mode (macrostep-mode t))
(if existing-ol ; expanding an expansion
(setq text sexp
priority (1+ (overlay-get existing-ol 'priority))