[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/idris-mode 7ba6e9b6ab 04/10: Preserve current source code
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/idris-mode 7ba6e9b6ab 04/10: Preserve current source code buffer as current when receiving input from Idris compiler |
Date: |
Mon, 23 Jan 2023 04:59:56 -0500 (EST) |
branch: elpa/idris-mode
commit 7ba6e9b6abb0ba605d5d008a612f2c1cf4affb3a
Author: Marek L <nospam.keram@gmail.com>
Commit: Marek L <nospam.keram@gmail.com>
Preserve current source code buffer as current when receiving input from
Idris compiler
Why:
Allows processing event hooks relatively to the current source code buffer.
---
inferior-idris.el | 47 +++++++++++++++++++++++------------------------
1 file changed, 23 insertions(+), 24 deletions(-)
diff --git a/inferior-idris.el b/inferior-idris.el
index b54f52de5e..0901d74878 100644
--- a/inferior-idris.el
+++ b/inferior-idris.el
@@ -159,31 +159,30 @@ This is maintained to restart Idris when the arguments
change.")
(defun idris-connection-available-input (process)
"Process all complete messages which arrived from Idris PROCESS."
+ (while (idris-have-input-p process)
+ (let ((event (idris-receive process)))
+ (idris-event-log event nil)
+ (idris-dispatch-event event process))))
+
+(defun idris-have-input-p (process)
+ "Return `true' if a complete message is available in PROCESS buffer."
+ (with-current-buffer (process-buffer process)
+ (goto-char (point-min))
+ (and (>= (buffer-size) 6)
+ (>= (- (buffer-size) 6) (idris-decode-length)))))
+
+(defun idris-receive (process)
+ "Read a message from the Idris PROCESS."
(with-current-buffer (process-buffer process)
- (while (idris-have-input-p)
- (let ((event (idris-receive)))
- (idris-event-log event nil)
- (unwind-protect
- (save-current-buffer
- (idris-dispatch-event event process)))))))
-
-(defun idris-have-input-p ()
- "Return true if a complete message is available."
- (goto-char (point-min))
- (and (>= (buffer-size) 6)
- (>= (- (buffer-size) 6) (idris-decode-length))))
-
-(defun idris-receive ()
- "Read a message from the Idris process."
- (goto-char (point-min))
- (let* ((length (idris-decode-length))
- (start (+ 6 (point)))
- (end (+ start length)))
- (cl-assert (cl-plusp length))
- (prog1 (save-restriction
- (narrow-to-region start end)
- (read (current-buffer)))
- (delete-region (point-min) end))))
+ (goto-char (point-min))
+ (let* ((length (idris-decode-length))
+ (start (+ 6 (point)))
+ (end (+ start length)))
+ (cl-assert (cl-plusp length))
+ (prog1 (save-restriction
+ (narrow-to-region start end)
+ (read (current-buffer)))
+ (delete-region (point-min) end)))))
(defun idris-decode-length ()
"Read a 24-bit hex-encoded integer from buffer."
- [nongnu] elpa/idris-mode updated (7a7a468000 -> 3f529d72cd), ELPA Syncer, 2023/01/23
- [nongnu] elpa/idris-mode 7ba6e9b6ab 04/10: Preserve current source code buffer as current when receiving input from Idris compiler,
ELPA Syncer <=
- [nongnu] elpa/idris-mode 3cce2336b7 01/10: Allow per buffer and project controlled semantic source highlighting, ELPA Syncer, 2023/01/23
- [nongnu] elpa/idris-mode 4cbe153905 03/10: Move definition of *-words-of-encouragement to idris-repl.el, ELPA Syncer, 2023/01/23
- [nongnu] elpa/idris-mode 3f529d72cd 10/10: Merge pull request #601 from keram/impro-sem-high, ELPA Syncer, 2023/01/23
- [nongnu] elpa/idris-mode 03e6cdfe41 09/10: Merge pull request #612 from keram/code-impro5, ELPA Syncer, 2023/01/23
- [nongnu] elpa/idris-mode d01b47c972 06/10: Apply minor documentation improvements, ELPA Syncer, 2023/01/23
- [nongnu] elpa/idris-mode 1451b8ffa3 05/10: Improve documentation in inferior-idris.el, ELPA Syncer, 2023/01/23
- [nongnu] elpa/idris-mode 5c6e255b92 07/10: Replace obsolete `interactive-p` function in idris-navigate.el and, ELPA Syncer, 2023/01/23
- [nongnu] elpa/idris-mode cf69a2c921 02/10: Simplify and improve semantic source highlighting code by:, ELPA Syncer, 2023/01/23
- [nongnu] elpa/idris-mode 86ec653651 08/10: Improve documentation for idris-log.el, ELPA Syncer, 2023/01/23