summaryrefslogtreecommitdiff
path: root/pancake.el
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2017-11-05 13:36:57 +0300
committerdefanor <defanor@uberspace.net>2017-11-05 13:36:57 +0300
commit3f4c70e68bf7723192e8a3f1caa1f22b1d72a256 (patch)
tree7233794fc00941ef3e049c22795a28935f47e998 /pancake.el
parent1344f11abc7514c5d11b8b49fbd2337569c1cf0c (diff)
Provide current URI to pancake-mode
And add a command for displaying and copying it.
Diffstat (limited to 'pancake.el')
-rw-r--r--pancake.el13
1 files changed, 13 insertions, 0 deletions
diff --git a/pancake.el b/pancake.el
index 1119f20..61cb7c5 100644
--- a/pancake.el
+++ b/pancake.el
@@ -113,6 +113,10 @@
"Pancake browser process.")
(make-variable-buffer-local 'pancake-process)
+(defvar pancake-current-uri nil
+ "Current URI.")
+(make-variable-buffer-local 'pancake-current-uri)
+
;;###autoload
(defun pancake ()
"Run the pancake browser."
@@ -201,6 +205,7 @@
(delete-region (point-min) (point-max))
;; todo: maybe store identifiers and links for
;; further manipulation
+ (setq pancake-current-uri (alist-get 'uri alist))
(dolist (line (alist-get 'lines alist))
(insert (pancake-print-line line))
(newline))
@@ -271,6 +276,13 @@
(interactive)
(pancake-process-send "r"))
+(defun pancake-display-current-uri ()
+ "Display current URI and put it into the kill ring."
+ (interactive)
+ (when pancake-current-uri
+ (message "%s" pancake-current-uri)
+ (kill-new pancake-current-uri)))
+
(defun pancake-input (string)
"Pancake input handler: opens minibuffer for input.
Sets the initial contents to STRING, reads the rest, and passes
@@ -290,6 +302,7 @@ it to `pancake-process' as input."
(define-key map (kbd "C-y") 'pancake-yank)
(define-key map (kbd "<mouse-2>") 'pancake-yank-primary)
(define-key map (kbd "C-c C-c") 'pancake-interrupt)
+ (define-key map (kbd "C-c C-u") 'pancake-display-current-uri)
(define-key map (kbd "B") 'pancake-go-backward)
(define-key map (kbd "F") 'pancake-go-forward)
(define-key map (kbd "Q") 'pancake-quit)