From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrew De Angelis Newsgroups: gmane.emacs.devel Subject: Re: New Package: sticky-shell Date: Mon, 12 Dec 2022 23:07:13 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000e633a505efadc14f" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39710"; mail-complaints-to="usenet@ciao.gmane.io" To: Andrew De Angelis , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Dec 13 12:47:38 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p53l3-000A4k-Dn for ged-emacs-devel@m.gmane-mx.org; Tue, 13 Dec 2022 12:47:37 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p53kN-00071a-E6; Tue, 13 Dec 2022 06:46:55 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p4wZk-0005C8-Ug for emacs-devel@gnu.org; Mon, 12 Dec 2022 23:07:28 -0500 Original-Received: from mail-vs1-xe2e.google.com ([2607:f8b0:4864:20::e2e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p4wZi-000434-Ov for emacs-devel@gnu.org; Mon, 12 Dec 2022 23:07:28 -0500 Original-Received: by mail-vs1-xe2e.google.com with SMTP id t5so13445295vsh.8 for ; Mon, 12 Dec 2022 20:07:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=yvwj2lEisl+5h01Vw7JtWTd33q02Rs1WB129ja6Myvg=; b=ZbQuXYEpme6JXYhOpmlDFLRQq9iyVcHdxVXDIYGqgHtzTUM1RrgIwQc+IMlgMB7Mxz PfkdYv//YSakHoST4Wslrt1+PdFC8SchxIwprp7Eg3Mu/zwjEzSdeQPP52cBv+mTIdt4 zI4vEKaUaAUczvZNe5v06tRxkGaY0ZnF3USDw2l/J6L7eFMv4t01bQK4BFwRhJRL+tRj ei45CBbKFdEvg6xpx28VYkoREG/JRcIEbHKU87FJezmYIY9D4a3WGMU+ntisEUF9k/vH Aw4QkduUiY6cr606YC5zo5LF8zeWNUbfUmGdc3fh/eyUl8m7I8LaNISMuxBcwESUQH17 IjFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yvwj2lEisl+5h01Vw7JtWTd33q02Rs1WB129ja6Myvg=; b=VB74ahNouAh5CSRpPzV2fcG2nTUYnzEWzH5K3C/9IzgSo4+sSHFrxHAYMnOCk001dU 8gI2TkyatK4VXQnhe7LkWJJp6UDxkzCWCtQeQkThwfGu6+McVDaCYaBf9eRtT2MdDCVp 0BkxFtOMEZ70M3TLtV9trpEIO6xNm1+STqswXeqTAsfB89EH0gk09pbAW6TuHgH+5yqc 4ii4uZ0Jp01eMymJuV93xOaPFIQMKv5CTULS+wmleMhBFKT58OeySMeXoMLUCikPfP0r 0l3IQbj4gIahxTgCG6nNo8NXLIwTfCpOswK2SiI0MqCasNnNpxeJJ5FgfiXCLPHQ++ON 5nuw== X-Gm-Message-State: ANoB5pnlldruB6xW7V8w3TvYyfLM2pRRVAj07+neR/oWwINMGu5sbT/Q DEMAxuIBvw8yfuQTWMvuhYpCGmB3gD1iAyk3byg= X-Google-Smtp-Source: AA0mqf548HS2szBSgiozsXVH3+ASXYf3hQNPImZfbkeFuihkczKxAInS0sh/wyEL+wbonKJ+XNDVR01VX9Q35CaV6r4= X-Received: by 2002:a67:e014:0:b0:3b2:f855:9440 with SMTP id c20-20020a67e014000000b003b2f8559440mr5043985vsl.62.1670904445021; Mon, 12 Dec 2022 20:07:25 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::e2e; envelope-from=bobodeangelis@gmail.com; helo=mail-vs1-xe2e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 13 Dec 2022 06:46:47 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:301306 Archived-At: --000000000000e633a505efadc14f Content-Type: text/plain; charset="UTF-8" @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. @Stefan Monnier > 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. @Philip Kaludercic > 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'. On Mon, Dec 12, 2022 at 10:27 PM Jean Louis wrote: > * Andrew De Angelis [2022-12-12 06:24]: > > This is the git repo: https://github.com/andyjda/sticky-shell, with > > additional info in the README and in the code's documentation. > > Just that the "sticky shell" does not reflect what it does. > > I have tested it, it does not work reliably. > > - it does not show which command generated error, I have for example: > > $ youtube-dl -f18 "https://www.youtube.com/watch?v=PVsnbalE6Ig" > C-c C-cTraceback (most recent call last): > File > "/usr/lib/python3.10/site-packages/youtube_dl/extractor/__init__.py", line > 4, in > from .lazy_extractors import * > ModuleNotFoundError: No module named 'youtube_dl.extractor.lazy_extractors' > ...with more lines here below... > > and that one is not shown. > > - for this below it shows "dcon" instead of "dconf": > > $ dconf > error: no command specified > > Usage: > dconf COMMAND [ARGS...] > > Commands: > help Show this information > read Read the value of a key > list List the contents of a dir > write Change the value of a key > reset Reset the value of a key or dir > compile Compile a binary database from keyfiles > update Update the system databases > watch Watch a path for changes > dump Dump an entire subpath to stdout > load Populate a subpath from stdin > > Use 'dconf help COMMAND' to get detailed help. > > > - for ls -lR it shows "ls -l" > > I have got feeling that it works unreliably. > > -- > Jean > > Take action in Free Software Foundation campaigns: > https://www.fsf.org/campaigns > > In support of Richard M. Stallman > https://stallmansupport.org/ > --000000000000e633a505efadc14f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
@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-shel= l works as expected.

Any chance we coul= d 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.

@Philip Kaludercic
I assume you are referring to GNU ELPA (th= e only where contributors have
to sign the FSF CA?)
Yes.

A= nd thanks for your suggestions/comments on the code. I will apply the chang= es and push them soon,=C2=A0 including adding the .elpaignore file.
<= div>
I do have some questions about some of your comments:

+=C2=A0 =C2=A0 ;; Perhaps you should pull this into = a separate function, as the
+=C2=A0 =C2=A0 ;; check appears quite often.=C2=A0 Another idea, as the pat= tern appease quite similar in general, you could also
I think par= t of this comment is missing? But yes I do agree a separate function is pro= bably a good idea here.

@@ -129,23 +134,25 @@ macro= -expands to:
=C2=A0 (upcase
=C2=A0 =C2=A0(funcall sticky-shell-get-prompt))
=C2=A0 \\=3D'face \\=3D'minibuffer-prompt)"
+=C2=A0 ;; The case distinction appears unnecessary (thread-first (foo)) is=
+=C2=A0 ;; the same as (foo).
=C2=A0 =C2=A0(if sticky-shell-prompt-modifiers
=C2=A0 =C2=A0 =C2=A0 =C2=A0`(thread-first
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (funcall sticky-shell-get-prompt)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ,@sticky-shell-prompt-modifiers)
+=C2=A0 =C2=A0 ;; Perhaps it would be better/cleaner if
+=C2=A0 =C2=A0 ;; `sticky-shell-prompt-modifiers' were a list of functi= on that
+=C2=A0 =C2=A0 ;; all get applied on the result of (funcall
+=C2=A0 =C2=A0 ;; sticky-shell-get-prompt) in order?
=C2=A0 =C2=A0 =C2=A0(funcall sticky-shell-get-prompt)))
Not sure = what you mean by the first comment.
Regarding the second com= ment: 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 b= e 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' w= as simply a list of functions operating on a single argument, because `prop= ertize' requires multiple arguments. The solution would have to be to c= reate a new function:
(defun propertize-my-way (string)
=C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0(propertize string 'face 'minibuffer))<= /div>
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-modifie= rs'.

