From 148692382496d454be247352a88c6ed4497f2d31 Mon Sep 17 00:00:00 2001 From: daimrod Date: Mon, 30 Jan 2012 09:11:50 +0100 Subject: [PATCH 1/5] Use #' instead of ' in DEFREADTABLE. --- clesh.lisp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/clesh.lisp b/clesh.lisp index 7fba2ba..f87c39b 100644 --- a/clesh.lisp +++ b/clesh.lisp @@ -218,8 +218,8 @@ Throws an error if the list does not contain exactly one argument." (defreadtable clesh:syntax (:merge :standard) - (:macro-char #\! 'simple-shell-escape-reader nil) - (:macro-char #\[ 'embedded-shell-escape-reader nil) + (:macro-char #\! #'simple-shell-escape-reader nil) + (:macro-char #\[ #'embedded-shell-escape-reader nil) ;; Ignore closing brackets when reading them (:macro-char #\] #'(lambda (stream char) (declare (ignore stream char)) @@ -227,6 +227,6 @@ Throws an error if the list does not contain exactly one argument." (:macro-char #\} #'(lambda (stream char) (declare (ignore stream char)) (values))) - (:dispatch-macro-char #\# #\[ 'template-escape-reader) - (:dispatch-macro-char #\# #\{ 'storable-template-escape-reader)) + (:dispatch-macro-char #\# #\[ #'template-escape-reader) + (:dispatch-macro-char #\# #\{ #'storable-template-escape-reader)) From 7c927ee58518354b3bfab3114e5530da6b73ca83 Mon Sep 17 00:00:00 2001 From: daimrod Date: Thu, 26 Jan 2012 21:47:21 +0100 Subject: [PATCH 2/5] Make a seperated package for clesh-tests --- clesh-tests.lisp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/clesh-tests.lisp b/clesh-tests.lisp index 6ea9e95..1b5a222 100644 --- a/clesh-tests.lisp +++ b/clesh-tests.lisp @@ -1,7 +1,11 @@ -(in-package clesh) +(defpackage #:clesh-tests + (:use #:cl + #:clesh + #:lisp-unit) + (:import-from #:clesh + #:read-interpolated-string)) -(eval-when (:compile-toplevel :load-toplevel) - (use-package 'lisp-unit)) +(in-package #:clesh-tests) (define-test read-interpolated-string (assert-equal From 419a208ff361113f86c53a0995779cb2f20ccbdd Mon Sep 17 00:00:00 2001 From: daimrod Date: Thu, 26 Jan 2012 21:53:01 +0100 Subject: [PATCH 3/5] Fixed docstring --- clesh-tests.asd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clesh-tests.asd b/clesh-tests.asd index 5b439ee..0e660d1 100644 --- a/clesh-tests.asd +++ b/clesh-tests.asd @@ -8,4 +8,4 @@ :description ("Unit tests for clesn To run the tests, load this package and -evaluate (lisp-unit:run-all-tests clesh)")) \ No newline at end of file +evaluate (lisp-unit:run-all-tests clesh-tests)")) From 02a36e52919174b44c883a4b5f804f7c150b992a Mon Sep 17 00:00:00 2001 From: daimrod Date: Fri, 27 Jan 2012 23:08:33 +0100 Subject: [PATCH 4/5] Revert "Fix bug: Bang did not correctly remove newlines from escaped newlines." This reverts commit ff23489b000cf0a471db6534f65fe3f345afac00. --- clesh.lisp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/clesh.lisp b/clesh.lisp index f87c39b..a35f751 100644 --- a/clesh.lisp +++ b/clesh.lisp @@ -185,19 +185,9 @@ will be read as (\"asd foo \" (+ 2 2) \" bar \" (+ 3 3))." (return-from enter-shell-mode)) (princ (script ll))))) -(defun the-only (list) - "Returns the first element of a list. - -Throws an error if the list does not contain exactly one argument." - (if (or (endp list) (not (endp (cdr list)))) - (error "~A has not exactly one element." list) - (car list))) - (defun simple-shell-escape-reader (stream char) (declare (ignore char)) - (let* ((ll - (delete #\Newline - (the-only (read-interpolated-string stream #\Newline nil t))))) + (let ((ll (apply #'concatenate 'string (read-interpolated-string stream #\Newline nil t)))) (when (and (> (length ll) 0) (string= (subseq ll 0 1) "!")) (enter-shell-mode stream) (return-from simple-shell-escape-reader)) From 76dacf589f0acce66c93f11450099c066c2b3d70 Mon Sep 17 00:00:00 2001 From: daimrod Date: Sat, 28 Jan 2012 00:24:57 +0100 Subject: [PATCH 5/5] Revert "Update README to include multiline bang." This reverts commit 79340f4b42309144bf4357556267d270858dd043. --- README.md | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index fdfa1c1..cdfc296 100644 --- a/README.md +++ b/README.md @@ -56,15 +56,9 @@ Provided that you already entered the factorial definition above. You may escape the '`?`' with a '`\`' to have it transfered to the shell command. for example: - * !echo \?\(+ 2 3\) ?(+ 2 3) 4 - -You can also use the escape for multiple lines. Just escape the -newline with a backslash. The newlines will then be ignored, like -this: - - *!echo foo\ bar\ baz - -will output `foo bar baz`. + * !echo \?\(+ 2 3\) + ?(+ 2 3) + 4 ### Embedded shell scripts @@ -222,4 +216,4 @@ parsed at read time and prepared to be executed at runtime. In the 'bang' forms only simple shell commands can be issued as the reader does not detect the circumstances when a construct (such as ca '`case`') occupies more than one line. In the embedded form or with -the script command, any script can be executed. \ No newline at end of file +the script command, any script can be executed.