From: Tony Zorman via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 63748@debbugs.gnu.org
Subject: bug#63748: 30.0.50; eshell-previous-prompt doesn't work for multiline prompts
Date: Sat, 27 May 2023 10:38:11 +0200 [thread overview]
Message-ID: <87ilcew4ng.fsf@hyperspace> (raw)
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 "┌─"
(user-login-name) "@" (system-name)
" " (abbreviate-file-name (eshell/pwd)) " \n"
"└─"
(if (zerop (user-uid)) "#" "$")
" "))
and enable it by setting
(setq eshell-prompt-function #'my/default-prompt-function)
(setq eshell-prompt-regexp "└─[$#] ") ; For good measure.
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=inotify --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=-O2 -pipe
-march=native -mtune=native -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
--
Tony Zorman | https://tony-zorman.com/
next reply other threads:[~2023-05-27 8:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-27 8:38 Tony Zorman via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-05-30 5:02 ` bug#63748: 30.0.50; eshell-previous-prompt doesn't work for multiline prompts Jim Porter
2023-06-03 13:27 ` bug#63748: [PATCH] " Tony Zorman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-03 19:35 ` Jim Porter
2023-06-08 15:11 ` Tony Zorman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-15 16:46 ` Jim Porter
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=87ilcew4ng.fsf@hyperspace \
--to=bug-gnu-emacs@gnu.org \
--cc=63748@debbugs.gnu.org \
--cc=soliditsallgood@mailbox.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.