-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show inline results using overlays, instead of just the minibuffer.
- Loading branch information
Showing
1 changed file
with
18 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
|
||
;; Author: Marshall Lochbaum <[email protected]> | ||
;; Version: 0.1.0 | ||
;; Package-Requires: ((emacs "26.1")) | ||
;; Package-Requires: ((emacs "26.1") (eros "0.1.0")) | ||
;; URL: https://github.com/museoa/bqn-mode | ||
;; SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
|
@@ -304,6 +304,15 @@ BQN buffers (or recreate them)." | |
:type 'boolean | ||
:group 'bqn) | ||
|
||
(defcustom bqn-comint-use-overlay nil | ||
"Should BQN use overlays for all `bqn-comint-eval-*' style functions? | ||
If this is nil, print the result in the minibuffer instead." | ||
:type 'boolean | ||
:group 'bqn | ||
:set (lambda (sym val) | ||
(when val (require 'eros)) | ||
(set-default-toplevel-value sym val))) | ||
|
||
;;;###autoload | ||
(defun bqn-comint-buffer () | ||
"Run an inferior BQN process inside Emacs and return its buffer." | ||
|
@@ -413,9 +422,14 @@ bqn-comint-process-session and echoes the result." | |
(error "Attempt to evaluate empty region to %s" bqn-comint--process-name)) | ||
(when (and bqn-comint-flash-on-send (pulse-available-p)) | ||
(pulse-momentary-highlight-region start end)) | ||
(let ((region (buffer-substring-no-properties start end)) | ||
(process (get-buffer-process (bqn-comint-buffer)))) | ||
(message "%s" (bqn--comint-call-process-silently process region)))) | ||
(let* ((region (buffer-substring-no-properties start end)) | ||
(process (get-buffer-process (bqn-comint-buffer))) | ||
(response (bqn--comint-call-process-silently process region))) | ||
(if bqn-comint-use-overlay | ||
(eros--make-result-overlay response | ||
:where end | ||
:duration eros-eval-result-duration) | ||
(message "%s" response)))) | ||
|
||
(defun bqn-comint-eval-dwim () | ||
"Evaluate the active region or the current line, displaying the result." | ||
|