Function: smie-config-show-indent

smie-config-show-indent is an interactive and byte-compiled function defined in smie.el.gz.

Signature

(smie-config-show-indent &optional ARG)

Documentation

Display the SMIE rules that are used to indent the current line.

If prefix ARG is given, then move briefly point to the buffer position corresponding to each rule.

View in manual

Probably introduced at or before Emacs version 24.4.

Key Bindings

Aliases

sh-show-indent (obsolete since 28.1)

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/smie.el.gz
(defun smie-config-show-indent (&optional arg)
  "Display the SMIE rules that are used to indent the current line.
If prefix ARG is given, then move briefly point to the buffer
position corresponding to each rule."
  (interactive "P")
  (let ((trace (cdr (smie-config--get-trace))))
    (cond
     ((null trace) (message "No SMIE rules involved"))
     ((not arg)
      (message "Rules used: %s"
               (mapconcat (lambda (elem)
                            (pcase-let ((`(,_pos ,kind ,token ,res ,rewrite)
                                         elem))
                              (format "%S %S -> %S%s" kind token res
                                      (if (null rewrite) ""
                                        (format "(via %S)" (nth 3 rewrite))))))
                          trace
                          ", ")))
     (t
      (save-excursion
        (pcase-dolist (`(,pos ,kind ,token ,res ,rewrite) trace)
          (message "%S %S -> %S%s" kind token res
                   (if (null rewrite) ""
                     (format "(via %S)" (nth 3 rewrite))))
          (goto-char pos)
          (sit-for blink-matching-delay)))))))