From: Alex Schroeder Date: Mon, 27 Jul 2020 10:46:12 +0000 (+0200) Subject: Add c binding to the Elpher menu X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;h=efc8842a4afee1a45439eb2458a4694a008e644e;p=elpher.git Add c binding to the Elpher menu I'm starting to think that maybe the Elpher menu should be using Elpher mode? I wonder. For now, I sometimes use C-u M-x elpher-menu to get a history of all my browsing and then I want to quickly copy the URLs for pasting elsewhere, so the c binding is pretty essential. --- diff --git a/elpher.el b/elpher.el index cd9869c..ea20525 100644 --- a/elpher.el +++ b/elpher.el @@ -2047,6 +2047,7 @@ With an optional argument, add all the history items, too." (define-key map "\C-m" 'elpher-menu-this-window) (define-key map "o" 'elpher-menu-other-window) (define-key map "\C-o" 'elpher-menu-switch-other-window) + (define-key map "c" 'elpher-menu-copy-current-url) (define-key map "d" 'Buffer-menu-delete) (define-key map "k" 'Buffer-menu-delete) (define-key map "\C-k" 'Buffer-menu-delete) @@ -2190,6 +2191,23 @@ and apply FUNC to ARGS." (t (error "There's no entry on this line of the menu"))))) +(defun elpher-menu-copy-current-url () + "Copy the URL of the current menu item." + (interactive) + (let ((data (tabulated-list-get-id))) + (cond ((bufferp data) + (with-current-buffer data + (elpher-copy-page-url elpher-current-page))) + ((listp data) + (elpher-copy-page-url (nth 2 data))) + (t + (error "There's no entry on this line of the menu"))))) + + (defun elpher-copy-current-url () + "Copy URL of current page to `kill-ring'." + (interactive) + (elpher-copy-page-url elpher-current-page)) + (defvar elpher-title nil) (defun elpher-find-title ()