[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/firefox-javascript-repl 5c47a29fd8 09/24: Remove newlin
From: |
Thomas Fitzsimmons |
Subject: |
[elpa] externals/firefox-javascript-repl 5c47a29fd8 09/24: Remove newlines before sending JavaScript |
Date: |
Thu, 1 Jun 2023 00:41:51 -0400 (EDT) |
branch: externals/firefox-javascript-repl
commit 5c47a29fd885d315c032bd44e6c3093e05723f50
Author: Thomas Fitzsimmons <fitzsim@fitzsim.org>
Commit: Thomas Fitzsimmons <fitzsim@fitzsim.org>
Remove newlines before sending JavaScript
* firefox-javascript-repl.el (fjrepl--input-sender): Remove
newlines before sending.
(fjrepl--extract-result): Parse more result types.
---
firefox-javascript-repl.el | 33 +++++++++++++++++++++------------
1 file changed, 21 insertions(+), 12 deletions(-)
diff --git a/firefox-javascript-repl.el b/firefox-javascript-repl.el
index e20602b772..5adacdb448 100644
--- a/firefox-javascript-repl.el
+++ b/firefox-javascript-repl.el
@@ -56,14 +56,18 @@ ARGUMENTS will be used for FORMAT, like `messages'."
(defun fjrepl--input-sender (process string)
"Send to PROCESS the STRING. Set `comint-input-sender' to this function."
- (process-send-string process (fjrepl--format-message
- ;; Do not use "eager": true, or stuff like
- ;; "alert('hello')" does not work.
- (concat "{\"type\":\"evaluateJSAsync\","
- "\"text\":\"%s\","
- "\"to\":\"%s\"}")
- (replace-regexp-in-string "\"" "\\\\\"" string)
- fjrepl--console-actor)))
+ (let ((send (substring-no-properties
+ (replace-regexp-in-string
+ "\n" " " (replace-regexp-in-string
+ "\"" "\\\\\"" string)))))
+ ;; (fjrepl--message "Sending %s" send)
+ (process-send-string process (fjrepl--format-message
+ ;; Do not use "eager": true, or stuff like
+ ;; "alert('hello')" does not work.
+ (concat "{\"type\":\"evaluateJSAsync\","
+ "\"text\":\"%s\","
+ "\"to\":\"%s\"}")
+ send fjrepl--console-actor))))
(defconst firefox-javascript-repl--directory
(file-name-directory load-file-name)
@@ -278,16 +282,21 @@ for output from any processes on which Emacs is waiting.."
"Filter the process NETWORK.
RESPONSE is a Firefox Debug Protocol message received from the
browser. Return the result of the JavaScript evaluation."
+ ;; (fjrepl--message "%S" response)
(let* ((result (with-temp-buffer
(insert response)
(fjrepl--get-result
(current-buffer) nil "result")))
- (parsed (and (hash-table-p result)
+ (parsed (and result (hash-table-p result)
(gethash "result" result)))
(string (and parsed
- (format "%s" (if (hash-table-p parsed)
- (gethash "type" parsed)
- parsed)))))
+ (format "%s"
+ (if (and parsed (hash-table-p parsed))
+ (let ((preview (gethash "preview" parsed)))
+ (if preview
+ (gethash "items" preview)
+ (gethash "type" parsed)))
+ (if parsed parsed ""))))))
(when string
(comint-output-filter network (concat string "\n" fjrepl--prompt)))))
- [elpa] externals/firefox-javascript-repl c2a0f7f44a 04/24: Get basic REPL working, (continued)
- [elpa] externals/firefox-javascript-repl c2a0f7f44a 04/24: Get basic REPL working, Thomas Fitzsimmons, 2023/06/01
- [elpa] externals/firefox-javascript-repl f0ed5fbf81 03/24: Get ready for asynchronous JavaScript evaluation, Thomas Fitzsimmons, 2023/06/01
- [elpa] externals/firefox-javascript-repl 77c9907e3e 18/24: Move usage to start of commentary, Thomas Fitzsimmons, 2023/06/01
- [elpa] externals/firefox-javascript-repl 1e0638d411 17/24: Mention throwaway profile in commentary, Thomas Fitzsimmons, 2023/06/01
- [elpa] externals/firefox-javascript-repl 7b288e2dba 24/24: Bump version to 0.9.0, Thomas Fitzsimmons, 2023/06/01
- [elpa] externals/firefox-javascript-repl 7bed24ae8e 23/24: Ignore errors when showing quirk, Thomas Fitzsimmons, 2023/06/01
- [elpa] externals/firefox-javascript-repl b0695f591d 02/24: Complete actor retrieval, Thomas Fitzsimmons, 2023/06/01
- [elpa] externals/firefox-javascript-repl 3d5c11b468 05/24: Add .gitignore file, Thomas Fitzsimmons, 2023/06/01
- [elpa] externals/firefox-javascript-repl 563ae0984c 01/24: firefox-javascript-repl: New package, Thomas Fitzsimmons, 2023/06/01
- [elpa] externals/firefox-javascript-repl 9644f919dd 06/24: Fix string quoting, Thomas Fitzsimmons, 2023/06/01
- [elpa] externals/firefox-javascript-repl 5c47a29fd8 09/24: Remove newlines before sending JavaScript,
Thomas Fitzsimmons <=
- [elpa] externals/firefox-javascript-repl b4186a5762 12/24: Backport to Emacs 26.1, Thomas Fitzsimmons, 2023/06/01
- [elpa] externals/firefox-javascript-repl 876dcb4615 13/24: Add Package-Requires, Thomas Fitzsimmons, 2023/06/01
- [elpa] externals/firefox-javascript-repl aaefd1f8f4 14/24: Add jss URL to commentary, Thomas Fitzsimmons, 2023/06/01
- [elpa] externals/firefox-javascript-repl c35e324539 16/24: Refer to Firefox Debugging Remote Protocol, Thomas Fitzsimmons, 2023/06/01
- [elpa] externals/firefox-javascript-repl 76ba08cb86 19/24: Trim some messages, Thomas Fitzsimmons, 2023/06/01
- [elpa] externals/firefox-javascript-repl 9208c234cb 20/24: Fix kill-buffer-hook for Emacs 26.1, Thomas Fitzsimmons, 2023/06/01
- [elpa] externals/firefox-javascript-repl 976f04d340 21/24: Pass process object to kill-process, Thomas Fitzsimmons, 2023/06/01