branch: master commit c1deb0528e11e93e982b9b7e445c3fef7fad2911 Author: Artur Malabarba <bruce.connor...@gmail.com> Commit: Artur Malabarba <bruce.connor...@gmail.com>
Don't use looking-back --- sotlisp.el | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sotlisp.el b/sotlisp.el index d9d2492..d1a34b9 100644 --- a/sotlisp.el +++ b/sotlisp.el @@ -90,16 +90,24 @@ (bound-and-true-p paredit-mode) (bound-and-true-p smartparens-mode))) +(defun sotlisp--looking-back (regexp) + (string-match + (concat regexp "\\'") + (buffer-substring (line-beginning-position) (point)))) + (defun sotlisp--function-form-p () "Non-nil if point is at the start of a sexp. Specially, avoids matching inside argument lists." (and (eq (char-before) ?\() - (not (looking-back "(\\(defun\\s-+.*\\|lambda\\s-+\\)(")) + (not (sotlisp--looking-back "(\\(defun\\s-+.*\\|lambda\\s-+\\)(")) (not (string-match (rx (syntax symbol)) (string last-command-event))))) (defun sotlisp--function-quote-p () "Non-nil if point is at a sharp-quote." - (looking-back "#'")) + (ignore-errors + (save-excursion + (forward-char -2) + (looking-at-p "#'")))) (defun sotlisp--function-p () "Non-nil if point is at reasonable place for a function name.