diff options
author | Glenn Morris <rgm@gnu.org> | 2014-06-21 12:45:59 -0700 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2014-06-21 12:45:59 -0700 |
commit | c400516ab1d827d08225ffb3e1bc1969c73cc45e (patch) | |
tree | b16343b9e11c916c96b12ab56b6024cad91d3aff /lisp/emacs-lisp/smie.el | |
parent | 539ad293eb36b4cf458cbdb5a6b37f5cd1bb68a1 (diff) | |
parent | 8047f439ec7d0bbe0085800a13bee8da883ae4dd (diff) | |
download | emacs-c400516ab1d827d08225ffb3e1bc1969c73cc45e.tar.gz emacs-c400516ab1d827d08225ffb3e1bc1969c73cc45e.tar.bz2 emacs-c400516ab1d827d08225ffb3e1bc1969c73cc45e.zip |
Merge from emacs-24; up to 2014-06-06T02:22:40Z!monnier@iro.umontreal.ca
Diffstat (limited to 'lisp/emacs-lisp/smie.el')
-rw-r--r-- | lisp/emacs-lisp/smie.el | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el index 3e40d37aacf..1819daa3df0 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) @@ -2132,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) @@ -2161,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))))) |