From 500dce5f4d2a08570177d9b1019fa922f07e8508 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 19 Jun 2014 21:05:40 -0400 Subject: * lisp/emacs-lisp/smie.el (smie--hanging-eolp-function): New var. (smie-indent--hanging-p): Use it. * lisp/progmodes/sh-script.el (sh-set-shell): Set it. Fixes: debbugs:17621 --- lisp/emacs-lisp/smie.el | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'lisp/emacs-lisp/smie.el') diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el index 3e40d37aacf..1a6011e712a 100644 --- a/lisp/emacs-lisp/smie.el +++ b/lisp/emacs-lisp/smie.el @@ -1155,6 +1155,15 @@ NUMBER offset by NUMBER, relative to a base token The functions whose name starts with \"smie-rule-\" are helper functions designed specifically for use in this function.") +(defvar smie--hanging-eolp-function + ;; FIXME: This is a quick hack for 24.4. Don't document it and replace with + ;; a well-defined function with a cleaner interface instead! + (lambda () + (skip-chars-forward " \t") + (or (eolp) + (and ;; (looking-at comment-start-skip) ;(bug#16041). + (forward-comment (point-max)))))) + (defalias 'smie-rule-hanging-p 'smie-indent--hanging-p) (defun smie-indent--hanging-p () "Return non-nil if the current token is \"hanging\". @@ -1168,10 +1177,7 @@ the beginning of a line." (not (eobp)) ;; Could be an open-paren. (forward-char 1)) - (skip-chars-forward " \t") - (or (eolp) - (and ;; (looking-at comment-start-skip) ;(bug#16041). - (forward-comment (point-max)))) + (funcall smie--hanging-eolp-function) (point)))))) (defalias 'smie-rule-bolp 'smie-indent--bolp) -- cgit v1.2.3 From 55d4eba2d0e650d811250c31f3801f6835bd088a Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 20 Jun 2014 17:10:40 -0400 Subject: * lisp/emacs-lisp/smie.el (smie-config--guess): Fix typo. (smie-config-guess): Use smie-config-local so the rules are obeyed. Fixes: debbugs:17818 --- lisp/ChangeLog | 7 ++++--- lisp/emacs-lisp/smie.el | 11 +++++------ 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'lisp/emacs-lisp/smie.el') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fcbd0c39655..46e3b0f6321 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,9 @@ 2014-06-20 Stefan Monnier + * emacs-lisp/smie.el (smie-config--guess): Fix typo. + (smie-config-guess): Use smie-config-local so the rules are obeyed + (bug#17818). + * mouse.el (mouse-drag-line): Don't re-add to unread-comment-events, since it's already done inside the loop (bug#17819). @@ -11,9 +15,6 @@ 2014-06-20 Stefan Monnier - * mouse.el (mouse-drag-line): Remove left-over code made redundant by - mouse--down-1-maybe-follows-link (bug#17819). - * progmodes/sh-script.el (sh-smie-sh-rules): For { after &&, don't align with the surrounding parent (bug#17721). diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el index 1a6011e712a..1819daa3df0 100644 --- a/lisp/emacs-lisp/smie.el +++ b/lisp/emacs-lisp/smie.el @@ -2138,7 +2138,7 @@ position corresponding to each rule." nil (push (cons (+ offset (nth 2 sig)) sig) rules) ;; Adjust the rest of the data. - (pcase-dolist ((and cotrace `(,count ,toffset ,trace)) + (pcase-dolist ((and cotrace `(,count ,toffset . ,trace)) cotraces) (setf (nth 1 cotrace) (- toffset offset)) (dolist (sig trace) @@ -2167,15 +2167,14 @@ To save the result for future sessions, use `smie-config-save'." (cond ((null config) (message "Nothing to change")) ((null smie-config--buffer-local) - (message "Local rules set") - (setq smie-config--buffer-local config)) + (smie-config-local config) + (message "Local rules set")) ((y-or-n-p "Replace existing local config? ") (message "Local rules replaced") - (setq smie-config--buffer-local config)) + (smie-config-local config)) ((y-or-n-p "Merge with existing local config? ") (message "Local rules adjusted") - (setq smie-config--buffer-local - (append config smie-config--buffer-local))) + (smie-config-local (append config smie-config--buffer-local))) (t (message "Rules guessed: %S" config))))) -- cgit v1.2.3