[clfswm-cvs] [clfswm-git]CLFSWM - A(nother) Common Lisp FullScreen Window Manager branch test updated. R-1106-68-gb3cad6b
Philippe Brochard
pbrochard at common-lisp.net
Wed Jun 27 20:58:56 UTC 2012
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CLFSWM - A(nother) Common Lisp FullScreen Window Manager".
The branch, test has been updated
via b3cad6b22ce3f9fb00baf8c3fdd2e815ac8e9742 (commit)
from d220157eba933213ce9f590858bad32599b30223 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit b3cad6b22ce3f9fb00baf8c3fdd2e815ac8e9742
Author: Philippe Brochard <pbrochard at common-lisp.net>
Date: Wed Jun 27 22:58:50 2012 +0200
src/clfswm-util.lisp (eval-from-query-string): Add completion for eval for query string.
diff --git a/ChangeLog b/ChangeLog
index c0af3cb..adee0cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-06-27 Philippe Brochard <pbrochard at common-lisp.net>
+
+ * src/clfswm-util.lisp (eval-from-query-string): Add completion
+ for eval for query string.
+
2012-06-26 Philippe Brochard <pbrochard at common-lisp.net>
* src/clfswm-query.lisp: Add completion for shell commands.
diff --git a/src/clfswm-util.lisp b/src/clfswm-util.lisp
index 0799231..9feb0b3 100644
--- a/src/clfswm-util.lisp
+++ b/src/clfswm-util.lisp
@@ -540,24 +540,34 @@
-(defun eval-from-query-string ()
- "Eval a lisp form from the query input"
- (let ((form (query-string (format nil "Eval Lisp - ~A" (package-name *package*))))
- (result nil))
- (when (and form (not (equal form "")))
- (let ((printed-result
- (with-output-to-string (*standard-output*)
- (setf result (handler-case
- (loop for i in (multiple-value-list
- (eval (read-from-string form)))
- collect (format nil "~S" i))
- (error (condition)
- (format nil "~A" condition)))))))
- (info-mode (expand-newline (append (ensure-list (format nil "> ~A" form))
- (ensure-list printed-result)
- (ensure-list result)))
- :width (- (xlib:screen-width *screen*) 2))
- (eval-from-query-string)))))
+(let ((all-symbols (collect-all-symbols)))
+ (defun eval-from-query-string ()
+ "Eval a lisp form from the query input"
+ (let ((form (query-string (format nil "Eval Lisp <~A> " (package-name *package*))
+ "" all-symbols))
+ (result nil))
+ (when (and form (not (equal form "")))
+ (let ((printed-result
+ (with-output-to-string (*standard-output*)
+ (setf result (handler-case
+ (loop for i in (multiple-value-list
+ (eval (read-from-string form)))
+ collect (format nil "~S" i))
+ (error (condition)
+ (format nil "~A" condition)))))))
+ (let ((ret (info-mode (expand-newline (append (ensure-list (format nil "> ~A" form))
+ (ensure-list printed-result)
+ (ensure-list result)))
+ :width (- (xlib:screen-width *screen*) 2))))
+ (when (or (search "defparameter" form :test #'string-equal)
+ (search "defvar" form :test #'string-equal))
+ (let ((elem (split-string form)))
+ (pushnew (string-downcase (if (string= (first elem) "(") (third elem) (second elem)))
+ all-symbols :test #'string=)))
+ (when (search "in-package" form :test #'string-equal)
+ (setf all-symbols (collect-all-symbols)))
+ (when ret
+ (eval-from-query-string))))))))
diff --git a/src/config.lisp b/src/config.lisp
index f031790..e651c4b 100644
--- a/src/config.lisp
+++ b/src/config.lisp
@@ -259,7 +259,7 @@ on the root window in the main mode with the mouse")
'Query-string "Query string window background transparency")
(defconfig *query-max-complet-length* 100
'Query-string "Query maximum length of completion list")
-(defconfig *query-min-complet-char* 1
+(defconfig *query-min-complet-char* 2
'Query-string "Query minimum input length for completion")
diff --git a/src/tools.lisp b/src/tools.lisp
index 3759afd..d7e6346 100644
--- a/src/tools.lisp
+++ b/src/tools.lisp
@@ -56,6 +56,7 @@
:dbgnl
:dbgc
:distance
+ :collect-all-symbols
:with-all-internal-symbols
:export-all-functions :export-all-variables
:export-all-functions-and-variables
@@ -383,6 +384,19 @@ Return the result of the last hook"
;;; Symbols tools
+(defun collect-all-symbols (&optional package)
+ (format t "Collecting all symbols for completion...")
+ (let (all-symbols)
+ (do-symbols (symbol (or package *package*))
+ (pushnew (string-downcase (symbol-name symbol)) all-symbols :test #'string=))
+ (do-symbols (symbol :keyword)
+ (pushnew (concatenate 'string ":" (string-downcase (symbol-name symbol)))
+ all-symbols :test #'string=))
+ (format t " Done.~%")
+ all-symbols))
+
+
+
(defmacro with-all-internal-symbols ((var package) &body body)
"Bind symbol to all internal symbols in package"
`(do-symbols (,var ,package)
@@ -525,7 +539,11 @@ Return the result of the last hook"
(eq char #\-)
(eq char #\_)
(eq char #\.)
- (eq char #\+)))
+ (eq char #\+)
+ (eq char #\=)
+ (eq char #\*)
+ (eq char #\:)
+ (eq char #\%)))
(defun append-newline-space (string)
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 5 +++++
src/clfswm-util.lisp | 46 ++++++++++++++++++++++++++++------------------
src/config.lisp | 2 +-
src/tools.lisp | 20 +++++++++++++++++++-
4 files changed, 53 insertions(+), 20 deletions(-)
hooks/post-receive
--
CLFSWM - A(nother) Common Lisp FullScreen Window Manager
More information about the clfswm-cvs
mailing list