unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Narendra Joshi <narendraj9@gmail.com>
To: Christian Seberino <cseberino@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: trouble overwriting C-r in a shell (term-mode)
Date: Thu, 28 May 2020 22:35:09 +0200	[thread overview]
Message-ID: <87imgflrwi.fsf@gmail.com> (raw)
In-Reply-To: <CAG5-5iJR8G75Wmoju18s=oSTsFkiT5EMPC6bPp9-jQaCNCuAGA@mail.gmail.com> (Christian Seberino's message of "Thu, 28 May 2020 11:30:41 -0500")

Christian Seberino <cseberino@gmail.com> writes:

> I'm trying to overwrite C-r in a shell and it isn't working.
> Any help greatly appreciated.  I tried adding a term-mode hook as
> follows....
>
> (add-hook 'term-mode-hook
>           '(lambda () (interactive)
>                    (global-set-key (kbd "C-r")
>                                    (lambda () (interactive)
>                                               (if (get-buffer  "*Open
> Recent*")
>                                                   (kill-buffer "*Open
> Recent*"))
>                                               (recentf-open-files)))))

You can bind "C-r" in the keymap `term-raw-map' to the function: 
--8<---------------cut here---------------start------------->8---
(define-key term-raw-map (kbd "C-r") (lambda () (interactive)
                                       (if (get-buffer  "*Open Recent*")
                                           (kill-buffer "*Open Recent*"))
                                       (recentf-open-files)))
--8<---------------cut here---------------end--------------->8---

When `term-char-mode' is on, `term-raw-map' is activated as the local
map of the term buffer.


> Thanks!
>
> Chris

Best,
-- 
Narendra Joshi



  reply	other threads:[~2020-05-28 20:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-28 16:30 trouble overwriting C-r in a shell (term-mode) Christian Seberino
2020-05-28 20:35 ` Narendra Joshi [this message]
2020-05-28 21:31   ` Christian Seberino
2020-05-28 22:42   ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-05-29  9:09     ` Jamie Beardslee

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87imgflrwi.fsf@gmail.com \
    --to=narendraj9@gmail.com \
    --cc=cseberino@gmail.com \
    --cc=help-gnu-emacs@gnu.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).