From ee0761cad38d5b4319806b04a9bcb081d0bdd993 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Thu, 20 Feb 2014 11:33:32 +0100 Subject: [PATCH] lisp/elec-pair.el: Fix bug#16799. (electric-pair-syntax-info): Do not check syntax before the start of buffer/region. --- lisp/ChangeLog | 5 +++++ lisp/elec-pair.el | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9b6b370c452..a3d78dcddad 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-02-20 Juanma Barranquero + + * elec-pair.el (electric-pair-syntax-info): Do not check syntax + before the start of buffer/region (bug#16799). + 2014-02-20 Glenn Morris * isearch.el (search-invisible): Doc fix. diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el index bf02e5fa273..8562801979d 100644 --- a/lisp/elec-pair.el +++ b/lisp/elec-pair.el @@ -215,8 +215,9 @@ COMMAND-EVENT's pair. UNCONDITIONAL indicates the variables `electric-pair-pairs' or `electric-pair-text-pairs' were used to lookup syntax. STRING-OR-COMMENT-START indicates that point is inside a comment of string." - (let* ((pre-string-or-comment (nth 8 (save-excursion - (syntax-ppss (1- (point)))))) + (let* ((pre-string-or-comment (or (bobp) + (nth 8 (save-excursion + (syntax-ppss (1- (point))))))) (post-string-or-comment (nth 8 (syntax-ppss (point)))) (string-or-comment (and post-string-or-comment pre-string-or-comment)) -- 2.39.2