@Jean Louis, about
I have tested it, it does not work reliably.
Thanks for flagging this. What version of Emacs are you running, and do you have any special shell configuration?
I built Emacs from master last week, did "emacs -q" and sticky-shell works as expected.
Any chance we could simply add it to `shell.el`?
I wouldn't mind adding it to `shell.el`. Let me know what the process would be in that case.
I assume you are referring to GNU ELPA (the only where contributors have
to sign the FSF CA?)
Yes.
And thanks for your suggestions/comments on the code. I will apply the changes and push them soon, including adding the .elpaignore file.
I do have some questions about some of your comments:
+ ;; Perhaps you should pull this into a separate function, as the
+ ;; check appears quite often. Another idea, as the pattern appease quite similar in general, you could also
I think part of this comment is missing? But yes I do agree a separate function is probably a good idea here.
@@ -129,23 +134,25 @@ macro-expands to:
(upcase
(funcall sticky-shell-get-prompt))
\\='face \\='minibuffer-prompt)"
+ ;; The case distinction appears unnecessary (thread-first (foo)) is
+ ;; the same as (foo).
(if sticky-shell-prompt-modifiers
`(thread-first
(funcall sticky-shell-get-prompt)
,@sticky-shell-prompt-modifiers)
+ ;; Perhaps it would be better/cleaner if
+ ;; `sticky-shell-prompt-modifiers' were a list of function that
+ ;; all get applied on the result of (funcall
+ ;; sticky-shell-get-prompt) in order?
(funcall sticky-shell-get-prompt)))
Not sure what you mean by the first comment.
Regarding the second comment: this is essentially what thread-first does, with the added advantage that `sticky-shell-prompt-modifiers' can consist not only of functions, but also of forms with multiple arguments, and whose first argument will be the result of (funcall sticky-shell-get-prompt) at runtime. For example, if users wanted to `propertize' the header with particular properties, they wouldn't be able to do it if `sticky-shell-prompt-modifiers' was simply a list of functions operating on a single argument, because `propertize' requires multiple arguments. The solution would have to be to create a new function:
(defun propertize-my-way (string)
(propertize string 'face 'minibuffer))
And add propertize-my-way to the list of prompt modifiers.
Using thread-first saves users time by allowing them to simply add '(propertize 'face 'minibuffer) to `sticky-shell-prompt-modifiers'.