diff options
author | defanor <defanor@uberspace.net> | 2017-10-28 07:30:27 +0300 |
---|---|---|
committer | defanor <defanor@uberspace.net> | 2017-10-28 07:34:03 +0300 |
commit | 619015bbe0dc2596e92ba6897d844b5324452aaa (patch) | |
tree | df7e7d3b1d2ec585bd39a061093c8437fab6730c /pancake.el | |
parent | 28a215207cd63f9bd2f21a1564ea7c9d8ab46f92 (diff) |
Add backward/forward/quit pancake-mode commands
Now it is easier to quickly go through the history.
Diffstat (limited to 'pancake.el')
-rw-r--r-- | pancake.el | 26 |
1 files changed, 23 insertions, 3 deletions
@@ -250,15 +250,32 @@ (interactive) (funcall (pancake-input (gui-get-primary-selection)))) +(defun pancake-process-send (line) + "Send LINE to the pancake process." + (process-send-string pancake-process (concat line "\n"))) + +(defun pancake-go-backward () + "Go backward in history." + (interactive) + (pancake-process-send "b")) + +(defun pancake-go-forward () + "Go forward in history." + (interactive) + (pancake-process-send "f")) + +(defun pancake-quit () + "Quit pancake." + (interactive) + (pancake-process-send "q")) + (defun pancake-input (string) "Pancake input handler: opens minibuffer for input. Sets the initial contents to STRING, reads the rest, and passes it to `pancake-process' as input." (lambda () (interactive) - (process-send-string - pancake-process - (concat (read-from-minibuffer "" string) "\n")))) + (pancake-process-send (read-from-minibuffer "" string)))) (defvar pancake-mode-map (let ((map (make-sparse-keymap)) @@ -271,6 +288,9 @@ 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 "B") 'pancake-go-backward) + (define-key map (kbd "F") 'pancake-go-forward) + (define-key map (kbd "Q") 'pancake-quit) map) "Keymap for `pancake-mode'.") |