[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: trouble overwriting C-r in a shell (term-mode)

From: Jamie Beardslee
Subject: Re: trouble overwriting C-r in a shell (term-mode)
Date: Fri, 29 May 2020 21:09:03 +1200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> Style points:
>   "\C-r" instead of (kbd "C-r")
>   `let' so the hard-coded data item "*Open Recent*"
>   appears onee time
>   `when' instead of `if' as there is no else branch

Even more style points:

- don't bind a key to an anonymous function
- buffer name is dependent on `recentf-menu-title'
- use an informative docstring

(defun my-recentf-open-files ()
  "blah blah blah"
  (let ((buffer (get-buffer (format "*%s*" recentf-menu-title))))
    (when buffer
      (kill-buffer buffer))

(define-key term-raw-map (kbd "C-r") #'my-recentf-open-files)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]