From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tony Zorman via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#63748: 30.0.50; eshell-previous-prompt doesn't work for multiline prompts Date: Sat, 27 May 2023 10:38:11 +0200 Message-ID: <87ilcew4ng.fsf@hyperspace> Reply-To: Tony Zorman 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="19424"; mail-complaints-to="usenet@ciao.gmane.io" To: 63748@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat May 27 10:39:24 2023 Return-path: Envelope-to: geb-bug-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 1q2pSN-0004rT-LG for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 27 May 2023 10:39:23 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2pS8-0001yP-Da; Sat, 27 May 2023 04:39:08 -0400 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 1q2pS2-0001xq-Th for bug-gnu-emacs@gnu.org; Sat, 27 May 2023 04:39:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q2pS2-0006x4-L9 for bug-gnu-emacs@gnu.org; Sat, 27 May 2023 04:39:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q2pS2-0006tY-Cy for bug-gnu-emacs@gnu.org; Sat, 27 May 2023 04:39:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tony Zorman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 27 May 2023 08:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 63748 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.168517670926447 (code B ref -1); Sat, 27 May 2023 08:39:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 27 May 2023 08:38:29 +0000 Original-Received: from localhost ([127.0.0.1]:51372 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q2pRU-0006sV-IE for submit@debbugs.gnu.org; Sat, 27 May 2023 04:38:29 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:55476) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q2pRT-0006sO-Jw for submit@debbugs.gnu.org; Sat, 27 May 2023 04:38:28 -0400 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 1q2pRT-0001wc-DR for bug-gnu-emacs@gnu.org; Sat, 27 May 2023 04:38:27 -0400 Original-Received: from mout-p-103.mailbox.org ([80.241.56.161]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1q2pRP-0006tA-QY for bug-gnu-emacs@gnu.org; Sat, 27 May 2023 04:38:27 -0400 Original-Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4QSwD54xyjz9sX7 for ; Sat, 27 May 2023 10:38:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1685176693; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Yvd5zPQJ9Mxm0hxdn9wmSPNBbqyUIBL6xW7ItFU8ec4=; b=tgXcBJ+0KD2NgrU4TShgVGIytPUYvbwDQY8/LcSAWpxbi5VGiVCmNkIWPoYrMyNVEHeSfS yocT0nEXKLbj6Tcii7ZOyqdb7OdMXUcN6SwYS+uKudat9cmHuqKtQPFUAU3pkXbkhvs7bU qe06BPpJ3WMfuLch8gP9+pNp/fja0fJSvQ4/IkBewnXWUTN2Wi+VzENQUgKQfC0/wjWiPF sih97mzGzphBNmdIrPaO3bOwFnx+XZHc+MmXX3ljsYEnHEUuqfTIr1Eb+iW91gH/M2bUqN 1Nb8YkmR+/qJAPXVz/AuWUVKkDwZMKS2LUHi0YTNW/9BDHe4t+VYuRmu1GJkAA== X-MBO-RS-ID: 826ccdd27562ed900af X-MBO-RS-META: 4h6smwax1xbxp954hbb7cfuu5m8j51cy Received-SPF: pass client-ip=80.241.56.161; envelope-from=soliditsallgood@mailbox.org; helo=mout-p-103.mailbox.org X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:262469 Archived-At: Hi, in commit c257fd3a406d6aa83be60b96217e42b49b62cf5f, the way prompt navigation in eshell is done was changed; it now works via a text property search instead of searching for the prompt regexp. When backwards searching with a prompt that spans multiple lines, however, one doesn't get off the ground because the current prompt isn't properly skipped. More precisely: define a custom prompt (defun my/default-prompt-function () (concat "=E2=94=8C=E2=94=80" (user-login-name) "@" (system-name) " " (abbreviate-file-name (eshell/pwd)) " \n" "=E2=94=94=E2=94=80" (if (zerop (user-uid)) "#" "$") " ")) and enable it by setting (setq eshell-prompt-function #'my/default-prompt-function) (setq eshell-prompt-regexp "=E2=94=94=E2=94=80[$#] ") ; For good measu= re.=20 This will result in the point not moving backwards to the last prompt on C-c C-p (eshell-previous-prompt), but instead it gets "stuck" on the very left of the line it is on. A solution to this (I think) is to actually search for the beginning of the current prompt, instead of using forward-line by itself. I.e., something like diff --git a/lisp/eshell/em-prompt.el b/lisp/eshell/em-prompt.el index 9f9e58e83d..b6c873b41d 100644 --- a/lisp/eshell/em-prompt.el +++ b/lisp/eshell/em-prompt.el @@ -180,7 +180,8 @@ eshell-next-prompt (text-property-search-forward 'field 'prompt t)) (setq n (1- n))) (let (match this-match) - (forward-line 0) ; Don't count prompt on current line. + ;; Don't count prompt on current line. + (text-property-search-backward 'field 'prompt t) (while (and (< n 0) (setq this-match (text-property-search-backward 'field 'prompt t))) This is a tiny change, so I suppose it can be applied immediately (if I haven't overlooked anything, of course), or I can prepare a proper patch (that perhaps adds a test for multiline prompts to the right place). Tony ----------------------------------------------------------------------- In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-musl, cairo version 1.16.0) of 2023-05-17 built on pbox Repository revision: 6cb963b73c3768958e13e96b2534d1e99239a3ff Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101008 System Description: Void Linux Configured using: 'configure --with-x --without-x-toolkit --without-toolkit-scroll-bars --without-dbus --without-gconf --without-gsettings --with-modules --with-file-notification=3Dinotify --with-jpeg --with-tiff --with-gif --with-png --with-xpm --with-rsvg --without-imagemagick --with-cairo --with-gnutls --with-sound --with-json --with-harfbuzz --with-gpm --with-native-compilation --without-compress-install --with-xinput2 --with-small-ja-dic --without-tree-sitter 'CFLAGS=3D-O2 -pipe -march=3Dnative -mtune=3Dnative -fomit-frame-pointer'' Configured features: CAIRO FREETYPE GIF GLIB GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY OLDXMENU PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF WEBP X11 XDBE XIM XINPUT2 XPM ZLIB Important settings: value of $LC_ALL: en_US.UTF-8 value of $LC_COLLATE: C value of $LANG: en_GB locale-coding-system: utf-8-unix --=20 Tony Zorman | https://tony-zorman.com/