]> code.delx.au - gnu-emacs-elpa/commitdiff
Avoid errors on false positives
authorArtur Malabarba <bruce.connor.am@gmail.com>
Mon, 15 Jun 2015 09:31:40 +0000 (10:31 +0100)
committerArtur Malabarba <bruce.connor.am@gmail.com>
Mon, 15 Jun 2015 09:31:40 +0000 (10:31 +0100)
sotlisp.el

index 37baa4b46bcef15da88001e9d587b8c575bf460c..d9d249228103cfd0985071ec46a5ae5dc3e4ab30 100644 (file)
@@ -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)