summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2017-10-28 07:30:27 +0300
committerdefanor <defanor@uberspace.net>2017-10-28 07:34:03 +0300
commit619015bbe0dc2596e92ba6897d844b5324452aaa (patch)
treedf7e7d3b1d2ec585bd39a061093c8437fab6730c
parent28a215207cd63f9bd2f21a1564ea7c9d8ab46f92 (diff)
Add backward/forward/quit pancake-mode commands
Now it is easier to quickly go through the history.
-rw-r--r--README.org7
-rw-r--r--pancake.el26
2 files changed, 28 insertions, 5 deletions
diff --git a/README.org b/README.org
index 5688f0a..d3946f2 100644
--- a/README.org
+++ b/README.org
@@ -6,8 +6,8 @@ external applications (e.g., image and PDF viewers) depending on its
configuration.
User interaction capabilities are rather basic, as it is intended to
-normally be combined with software that provides better user
-interfaces -- such as emacs, rlwrap, tmux, screen.
+be combined with software that provides better user interfaces -- such
+as emacs, rlwrap, tmux, screen.
* Commands
@@ -20,6 +20,9 @@ interfaces -- such as emacs, rlwrap, tmux, screen.
- <shortcut> <query>: run a query using a shortcut defined in the
configuration (e.g., search)
+pancake-mode provides additional aliases, see built-in emacs
+documentation (~C-h m~) for those.
+
* Sample configuration
#+BEGIN_SRC yaml
diff --git a/pancake.el b/pancake.el
index 57cb848..af6bf6f 100644
--- a/pancake.el
+++ b/pancake.el
@@ -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'.")