From unknown Fri Jun 20 18:21:19 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#41784 <41784@debbugs.gnu.org> To: bug#41784 <41784@debbugs.gnu.org> Subject: Status: 26.3; Narrow to prompt (narrow-to-defun fro M-x shell / comint) Reply-To: bug#41784 <41784@debbugs.gnu.org> Date: Sat, 21 Jun 2025 01:21:19 +0000 retitle 41784 26.3; Narrow to prompt (narrow-to-defun fro M-x shell / comin= t) reassign 41784 emacs submitter 41784 Pierre Neidhardt severity 41784 normal tag 41784 fixed thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 10 04:51:15 2020 Received: (at submit) by debbugs.gnu.org; 10 Jun 2020 08:51:15 +0000 Received: from localhost ([127.0.0.1]:33396 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jiwS3-0005ef-Gz for submit@debbugs.gnu.org; Wed, 10 Jun 2020 04:51:15 -0400 Received: from lists.gnu.org ([209.51.188.17]:42260) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jiwS2-0005eY-6R for submit@debbugs.gnu.org; Wed, 10 Jun 2020 04:51:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42386) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiwS1-0005Fl-UC for bug-gnu-emacs@gnu.org; Wed, 10 Jun 2020 04:51:13 -0400 Received: from relay12.mail.gandi.net ([217.70.178.232]:55165) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiwS0-0008P1-4v for bug-gnu-emacs@gnu.org; Wed, 10 Jun 2020 04:51:13 -0400 Received: from bababa (lfbn-idf2-1-1315-147.w92-169.abo.wanadoo.fr [92.169.129.147]) (Authenticated sender: mail@ambrevar.xyz) by relay12.mail.gandi.net (Postfix) with ESMTPSA id 55B79200002 for ; Wed, 10 Jun 2020 08:51:07 +0000 (UTC) From: Pierre Neidhardt To: bug-gnu-emacs@gnu.org Subject: 26.3; Narrow to prompt (narrow-to-defun fro M-x shell / comint) Date: Wed, 10 Jun 2020 10:51:06 +0200 Message-ID: <87sgf3e22t.fsf@ambrevar.xyz> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Received-SPF: pass client-ip=217.70.178.232; envelope-from=mail@ambrevar.xyz; helo=relay12.mail.gandi.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/10 04:51:08 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, FROM_SUSPICIOUS_NTLD=1, FROM_SUSPICIOUS_NTLD_FP=1, PDS_OTHER_BAD_TLD=1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Spam-Score: 2.9 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hi! I like the narrow-to-defun command and I miss it for comint-mode / M-x shell. Besides, I found it quite hard to reliably parse prompts, especially multiline prompt. So here are a bunch of functions that I think would make a great addition to upstream :) Content analysis details: (2.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [209.51.188.17 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [209.51.188.17 listed in wl.mailspike.net] 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: ambrevar.xyz] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: ambrevar.xyz (xyz)] 0.7 SPF_NEUTRAL SPF: sender does not match SPF record (neutral) 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD 2.0 FROM_SUSPICIOUS_NTLD_FP From abused NTLD X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi! I like the narrow-to-defun command and I miss it for comint-mode / M-x shel= l. Besides, I found it quite hard to reliably parse prompts, especially multiline prompt. So here are a bunch of functions that I think would make a great addition to upstream :) =2D-8<---------------cut here---------------start------------->8--- (defun ambrevar/shell-prompt-begin-position () ;; We need this convoluted function because `looking-at-p' does not work = on ;; multiline regexps _and_ `re-search-backward' skips the current line. (save-excursion (let ((old-point (point))) (max (save-excursion ;; Right result if not on prompt. (call-interactively #'comint-previous-prompt) (re-search-backward comint-prompt-regexp) (point)) (save-excursion ;; Right result if on first char after prompt. (re-search-backward comint-prompt-regexp) (point)) (save-excursion ;; Right result if on prompt. (call-interactively #'comint-next-prompt) (re-search-backward comint-prompt-regexp) (if (<=3D (point) old-point) (point) (point-min))))))) (defun ambrevar/shell-prompt-end-position () (save-excursion (goto-char (ambrevar/shell-prompt-begin-position)) (call-interactively #'comint-next-prompt) (point))) (defun ambrevar/shell-prompt () (buffer-substring-no-properties (ambrevar/shell-prompt-begin-position) (ambrevar/shell-prompt-end-position))) (defun ambrevar/shell-narrow-to-prompt () "Narrow buffer to prompt at point." (interactive) (let ((begin (ambrevar/shell-prompt-begin-position))) (narrow-to-region begin (save-excursion (goto-char (ambrevar/shell-prompt-end-position)) (call-interactively #'comint-next-prompt) (if (=3D begin (ambrevar/shell-prompt-begin-position)) (point-max) (ambrevar/shell-prompt-begin-position)))))) (define-key shell-mode-map (kbd "C-x n d") 'ambrevar/shell-narrow-to-prompt) =2D-8<---------------cut here---------------end--------------->8--- Cheers! =2D-=20 Pierre Neidhardt https://ambrevar.xyz/ --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAl7gnvoACgkQm9z0l6S7 zH8S9Qf8CIO1/uwh3+7HSSCMOgqkmfcaz6ldosxA8pYburqxvgle1oDAtKA2fQmH aST7QF+iAAHmlNuzR/C3VJF55V6hEKbgK8RFLHK5frC6HwwkvZ41t1CADD9dh9a9 1wPnjKqLK1TEANHSRAzsKGUllo948F2Y8GRNAhQUBr7m3V0UhAVqhQ/J7o4vpE64 CoFrLvsUTrFvUmj7eJP3PAApiPgSOnKdxyArvfwKcozeP5c3ffuyPpiqF2vKsu14 i2ccw6/Un4tfh3YPVPAJ23tvgASHhekq7au0FYkPsGeHPeadFNZysLhL9pPPxDPn UTVKoP4uQic8NYCJ2zg7WQpBBF6r5Q== =iYst -----END PGP SIGNATURE----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 17 07:17:26 2020 Received: (at 41784) by debbugs.gnu.org; 17 Oct 2020 11:17:26 +0000 Received: from localhost ([127.0.0.1]:33583 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kTkDG-0002iv-J6 for submit@debbugs.gnu.org; Sat, 17 Oct 2020 07:17:26 -0400 Received: from quimby.gnus.org ([95.216.78.240]:39076) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kTkDE-0002ih-Hf for 41784@debbugs.gnu.org; Sat, 17 Oct 2020 07:17:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=X643fC6BueieNBjcIodT+VUKeEl7YnjyG9uigkmtrJE=; b=mVFxzZKwxUsU5rH67kIcuXzxrH zVHpYvvQ3XBA+EHZTz4wkx7lCukGROqC7J6tZdqjZYqwEm7mW5AqV52wvudCrxsybmPsnelKYmtHl SdvVsAfsTW0Mkl5Fub3OZUpKX9YRSRFawgCVzQJZZEc54isdV0Vk+zbbJHgrElwVG+I4=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kTkD5-0002y3-Fl; Sat, 17 Oct 2020 13:17:18 +0200 From: Lars Ingebrigtsen To: Pierre Neidhardt Subject: Re: bug#41784: 26.3; Narrow to prompt (narrow-to-defun fro M-x shell / comint) References: <87sgf3e22t.fsf@ambrevar.xyz> X-Now-Playing: Machinedrum's _Vapor City Citizenship Programme_: "Vapor City Metro Mix" Date: Sat, 17 Oct 2020 13:17:14 +0200 In-Reply-To: <87sgf3e22t.fsf@ambrevar.xyz> (Pierre Neidhardt's message of "Wed, 10 Jun 2020 10:51:06 +0200") Message-ID: <87zh4lm79h.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Pierre Neidhardt writes: > I like the narrow-to-defun command and I miss it for comint-mode / M-x shell. > Besides, I found it quite hard to reliably parse prompts, especially > multiline prompt. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Pierre Neidhardt writes: > I like the narrow-to-defun command and I miss it for comint-mode / M-x shell. > Besides, I found it quite hard to reliably parse prompts, especially > multiline prompt. Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: ambrevar.xyz (xyz)] X-Debbugs-Envelope-To: 41784 Cc: 41784@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) Pierre Neidhardt writes: > I like the narrow-to-defun command and I miss it for comint-mode / M-x shell. > Besides, I found it quite hard to reliably parse prompts, especially > multiline prompt. Looks good to me, so I've added the functions to Emacs 28 (with some minor changes). -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 17 07:17:31 2020 Received: (at control) by debbugs.gnu.org; 17 Oct 2020 11:17:31 +0000 Received: from localhost ([127.0.0.1]:33586 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kTkDK-0002jD-QC for submit@debbugs.gnu.org; Sat, 17 Oct 2020 07:17:31 -0400 Received: from quimby.gnus.org ([95.216.78.240]:39090) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kTkDJ-0002in-HE for control@debbugs.gnu.org; Sat, 17 Oct 2020 07:17:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=XiaIkbC+kE4nA9//c5l7IUnGhxxe7NPuOGfy0yd0pDE=; b=crSf7AFKsz9WIdQMkij70c+oyh NiHEvomTNY0PmVdOUFI38MrTPKGwX15UceMqdL+vava0cWB//hta8wrXZoGph7VApEa4XGKMqwGz+ BSJ/cREYzdlk5OBjFZKUQUHhqkOYdqn0jEMNfDHmWMqcfXR/x4kfikborRTArCIvA96k=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kTkDB-0002yA-QL for control@debbugs.gnu.org; Sat, 17 Oct 2020 13:17:24 +0200 Date: Sat, 17 Oct 2020 13:17:20 +0200 Message-Id: <87y2k5m79b.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #41784 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 41784 fixed close 41784 28.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 41784 fixed close 41784 28.1 quit From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 17 08:09:14 2020 Received: (at 41784) by debbugs.gnu.org; 17 Oct 2020 12:09:14 +0000 Received: from localhost ([127.0.0.1]:33626 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kTl1O-00069d-90 for submit@debbugs.gnu.org; Sat, 17 Oct 2020 08:09:14 -0400 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:44877) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kTl1M-00069P-DW for 41784@debbugs.gnu.org; Sat, 17 Oct 2020 08:09:13 -0400 X-Originating-IP: 90.92.160.122 Received: from bababa (lfbn-idf2-1-1094-122.w90-92.abo.wanadoo.fr [90.92.160.122]) (Authenticated sender: mail@ambrevar.xyz) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 8237940002; Sat, 17 Oct 2020 12:09:05 +0000 (UTC) From: Pierre Neidhardt To: Lars Ingebrigtsen Subject: Re: bug#41784: 26.3; Narrow to prompt (narrow-to-defun fro M-x shell / comint) In-Reply-To: <87zh4lm79h.fsf@gnus.org> References: <87sgf3e22t.fsf@ambrevar.xyz> <87zh4lm79h.fsf@gnus.org> Date: Sat, 17 Oct 2020 14:09:04 +0200 Message-ID: <87mu0lrr4v.fsf@ambrevar.xyz> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Spam-Score: 2.5 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Thanks a lot! -- Pierre Neidhardt https://ambrevar.xyz/ Content analysis details: (2.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [217.70.183.194 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: ambrevar.xyz (xyz)] 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD X-Debbugs-Envelope-To: 41784 Cc: 41784@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 2.5 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Thanks a lot! -- Pierre Neidhardt https://ambrevar.xyz/ Content analysis details: (2.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [217.70.183.194 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: ambrevar.xyz (xyz)] -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager 1.0 BULK_RE_SUSP_NTLD Precedence bulk and RE: from a suspicious TLD 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Thanks a lot! =2D-=20 Pierre Neidhardt https://ambrevar.xyz/ --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQFGBAEBCAAwFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAl+K3uASHG1haWxAYW1i cmV2YXIueHl6AAoJEJvc9Jeku8x/XrgH/jDOPDZIWNyl49XuR/mSToT6Yu6ynJYq Mlf4Y/zcZANlPQi5TVxqIIDpbMBSTgYMGd0o8Xqcpk65NRRtQcliivsx7BmINvZX f35c7FSZ6ZYO1RNiRB36YP2QH/vh/h61AU8McPEC47lfdWah+Xlh9q04nBLDw5qk 9k37XvKiksxFu8cMRQ2h0+DBbA1Q/VasQEoOIDrt2pXiGwX/CA5XBIrTse2uEmUC 6TqosX73S/gnb7LHbxDaP4dOoUcTzcATKmki8TnzEebKSPNoAdqaXH5RqOgke8UE u/kuxSzn/UnaJQwmvoseouCv1YhodcUulDWPRYpVLqc8tiS0Y+qlMrc= =7MWG -----END PGP SIGNATURE----- --=-=-=-- From unknown Fri Jun 20 18:21:19 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 14 Nov 2020 12:24:08 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator