[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: trouble overwriting C-r in a shell (term-mode)
From: |
Narendra Joshi |
Subject: |
Re: trouble overwriting C-r in a shell (term-mode) |
Date: |
Thu, 28 May 2020 22:35:09 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
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