branch: master
commit 960ea2ffaf1ac81dc618e7d3463f6385c32e6546
Author: Artur Malabarba <[email protected]>
Commit: Artur Malabarba <[email protected]>
Avoid errors on false positives
---
sotlisp.el | 22 ++++++++++++----------
1 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/sotlisp.el b/sotlisp.el
index 37baa4b..d9d2492 100644
--- a/sotlisp.el
+++ b/sotlisp.el
@@ -172,16 +172,18 @@ See `sotlisp-define-function-abbrev'."
(skip-chars-backward (rx alnum))
(let* ((name (buffer-substring (point) r))
(expansion (gethash name sotlisp--function-table)))
- (delete-region (point) r)
- (if (sotlisp--function-quote-p)
- ;; After #' use the simple expansion.
- (insert (sotlisp--simplify-function-expansion expansion))
- ;; Inside a form, use the full expansion.
- (insert expansion)
- (when (string-match "\\$" expansion)
- (setq sotlisp--needs-moving t))))
- ;; Must be last.
- (sotlisp--post-expansion-cleanup)))
+ (if (not expansion)
+ (progn (goto-char r) nil)
+ (delete-region (point) r)
+ (if (sotlisp--function-quote-p)
+ ;; After #' use the simple expansion.
+ (insert (sotlisp--simplify-function-expansion expansion))
+ ;; Inside a form, use the full expansion.
+ (insert expansion)
+ (when (string-match "\\$" expansion)
+ (setq sotlisp--needs-moving t)))
+ ;; Must be last.
+ (sotlisp--post-expansion-cleanup)))))
(put 'sotlisp--expand-function 'no-self-insert t)