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?p=elpher.git;a=commitdiff_plain;h=7744ebb7832b7264d2eada6aa03b1059ec5f54ff 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 fbcad2b..67eb790 100644 --- a/elpher.el +++ b/elpher.el @@ -2045,6 +2045,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) @@ -2188,6 +2189,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 ()