From patchwork Wed Sep 11 00:43:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 34495 Received: (qmail 93222 invoked by alias); 11 Sep 2019 00:44:01 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 93213 invoked by uid 89); 11 Sep 2019 00:44:00 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=LINES, permanently X-HELO: gateway30.websitewelcome.com Received: from gateway30.websitewelcome.com (HELO gateway30.websitewelcome.com) (192.185.197.25) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 11 Sep 2019 00:43:58 +0000 Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway30.websitewelcome.com (Postfix) with ESMTP id 3A18E5156 for ; Tue, 10 Sep 2019 19:43:57 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id 7qjli62N33Qi07qjliiiZD; Tue, 10 Sep 2019 19:43:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: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=MUMkbxUYBiqr5HiAUiFXVCIoOqggMS1CeIaDnzLU7RY=; b=wJWIVx0lItq/iAbyqYXE9qXKIA 6N3HhM0+BIlgwD2d580qtw4hb9mkr8jgFc374hsKGAdl+Ecl5u+EIFvRrHoQm43Oh2ri6XvLb7nUT RUIuwNO6Tv3WykMDH6wUhe0Ll; Received: from 71-218-73-27.hlrn.qwest.net ([71.218.73.27]:52078 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1i7qjk-001p4a-WF; Tue, 10 Sep 2019 19:43:57 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Give a name to the TUI SingleKey keymap Date: Tue, 10 Sep 2019 18:43:52 -0600 Message-Id: <20190911004352.24819-1-tom@tromey.com> Readline 8.0 has a feature that lets an application name a keymap. This in turn makes it simpler for users to bind keys in keymaps in their .inputrc. This patch gives a name to the TUI SingleKey keymap, so that additional bindings can be made there. For example: $if gdb set keymap SingleKey "X": "echo hello\\n\n" $endif The call to rl_initialize, in tui_initialize_readline, had to be removed so that .inputrc was not read too early. Note that Readline explicitly documents that this call is not needed. gdb/ChangeLog 2019-09-10 Tom Tromey * tui/tui.c (tui_initialize_readline): Set name of keymap. Do not call rl_initialize. (tui_enable): Do not call rl_initialize. gdb/doc/ChangeLog 2019-09-10 Tom Tromey * gdb.texinfo (Editing): Document readline application name. (TUI Single Key Mode): Document TUI SingleKey keymap name. --- gdb/ChangeLog | 6 ++++++ gdb/doc/ChangeLog | 5 +++++ gdb/doc/gdb.texinfo | 6 ++++++ gdb/tui/tui.c | 9 ++++++--- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 53b7de91e47..5d82155a3b0 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -24975,6 +24975,9 @@ for more details about the Readline interface. Users unfamiliar with @sc{gnu} Emacs or @code{vi} are encouraged to read that chapter. +@value{GDBN} sets the Readline application name to @samp{gdb}. This +is useful for conditions in @file{.inputrc}. + @node Command History @section Command History @cindex command history @@ -27577,6 +27580,9 @@ with the TUI SingleKey mode. Once the command is entered the TUI SingleKey mode is restored. The only way to permanently leave this mode is by typing @kbd{q} or @kbd{C-x s}. +If @value{GDBN} was built with Readline 8.0 or later, the TUI +SingleKey keymap will be named @samp{SingleKey}. This can be used in +@file{.inputrc} to add additional bindings to this keymap. @node TUI Commands @section TUI-specific Commands diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c index db34e0c0441..5d6b9f32036 100644 --- a/gdb/tui/tui.c +++ b/gdb/tui/tui.c @@ -329,13 +329,17 @@ tui_initialize_readline (void) int i; Keymap tui_ctlx_keymap; - rl_initialize (); - rl_add_defun ("tui-switch-mode", tui_rl_switch_mode, -1); rl_add_defun ("gdb-command", tui_rl_command_key, -1); rl_add_defun ("next-keymap", tui_rl_next_keymap, -1); tui_keymap = rl_make_bare_keymap (); + + /* The named keymap feature was added in Readline 8.0. */ +#if RL_READLINE_VERSION >= 0x800 + rl_set_keymap_name ("SingleKey", tui_keymap); +#endif + tui_ctlx_keymap = rl_make_bare_keymap (); tui_readline_standard_keymap = rl_get_keymap (); @@ -467,7 +471,6 @@ tui_enable (void) nodelay(w, FALSE); nl(); keypad (w, TRUE); - rl_initialize (); tui_set_term_height_to (LINES); tui_set_term_width_to (COLS); def_prog_mode ();