Function: smie-config-guess
smie-config-guess is an interactive and byte-compiled function defined
in smie.el.gz.
Signature
(smie-config-guess)
Documentation
Try and figure out this buffer's indentation settings.
To save the result for future sessions, use smie-config-save.
Probably introduced at or before Emacs version 24.4.
Key Bindings
Aliases
sh-learn-buffer-indent (obsolete since 28.1)
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/smie.el.gz
(defun smie-config-guess ()
"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"))
((null smie-config--buffer-local)
(smie-config-local config)
(message "Local rules set"))
((y-or-n-p "Replace existing local config? ")
(message "Local rules replaced")
(smie-config-local config))
((y-or-n-p "Merge with existing local config? ")
(message "Local rules adjusted")
(smie-config-local (append config smie-config--buffer-local)))
(t
(message "Rules guessed: %S" config)))))