Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Mar 2021 21:49:21 GMT
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 660045fb5360 - main - sh: improve emacs mode
Message-ID:  <202103302149.12ULnLfe048255@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by bapt:

URL: https://cgit.FreeBSD.org/src/commit/?id=660045fb5360d328da199ae78c89d5cc15b6d1ca

commit 660045fb5360d328da199ae78c89d5cc15b6d1ca
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2021-03-30 09:37:29 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2021-03-30 21:49:03 +0000

    sh: improve emacs mode
    
    In emacs mode, force ^R to backware search the history
    This behaviour is the default in emacs mode for most of the other shells
    
    Note: Note that this can still be overridden via $EDITRC, ~/.editrc or a
    bind command after set -o emacs.
    
    MFC after:              1 week
    Approved by:            jilles
    Reviewed by:            jilles, arichardson, pstef
    Differential Revision:  https://reviews.freebsd.org/D29494
---
 bin/sh/histedit.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c
index 45a821736bc0..ba2bec357181 100644
--- a/bin/sh/histedit.c
+++ b/bin/sh/histedit.c
@@ -142,8 +142,10 @@ bad:
 		if (el) {
 			if (Vflag)
 				el_set(el, EL_EDITOR, "vi");
-			else if (Eflag)
+			else if (Eflag) {
 				el_set(el, EL_EDITOR, "emacs");
+				el_set(el, EL_BIND, "^R", "em-inc-search-prev", NULL);
+			}
 			el_set(el, EL_BIND, "^I", "sh-complete", NULL);
 			el_source(el, NULL);
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202103302149.12ULnLfe048255>