Fix loading of smie-config rules (Bug#24848)
* lisp/emacs-lisp/smie.el (smie-config--setter): Use `set-default' instead of `setq-default'. (smie-config): Use `custom-initialize-set' instead of `custom-initialize-default' as the :initialize argument. * lisp/progmodes/sh-script.el (sh-learn-buffer-indent): Mention that we call `smie-config-guess' so that the user will have a chance to find the correct docstring to consult. Remove hedging comments regarding use of abnormal hooks.
This commit is contained in:
parent
3a68dec327
commit
a58d0c590a
2 changed files with 7 additions and 5 deletions
|
@ -1956,7 +1956,7 @@ E.g. provided via a file-local call to `smie-config-local'.")
|
||||||
(defvar smie-config--modefuns nil)
|
(defvar smie-config--modefuns nil)
|
||||||
|
|
||||||
(defun smie-config--setter (var value)
|
(defun smie-config--setter (var value)
|
||||||
(setq-default var value)
|
(set-default var value)
|
||||||
(let ((old-modefuns smie-config--modefuns))
|
(let ((old-modefuns smie-config--modefuns))
|
||||||
(setq smie-config--modefuns nil)
|
(setq smie-config--modefuns nil)
|
||||||
(pcase-dolist (`(,mode . ,rules) value)
|
(pcase-dolist (`(,mode . ,rules) value)
|
||||||
|
@ -1982,7 +1982,7 @@ value with which to replace it."
|
||||||
;; FIXME improve value-type.
|
;; FIXME improve value-type.
|
||||||
:type '(choice (const nil)
|
:type '(choice (const nil)
|
||||||
(alist :key-type symbol))
|
(alist :key-type symbol))
|
||||||
:initialize 'custom-initialize-default
|
:initialize 'custom-initialize-set
|
||||||
:set #'smie-config--setter)
|
:set #'smie-config--setter)
|
||||||
|
|
||||||
(defun smie-config-local (rules)
|
(defun smie-config-local (rules)
|
||||||
|
|
|
@ -3594,6 +3594,10 @@ so that `occur-next' and `occur-prev' will work."
|
||||||
(defun sh-learn-buffer-indent (&optional arg)
|
(defun sh-learn-buffer-indent (&optional arg)
|
||||||
"Learn how to indent the buffer the way it currently is.
|
"Learn how to indent the buffer the way it currently is.
|
||||||
|
|
||||||
|
If `sh-use-smie' is non-nil, call `smie-config-guess'.
|
||||||
|
Otherwise, run the sh-script specific indent learning command, as
|
||||||
|
decribed below.
|
||||||
|
|
||||||
Output in buffer \"*indent*\" shows any lines which have conflicting
|
Output in buffer \"*indent*\" shows any lines which have conflicting
|
||||||
values of a variable, and the final value of all variables learned.
|
values of a variable, and the final value of all variables learned.
|
||||||
When called interactively, pop to this buffer automatically if
|
When called interactively, pop to this buffer automatically if
|
||||||
|
@ -3610,8 +3614,7 @@ to the value of variable `sh-learn-basic-offset'.
|
||||||
|
|
||||||
Abnormal hook `sh-learned-buffer-hook' if non-nil is called when the
|
Abnormal hook `sh-learned-buffer-hook' if non-nil is called when the
|
||||||
function completes. The function is abnormal because it is called
|
function completes. The function is abnormal because it is called
|
||||||
with an alist of variables learned. This feature may be changed or
|
with an alist of variables learned.
|
||||||
removed in the future.
|
|
||||||
|
|
||||||
This command can often take a long time to run."
|
This command can often take a long time to run."
|
||||||
(interactive "P")
|
(interactive "P")
|
||||||
|
@ -3809,7 +3812,6 @@ This command can often take a long time to run."
|
||||||
" has" "s have")
|
" has" "s have")
|
||||||
(if (zerop num-diffs)
|
(if (zerop num-diffs)
|
||||||
"." ":"))))))
|
"." ":"))))))
|
||||||
;; Are abnormal hooks considered bad form?
|
|
||||||
(run-hook-with-args 'sh-learned-buffer-hook learned-var-list)
|
(run-hook-with-args 'sh-learned-buffer-hook learned-var-list)
|
||||||
(and (called-interactively-p 'any)
|
(and (called-interactively-p 'any)
|
||||||
(or sh-popup-occur-buffer (> num-diffs 0))
|
(or sh-popup-occur-buffer (> num-diffs 0))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue