From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Felix Dietrich Newsgroups: gmane.emacs.help Subject: Re: terminal command with output in current buff Date: Sat, 17 Jul 2021 13:33:13 +0200 Message-ID: <87r1fxnpja.fsf@sperrhaken.name> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24580"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 17 13:33:43 2021 Return-path: Envelope-to: geh-help-gnu-emacs@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 1m4iZi-0006Ay-Q9 for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 17 Jul 2021 13:33:42 +0200 Original-Received: from localhost ([::1]:44734 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m4iZh-0001sM-H2 for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 17 Jul 2021 07:33:41 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44030) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m4iZO-0001sE-2V for help-gnu-emacs@gnu.org; Sat, 17 Jul 2021 07:33:22 -0400 Original-Received: from mout.kundenserver.de ([212.227.126.187]:38265) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m4iZM-0004qW-4f for help-gnu-emacs@gnu.org; Sat, 17 Jul 2021 07:33:21 -0400 Original-Received: from localhost ([77.11.79.224]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1N8XHV-1l0sIB0X5t-014PM4 for ; Sat, 17 Jul 2021 13:33:18 +0200 In-Reply-To: (lisa-asket@perso.be's message of "Sat, 17 Jul 2021 11:19:32 +0200 (CEST)") X-Provags-ID: V03:K1:OZFIRFPnM/B/RUVYhije/Vj1NY/QcnCHpuG++2NA7UXXVItoDyx 3JYkvYCn6U6tZV4aZQkjAjWEEseYrnDXeK4y6Lc0IrQGt87OkLq/12m3d0DiXW5k+6FFYQM 4SMj/OFk17gENqGcdtm1c1s/XRIGVAL56NBzs7C32rcdiMGifgAaXi6lXoKzjXWPME62YlO Cnhq+t/jDNlgK6/L2b5Hg== X-UI-Out-Filterresults: notjunk:1;V03:K0:wFDpuHtpCZw=:5zu3wUaYWfpp4EI0UJJSoV nNkGer4xQzBHsRvZdOVkwBbJqVaSyxdD/a5gtjjPwvqeX8o4oBN8Th125IEZtn2HJEbXAWOdK 8gmZgnHZAWYPOKDG4UBSVEcnHq6qw5ouBshs3DQldvchrsVjtUjSJFw7GN9QYosNhpIl2K8n4 va22NE7+//OIzWgGIs0Ig1EsVcrUDsXocdQxtxCh4W+m8zllyaoLFHpGuMPLmicQH0rgw/ZtB jDDCoSL6TcZv3/0KxoyF/0N+70XE7qvxYXGrUycUvGJ7YGkI+GIvIJ+Pfb1Mr1fYEsZsPejWj WzCtMQo6K9AVbjkP0v031rWOvHtWyGa9qqOYFCqoNHOOqKs7Eg3eIL6WwzTlIyZA1M9Fv+keR MvDBNfS/Dy/bikxJziZrgUieyJUTJSMcB9rTHOy7US4+h1sGpy2K9vTthXz0V1CHuKR+yXMze /aSKZtNh0s/0235Ibu2OXd7Q8lpKASGft3vAi24ziu5y4RD0DbVgS6KS2KAJXJNFvPvpgyfXT hkjrWn8QQbSEcz+aYjzj0sVO3/P+eNSjKIsanu73ktuxxjSst3i1eYFhS1lQwDYxayEHmdQcU 1CZ13MVQ7EkfVpFTu9/2BQmHAv2cVgPmGzodwsF3usqQCcrq0iHyXcWxUFrT0JAP0I96GTbJI SfdQuVz9jxP9JVxXF8fwCtJeHxOrCCHly7jVHISE3ft4dC0xr284wt1Xn93FH1qlb+etOZZ78 CRrSaMSYFa2NdnK8ZkOUWiNLxSuhqluoaqidjNd1LntM8oS3MgaNAUzM0Dh8ULA2GrFKl79D Received-SPF: none client-ip=212.227.126.187; envelope-from=felix.dietrich@sperrhaken.name; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:131787 Archived-At: lisa-asket@perso.be writes: > I am getting a small problem when using `(cmd-cnum (read-number "context:= "))` > > Wrong type argument: sequencep, 8 Please provide, if possible, small self-contained examples that reproduce your problem and more context around your snippets: I had to hunt for the context in your past messages. Here is a simplified version of your code that causes the problem and serves as an example of what I mean by =E2=80=9Cself-contained example=E2=80=9D: (let* ((cmd-cnum (read-number "Number: ")) (cmd-temp `("grep" ,cmd-cnum)) ;; same as: (cmd-temp (list "grep" cmd-cnum)) (mapconcat #'shell-quote-argument cmd-temp " ")) > number-to-string seems to be what is required Anyway you have found a solution to your problem. Let me just add a short explanation in case the issue is not entirely clear to you yet: =E2=80=98shell-quote-argument=E2=80=99 works on strings; when you map over = a list, you apply the function on each element of the list and collect the results. Therefore, in your call to =E2=80=98mapconcat=E2=80=99 the function =E2=80=98shell-quote-argument=E2=80=99 will eventually be passed the value = of =E2=80=98cmd-cnum=E2=80=99, which you have inserted into the list. Example= s that do not work: (shell-quote-argument 5) =E2=87=92 Wrong type argument: sequencep, 5 (mapconcat #'shell-quote-argument '(5) " ") =E2=87=92 Wrong type argument: sequencep, 5 (mapconcat #'shell-quote-argument '("grep" 5) " ") =E2=87=92 Wrong type argument: sequencep, 5 (mapconcat #'shell-quote-argument '(5 "grep") " ") =E2=87=92 Wrong type argument: sequencep, 5 > After selecting wy search pattern and storing it in `cmd-ptrn`, how > can I highlight the pattern when tho grep results are being > transferred to the current buffer ? Now it=CA=BCs getting complicated and I couldn=CA=BCt give you an answer of= the of my head: look into adding text properties [1] to strings and at process filters [2]. How could you identify the information elements grep puts on each line and their position? It will probably also be insightful to look at how the Emacs command =E2=80=9CM-x grep=E2=80=9D [3] is implemented. Footnotes: [1] [2] [3] --=20 Felix Dietrich