aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2014-03-04 00:35:11 -0800
committerGlenn Morris2014-03-04 00:35:11 -0800
commitd82e752c0554881369ddcdeb07bcdde3a038b3e4 (patch)
tree686d7bfa22689851c6d9687102b428a61456f63c
parent8d4901dc71b59fce4fd2d1591da120270a6bbabb (diff)
downloademacs-d82e752c0554881369ddcdeb07bcdde3a038b3e4.tar.gz
emacs-d82e752c0554881369ddcdeb07bcdde3a038b3e4.zip
Small smie.el doc and fix
* lisp/emacs-lisp/smie.el (smie-config-guess): Doc fix. Explicit error if no grammar. (smie-config-save): Doc fix. Fix quote typo. * etc/NEWS: Related edit.
-rw-r--r--etc/NEWS11
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/emacs-lisp/smie.el10
3 files changed, 21 insertions, 6 deletions
diff --git a/etc/NEWS b/etc/NEWS
index d27f5655eb5..c1342ebfea1 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -896,9 +896,14 @@ All non-ancient Bash versions support this option.
896--- 896---
897*** `sh-mode' now has its own setting for `add-log-current-defun-function'. 897*** `sh-mode' now has its own setting for `add-log-current-defun-function'.
898 898
899** SMIE indentation can be customized via `smie-config'. 899** SMIE
900Emacs can learn the appropriate indentation settings if you provide it 900
901with an indented sample file. 901*** You can customize the indentation of modes that use SMIE via `smie-config'.
902The command `smie-config-guess' can help you derive the appropriate
903indentation settings, if you provide it with an indented sample file.
904Use `smie-config-save' to save the result.
905
906*** New commands `smie-config-show-indent' and `smie-config-set-indent'.
902 907
903--- 908---
904** SQL mode 909** SQL mode
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e75f2cc3190..a576c69fc07 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12014-03-04 Glenn Morris <rgm@gnu.org>
2
3 * emacs-lisp/smie.el (smie-config-guess): Doc fix.
4 Explicit error if no grammar.
5 (smie-config-save): Doc fix. Fix quote typo.
6
12014-03-04 Stefan Monnier <monnier@iro.umontreal.ca> 72014-03-04 Stefan Monnier <monnier@iro.umontreal.ca>
2 8
3 * progmodes/cc-mode.el (c-initialize-cc-mode): Only hook into 9 * progmodes/cc-mode.el (c-initialize-cc-mode): Only hook into
diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el
index 02a41cddfab..e65f873b874 100644
--- a/lisp/emacs-lisp/smie.el
+++ b/lisp/emacs-lisp/smie.el
@@ -2149,8 +2149,11 @@ position corresponding to each rule."
2149 rules)))) 2149 rules))))
2150 2150
2151(defun smie-config-guess () 2151(defun smie-config-guess ()
2152 "Try and figure out this buffer's indentation settings." 2152 "Try and figure out this buffer's indentation settings.
2153To save the result for future sessions, use `smie-config-save'."
2153 (interactive) 2154 (interactive)
2155 (if (eq smie-grammar 'unset)
2156 (user-error "This buffer does not seem to be using SMIE"))
2154 (let ((config (smie-config--guess (point-min) (point-max)))) 2157 (let ((config (smie-config--guess (point-min) (point-max))))
2155 (cond 2158 (cond
2156 ((null config) (message "Nothing to change")) 2159 ((null config) (message "Nothing to change"))
@@ -2168,7 +2171,8 @@ position corresponding to each rule."
2168 (message "Rules guessed: %S" config))))) 2171 (message "Rules guessed: %S" config)))))
2169 2172
2170(defun smie-config-save () 2173(defun smie-config-save ()
2171 "Save local rules for use with this major mode." 2174 "Save local rules for use with this major mode.
2175One way to generate local rules is the command `smie-config-guess'."
2172 (interactive) 2176 (interactive)
2173 (cond 2177 (cond
2174 ((null smie-config--buffer-local) 2178 ((null smie-config--buffer-local)
@@ -2190,7 +2194,7 @@ position corresponding to each rule."
2190 (setcdr existing config) 2194 (setcdr existing config)
2191 (push (cons major-mode config) smie-config)) 2195 (push (cons major-mode config) smie-config))
2192 (setq smie-config--mode-local config) 2196 (setq smie-config--mode-local config)
2193 (kill-local-variable smie-config--buffer-local) 2197 (kill-local-variable 'smie-config--buffer-local)
2194 (customize-mark-as-set 'smie-config))))) 2198 (customize-mark-as-set 'smie-config)))))
2195 2199
2196(provide 'smie) 2200(provide 'smie)