Subject: Re: bug#24848: [sh-script] How to save "Local rules set" result from sh-learn-buffer-indent?

From: [email-masked]
Date: Thu, 24 Aug 2017 08:41:50 -0400

retitle 24848 [sh-script] How to save "Local rules set" result from sh-learn-buffer-indent?
quit

<[email-masked]> writes:

> I've looked at the bug online and all I can see is my own report,
> which was submitted 295 days ago.

Hi, sorry nobody responded earlier.  Actually I would generally
recommend that you send a followup message after a week or two if there
hasn't been any response.  By that time it's probably fallen off the
radar from "current" bugs and become one of thousands of "open" bugs.
(Also, your title could be a bit more descriptive, it's so vague that I
would probably skip over it without noticing if I saw it in a list.)

> Once I've done sh-learn-buffer-indent, all I really need to know is
> how to save the "local rules".  Perhaps it isn't a bug ... but if it
> isn't, how come when I do M-x customize-unsaved it responds "No user
> options are set but unsaved"?  Perhaps it is not stored as an option,
> I don't know, but this is why I submitted the bug: nobody seems to
> know where this "local config" is saved or how to make it permanent!

Does this commentary from sh-script.el help? (not that info hidden away
in comments is a substitute for actual docs; I'm just trying to make
sure we understand the problem.)

;; 	Saving indentation values
;; 	-------------------------
;; After you've learned the values in a buffer, how to you remember
;; them?   Originally I had hoped that `sh-learn-buffer-indent'
;; would make this unnecessary;  simply learn the values when you visit
;; the buffer.
;; You can do this automatically like this:
;;   (add-hook 'sh-set-shell-hook 'sh-learn-buffer-indent)
;;
;; However...  `sh-learn-buffer-indent' is extremely slow,
;; especially on large-ish buffer.  Also, if there are conflicts the
;; "last one wins" which may not produce the desired setting.
;;
;; So...There is a minimal way of being able to save indentation values and
;; to reload them in another buffer or at another point in time.
;;
;; Use `sh-name-style' to give a name to the indentation settings of
;; 	the current buffer.
;; Use `sh-load-style' to load indentation settings for the current
;; 	buffer from a specific style.
;; Use `sh-save-styles-to-buffer' to write all the styles to a buffer
;; 	in lisp code.  You can then store it in a file and later use
;; 	`load-file' to load it.