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

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

[nongnu] elpa/proof-general 774cb5f45d 1/2: Handle single-quotes in argu


From: ELPA Syncer
Subject: [nongnu] elpa/proof-general 774cb5f45d 1/2: Handle single-quotes in arguments to `-arg`
Date: Wed, 25 May 2022 06:58:41 -0400 (EDT)

branch: elpa/proof-general
commit 774cb5f45d89332ef0db7651c6f41cb9a03a455b
Author: Columbus240 <8899730+Columbus240@users.noreply.github.com>
Commit: Columbus240 <8899730+Columbus240@users.noreply.github.com>

    Handle single-quotes in arguments to `-arg`
    
    A solution sketch to issue #589.
    
    coq_makefile parses _CoqProject files in a slightly weird way. If we
    write `-arg "a b"` in _CoqProject then it passes the arguments `a` and
    `b` to coqc, but if we write `-arg "'a b'"` it passes `a b` to coqc, as
    a single argument.
    This commit tries to adapt to this behavior.
---
 coq/coq-system.el | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/coq/coq-system.el b/coq/coq-system.el
index 804831dac6..9c768aa18f 100644
--- a/coq/coq-system.el
+++ b/coq/coq-system.el
@@ -123,7 +123,6 @@ This function supports calling coqtop via tramp."
           (if (or (not expectedretv) (equal retv expectedretv))
               (buffer-string)))
       (error nil))))
-        
 
 (defun coq-autodetect-version (&optional interactive-p)
   "Detect and record the version of Coq currently in use.
@@ -554,16 +553,18 @@ Returns a mixed list of option-value pairs and strings."
 OPTIONS is a list or conses (switch . argument) and strings.
 Note that the semantics of the -arg flags in coq project files
 are weird: -arg \"a b\" means pass a and b, separately, to
-coqtop."
+coqtop. But -arg \"'a b'\" means to pass a and b together."
   (let ((args nil))
     (dolist (opt options)
       (pcase opt
         ((or "-byte" "-op")
          (push opt args))
         (`("-arg" ,concatenated-args)
-         (setq args
-               (append args
-                       (split-string-and-unquote concatenated-args 
coq--project-file-separator))))))
+        (if (and (string-prefix-p "'" concatenated-args) (string-suffix-p "'" 
concatenated-args))
+            (setq args (append args (list (substring concatenated-args 1 -1))))
+           (setq args
+                (append args
+                        (split-string-and-unquote concatenated-args 
coq--project-file-separator)))))))
     (cons "-emacs" args)))
 
 (defun coq--extract-load-path-1 (option base-directory)



reply via email to

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