On Mon, Dec 12, 2022 at 10:27 PM Jean Louis &= lt;bugs@gnu.support> wrote:
* Andrew De Angelis <bobodeangelis@gmail.com> [2022-12-12 06:24]= :
> This is the git repo: https://github.com/andyjda/sticky-= shell, with
> additional info in the README and in the code's documentation.

Just that the "sticky shell" does not reflect what it does.

I have tested it, it does not work reliably.

- it does not show which command generated error, I have for example:

$ youtube-dl -f18 "https://www.youtube.com/watch?v= =3DPVsnbalE6Ig"
=C2=A0 C-c C-cTraceback (most recent call last):
=C2=A0 File "/usr/lib/python3.10/site-packages/youtube_dl/extractor/__= init__.py", line 4, in <module>
=C2=A0 =C2=A0 from .lazy_extractors import *
ModuleNotFoundError: No module named 'youtube_dl.extractor.lazy_extract= ors'
...with more lines here below...

and that one is not shown.

- for this below it shows "dcon" instead of "dconf":
$ dconf
error: no command specified

Usage:
=C2=A0 dconf COMMAND [ARGS...]

Commands:
=C2=A0 help=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Show this infor= mation
=C2=A0 read=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Read the value = of a key
=C2=A0 list=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 List the conten= ts of a dir
=C2=A0 write=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Change the valu= e of a key
=C2=A0 reset=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Reset the value= of a key or dir
=C2=A0 compile=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Compile a binary dat= abase from keyfiles
=C2=A0 update=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Update the system da= tabases
=C2=A0 watch=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Watch a path fo= r changes
=C2=A0 dump=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Dump an entire = subpath to stdout
=C2=A0 load=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Populate a subp= ath from stdin

Use 'dconf help COMMAND' to get detailed help.


- for ls -lR it shows "ls -l"

I have got feeling that it works unreliably.

--
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/
--000000000000e633a505efadc14f--