summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2014-03-04 00:35:11 -0800
committerGlenn Morris <rgm@gnu.org>2014-03-04 00:35:11 -0800
commitd82e752c0554881369ddcdeb07bcdde3a038b3e4 (patch)
tree686d7bfa22689851c6d9687102b428a61456f63c
parent8d4901dc71b59fce4fd2d1591da120270a6bbabb (diff)
downloademacs-d82e752c0554881369ddcdeb07bcdde3a038b3e4.tar.gz
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.
---
*** `sh-mode' now has its own setting for `add-log-current-defun-function'.
-** SMIE indentation can be customized via `smie-config'.
-Emacs can learn the appropriate indentation settings if you provide it
-with an indented sample file.
+** SMIE
+
+*** You can customize the indentation of modes that use SMIE via `smie-config'.
+The command `smie-config-guess' can help you derive the appropriate
+indentation settings, if you provide it with an indented sample file.
+Use `smie-config-save' to save the result.
+
+*** New commands `smie-config-show-indent' and `smie-config-set-indent'.
---
** SQL mode
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e75f2cc3190..a576c69fc07 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2014-03-04 Glenn Morris <rgm@gnu.org>
+
+ * emacs-lisp/smie.el (smie-config-guess): Doc fix.
+ Explicit error if no grammar.
+ (smie-config-save): Doc fix. Fix quote typo.
+
2014-03-04 Stefan Monnier <monnier@iro.umontreal.ca>
* 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."
rules))))
(defun smie-config-guess ()
- "Try and figure out this buffer's indentation settings."
+ "Try and figure out this buffer's indentation settings.
+To save the result for future sessions, use `smie-config-save'."
(interactive)
+ (if (eq smie-grammar 'unset)
+ (user-error "This buffer does not seem to be using SMIE"))
(let ((config (smie-config--guess (point-min) (point-max))))
(cond
((null config) (message "Nothing to change"))
@@ -2168,7 +2171,8 @@ position corresponding to each rule."
(message "Rules guessed: %S" config)))))
(defun smie-config-save ()
- "Save local rules for use with this major mode."
+ "Save local rules for use with this major mode.
+One way to generate local rules is the command `smie-config-guess'."
(interactive)
(cond
((null smie-config--buffer-local)
@@ -2190,7 +2194,7 @@ position corresponding to each rule."
(setcdr existing config)
(push (cons major-mode config) smie-config))
(setq smie-config--mode-local config)
- (kill-local-variable smie-config--buffer-local)
+ (kill-local-variable 'smie-config--buffer-local)
(customize-mark-as-set 'smie-config)))))
(provide 'smie)