From bdda4c66ac1318148de69040d3b4c6f9b6037794 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 23 May 2013 13:44:38 -0400 Subject: [PATCH] * lisp/emacs-lisp/smie.el (smie-indent-forward-token) (smie-indent-backward-token): Handle string tokens. Fixes: debbugs:14381 --- lisp/ChangeLog | 5 +++++ lisp/emacs-lisp/smie.el | 14 ++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e9484600cde..d4f2a185cf6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2013-05-23 Stefan Monnier + + * emacs-lisp/smie.el (smie-indent-forward-token) + (smie-indent-backward-token): Handle string tokens (bug#14381). + 2013-05-23 Rüdiger Sonderfeld * ielm.el (ielm-menu): New menu. diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el index b0883995532..cb93cdf8dc6 100644 --- a/lisp/emacs-lisp/smie.el +++ b/lisp/emacs-lisp/smie.el @@ -1363,7 +1363,12 @@ BASE-POS is the position relative to which offsets should be applied." ((looking-at "\\s(\\|\\s)\\(\\)") (forward-char 1) (cons (buffer-substring (1- (point)) (point)) - (if (match-end 1) '(0 nil) '(nil 0))))))) + (if (match-end 1) '(0 nil) '(nil 0)))) + ((looking-at "\\s\"") + (forward-sexp 1) + nil) + ((eobp) nil) + (t (error "Bumped into unknown token"))))) (defun smie-indent-backward-token () "Skip token backward and return it, along with its levels." @@ -1375,7 +1380,12 @@ BASE-POS is the position relative to which offsets should be applied." ((memq (setq class (syntax-class (syntax-after (1- (point))))) '(4 5)) (forward-char -1) (cons (buffer-substring (point) (1+ (point))) - (if (eq class 4) '(nil 0) '(0 nil))))))) + (if (eq class 4) '(nil 0) '(0 nil)))) + ((eq class 7) + (backward-sexp 1) + nil) + ((bobp) nil) + (t (error "Bumped into unknown token"))))) (defun smie-indent-virtual () ;; We used to take an optional arg (with value :not-hanging) to specify that -- 2.39.2