all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Andrew De Angelis <bobodeangelis@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: New Package: sticky-shell
Date: Tue, 13 Dec 2022 09:22:16 -0500	[thread overview]
Message-ID: <jwvr0x3csgi.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <CAP5CrM2RbdR2doHd3boRYyND60JmpPL660iPAUTEkyvb2zrRxg@mail.gmail.com> (Andrew De Angelis's message of "Mon, 12 Dec 2022 23:07:13 -0500")

>> 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.

Step 1 (same as for GNU ELPA): get the copyright paperwork in order.
       I don't see your name in the FSF's copyright assigners list, so
       either it's still in process or you haven't started yet.
       Let me know if you need help with that.

Step 2: Turn your file into a patch to `shell.el`.
      [ Feel free to also make changes in `shell.el` and/or `eshell.el` to
        make the result cleaner.  ]

> @@ -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'.

I can see the upside, yes, but the downside is that the format of
`sticky-shell-prompt-modifiers` is "new" in the sense that it's
different from existing customization variables used for similar
purposes (which are either `<foo>-function` (modified with
`add-function`) or `<foo>-functions` (modified with `add-hook`)).

Another downside of that code is that `sticky-shell-modified-prompt` is
a macro that's expanded every time we refresh the header line, which can
be very frequent in some cases, thus generating excess garbage.

[ Oh, BTW, I suspect your code needs a (require 'subr-x) to be sure
  `thread-first` is actually available.  ]


        Stefan




  reply	other threads:[~2022-12-13 14:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-12  0:05 New Package: sticky-shell Andrew De Angelis
2022-12-12 18:33 ` Philip Kaludercic
2022-12-12 18:45 ` Stefan Monnier
2022-12-12 18:55   ` Akib Azmain Turja
2022-12-13  3:27 ` Jean Louis
2022-12-13  4:07   ` Andrew De Angelis
2022-12-13 14:22     ` Stefan Monnier [this message]
2022-12-13 18:24     ` Jean Louis
2022-12-14  5:23       ` Andrew De Angelis
2022-12-14 13:41         ` Stefan Monnier
2022-12-16 10:20         ` Jean Louis
2022-12-28 15:34           ` Andrew De Angelis
2022-12-30 14:45             ` Jean Louis
2023-02-19 20:56               ` Andrew De Angelis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvr0x3csgi.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=bobodeangelis@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.