Function: smie-config-save

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

Signature

(smie-config-save)

Documentation

Save local rules for use with this major mode.

One way to generate local rules is the command smie-config-guess.

View in manual

Probably introduced at or before Emacs version 24.4.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/smie.el.gz
(defun smie-config-save ()
  "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)
    (message "No local rules to save"))
   (t
    (let* ((existing (assq major-mode smie-config))
           (config
            (cond ((null existing)
                   (message "Local rules saved in `smie-config'")
                   smie-config--buffer-local)
                  ((y-or-n-p "Replace the existing mode's config? ")
                   (message "Mode rules replaced in `smie-config'")
                   smie-config--buffer-local)
                  ((y-or-n-p "Merge with existing mode's config? ")
                   (message "Mode rules adjusted in `smie-config'")
                   (append smie-config--buffer-local (cdr existing)))
                  (t (error "Abort")))))
      (if existing
          (setcdr existing config)
        (push (cons major-mode config) smie-config))
      (setq smie-config--mode-local config)
      (kill-local-variable 'smie-config--buffer-local)
      (customize-mark-as-set 'smie-config)))))