Fix wrong-type-argument errors on backspace

Caused when pressed at the beginning or end of a buffer.
This commit is contained in:
Henrik Lissner 2018-06-16 11:50:55 +02:00
parent 74d364776e
commit 3f2318bc69
No known key found for this signature in database
GPG Key ID: 5F6C0EA160557395

View File

@ -127,10 +127,11 @@ possible, or just one char if that's not possible."
open-len close-len)
(cond ;; When in strings (sp acts weird with quotes; this is the fix)
;; Also, skip closing delimiters
((and (string= op cl)
(and (string= (char-to-string (char-before)) op)
((and op cl
(string= op cl)
(and (string= (char-to-string (or (char-before) 0)) op)
(setq open-len (length op)))
(and (string= (char-to-string (char-after)) cl)
(and (string= (char-to-string (or (char-after) 0)) cl)
(setq close-len (length cl))))
(delete-char (- open-len))
(delete-char close-len))