From 5dca7759a78e8b2a50308a9d5f276799ec46c975 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Mon, 3 Feb 2014 00:28:57 +0000 Subject: [PATCH] Fix `electric-pair-backward-delete-char' error at bob * lisp/elec-pair.el (electric-pair-backward-delete-char): Don't error when at beginning of (possibly narrowed) buffer. --- lisp/ChangeLog | 5 +++++ lisp/elec-pair.el | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9b692283d96..542e686dfe2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-02-03 João Távora + + * elec-pair.el (electric-pair-backward-delete-char): Don't error + when at beginning of (possibly narrowed) buffer. + 2014-02-02 Daniel Colascione * help-at-pt.el (help-at-pt-string,help-at-pt-maybe-display): Also diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el index a2d637e2aea..bf02e5fa273 100644 --- a/lisp/elec-pair.el +++ b/lisp/elec-pair.el @@ -174,13 +174,14 @@ non-nil, `backward-delete-char-untabify'." (interactive "*p\nP") (let* ((prev (char-before)) (next (char-after)) - (syntax-info (electric-pair-syntax-info prev)) + (syntax-info (and prev + (electric-pair-syntax-info prev))) (syntax (car syntax-info)) (pair (cadr syntax-info))) - (when (and (if (functionp electric-pair-delete-adjacent-pairs) + (when (and next pair + (if (functionp electric-pair-delete-adjacent-pairs) (funcall electric-pair-delete-adjacent-pairs) electric-pair-delete-adjacent-pairs) - next (memq syntax '(?\( ?\" ?\$)) (eq pair next)) (delete-char 1 killflag)) -- 2.39.2