summaryrefslogtreecommitdiff
path: root/pancake.el
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2017-11-09 00:35:04 +0300
committerdefanor <defanor@uberspace.net>2017-11-09 00:35:04 +0300
commit074ac6af53c750039f6b32d6fb8ba0371fa4771d (patch)
treef604e0a18daf6c9815434b95156a189af88af2eb /pancake.el
parentcb07ecb166d47be2ac7915f0e8605f970ba35532 (diff)
pancake.el: prompt for input on RET
This is useful mostly for backward search. Also ignore empty lines in embedded mode in pancake itself, and add a "pancake>" prompt.
Diffstat (limited to 'pancake.el')
-rw-r--r--pancake.el9
1 files changed, 8 insertions, 1 deletions
diff --git a/pancake.el b/pancake.el
index f98867c..4614749 100644
--- a/pancake.el
+++ b/pancake.el
@@ -346,13 +346,19 @@
(when line
(goto-line line))))
+(defun pancake-prompt (&optional string)
+ "Prompts for input, passes it to `pancake-process'. Similar to
+`pancake-input', but runs immediately."
+ (interactive)
+ (pancake-process-send (read-from-minibuffer "pancake> " string)))
+
(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)
- (pancake-process-send (read-from-minibuffer "" string))))
+ (pancake-prompt string)))
(defvar pancake-mode-map
(let ((map (make-sparse-keymap))
@@ -368,6 +374,7 @@ it to `pancake-process' as input."
(define-key map (kbd "<mouse-9>") 'pancake-go-forward)
(define-key map (kbd "TAB") 'pancake-next-button)
(define-key map (kbd "<backtab>") 'pancake-previous-button)
+ (define-key map (kbd "RET") 'pancake-prompt)
(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 "C-M-e") 'pancake-next-heading)