emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/graphql-mode 301d2419a0 012/122: Prompt the user for the G


From: ELPA Syncer
Subject: [nongnu] elpa/graphql-mode 301d2419a0 012/122: Prompt the user for the GraphQL
Date: Sat, 29 Jan 2022 08:03:29 -0500 (EST)

branch: elpa/graphql-mode
commit 301d2419a012e8e7299e26b992a8aa4453ee1b3f
Author: David Vazquez Pua <davazp@gmail.com>
Commit: David Vazquez Pua <davazp@gmail.com>

    Prompt the user for the GraphQL
    
    If graphql-url is not set, prompt the user to set the value the first
    time that a query is about to be evaluated.
---
 graphql.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/graphql.el b/graphql.el
index d9b920e815..b4f031f074 100644
--- a/graphql.el
+++ b/graphql.el
@@ -29,8 +29,7 @@
 (require 'url)
 
 (defvar graphql-url
-  "http://graphql-swapi.parseapp.com";)
-
+  nil)
 
 (defun graphql--query (query)
   "Send QUERY to the server at `graphql-url' and return the
@@ -72,9 +71,11 @@ response from the server."
 
 (defun graphql-send-query ()
   (interactive)
+  (unless graphql-url
+    (setq graphql-url (read-string "GraphQL URL: " )))
   (let* ((query (graphql-current-query))
          (response (graphql--query query)))
-    (with-current-buffer-window
+     (with-current-buffer-window
      "*GraphQL*" 'display-buffer-pop-up-window nil
      (erase-buffer)
      (json-mode)
@@ -149,6 +150,7 @@ response from the server."
 
 (define-derived-mode graphql-mode prog-mode "GraphQL"
   ""
+  (make-variable-buffer-local 'graphql-url)
   (setq-local comment-start "# ")
   (setq-local comment-start-skip "#+[\t ]*")
   (setq-local indent-line-function 'graphql-indent-line)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]