emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master f7b4937 04/13: Refactor whitespace detection


From: Artur Malabarba
Subject: [elpa] master f7b4937 04/13: Refactor whitespace detection
Date: Wed, 05 Aug 2015 21:54:09 +0000

branch: master
commit f7b49370dc7edf3759fc9e513eb36c4524d604a4
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>

    Refactor whitespace detection
---
 sotlisp.el |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/sotlisp.el b/sotlisp.el
index d1a34b9..dbdd03b 100644
--- a/sotlisp.el
+++ b/sotlisp.el
@@ -122,8 +122,13 @@ non-nil."
 
 (defun sotlisp--whitespace-p ()
   "Non-nil if current `self-insert'ed char is whitespace."
+  (sotlisp--whitespace-char-p last-command-event))
+(make-obsolete 'sotlisp--whitespace-p 'sotlisp--whitespace-char-p "1.2")
+
+(defun sotlisp--whitespace-char-p (char)
+  "Non-nil if CHAR is has whitespace syntax."
   (ignore-errors
-    (string-match (rx space) (string last-command-event))))
+    (string-match (rx space) (string char))))
 
 
 ;;; Expansion logic
@@ -159,14 +164,14 @@ If it ended in a space and there's a space ahead, delete 
the
 space ahead."
   ;; Inform `expand-abbrev' that `self-insert-command' should not
   ;; trigger, by returning non-nil on SPC.
-  (when (sotlisp--whitespace-p)
+  (when (sotlisp--whitespace-char-p last-command-event)
     ;; And maybe move out of closing paren if expansion ends with $.
     (if (eq (char-before) ?$)
         (progn (delete-char -1)
                (setq sotlisp--needs-moving nil)
                (sotlisp--maybe-skip-closing-paren))
-      (when (and (string-match (rx space) (string (char-after)))
-                 (string-match (rx space) (string (char-before))))
+      (when (and (sotlisp--whitespace-char-p (char-after))
+                 (sotlisp--whitespace-char-p (char-before)))
         (delete-char 1)))
     t))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]