Skip to content

Commit

Permalink
Replaced tabs with spaces in all .lisp and .asd files
Browse files Browse the repository at this point in the history
  • Loading branch information
html committed Oct 18, 2013
1 parent 4fcacc0 commit a1097b5
Show file tree
Hide file tree
Showing 251 changed files with 8,180 additions and 8,180 deletions.
4 changes: 2 additions & 2 deletions contrib/lpolzer/form-widget.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
render-form-controls
find-field-widget-by-name
form-value
with-form-values
with-form-values
handle-form-submission

field-widget
Expand Down Expand Up @@ -123,7 +123,7 @@

(defmacro with-form-values ((&rest names) form &body body)
`(let ,(loop for name in names
collect `(,name (form-value ,form ',name)))
collect `(,name (form-value ,form ',name)))
,@body))

(defmethod render-confirmation ((widget form-widget))
Expand Down
88 changes: 44 additions & 44 deletions contrib/lpolzer/html-diff/diff-sexp.lisp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
;;; diff-sexp.lisp -- diffs s-expressions based on Levenshtein-like edit distance.

;; Author: Michael Weber <michaelw@foldr.org>
;; Date: 2005-09-03
;; Modified: 2005-09-04
;; Modified: 2005-09-07
;; Modified: 2005-09-15
;; Author: Michael Weber <michaelw@foldr.org>
;; Date: 2005-09-03
;; Modified: 2005-09-04
;; Modified: 2005-09-07
;; Modified: 2005-09-15
;;
;; This code is in the Public Domain.

Expand All @@ -17,16 +17,16 @@
;;; Examples:

;; DIFF-SEXP> (diff-sexp
;; '(DEFUN F (X) (+ (* X 2) 1))
;; '(DEFUN F (X) (- (* X 2) 3 1)))
;; '(DEFUN F (X) (+ (* X 2) 1))
;; '(DEFUN F (X) (- (* X 2) 3 1)))
;; ((DEFUN F (X) (|#-new| + |#+new| - (* X 2) |#+new| 3 1)))
;; DIFF-SEXP> (diff-sexp
;; '(DEFUN F (X) (+ (* X 2) 4 1))
;; '(DEFUN F (X) (- (* X 2) 5 3 1)))
;; '(DEFUN F (X) (+ (* X 2) 4 1))
;; '(DEFUN F (X) (- (* X 2) 5 3 1)))
;; ((DEFUN F (X) (|#-new| + |#+new| - (* X 2) |#-new| 4 |#+new| 5 |#+new| 3 1)))
;; DIFF-SEXP> (diff-sexp
;; '(DEFUN F (X) (+ (* X 2) 4 4 1))
;; '(DEFUN F (X) (- (* X 2) 5 5 3 1)))
;; '(DEFUN F (X) (+ (* X 2) 4 4 1))
;; '(DEFUN F (X) (- (* X 2) 5 5 3 1)))
;; ((DEFUN F (X) |#-new| (+ (* X 2) 4 4 1) |#+new| (- (* X 2) 5 5 3 1)))
;; DIFF-SEXP>

Expand Down Expand Up @@ -83,24 +83,24 @@

(defmethod initialize-instance :after ((record deletion-record) &key)
(setf (slot-value record 'edit-distance)
(1+ (tree-size (slot-value record 'change)))))
(1+ (tree-size (slot-value record 'change)))))

(defmethod initialize-instance :after ((record insertion-record) &key)
(setf (slot-value record 'edit-distance)
(1+ (tree-size (slot-value record 'change)))))
(1+ (tree-size (slot-value record 'change)))))

(defmethod initialize-instance :after ((record update-record) &key)
(setf (slot-value record 'edit-distance)
(+ 1 (tree-size (update-record-old record))
1 (tree-size (update-record-new record)))))
(+ 1 (tree-size (update-record-old record))
1 (tree-size (update-record-new record)))))

(defmethod initialize-instance :after ((record unchanged-record) &key)
(setf (slot-value record 'edit-distance)
(tree-size (slot-value record 'change))))
(tree-size (slot-value record 'change))))

(defmethod initialize-instance :after ((record compound-record) &key)
(setf (slot-value record 'edit-distance)
(reduce #'+ (slot-value record 'changes) :key #'edit-distance)))
(reduce #'+ (slot-value record 'changes) :key #'edit-distance)))


(defun insertion-record (change)
Expand Down Expand Up @@ -132,19 +132,19 @@

(defmethod render-difference ((record update-record))
(list :|#-new| (update-record-old record)
:|#+new| (update-record-new record)))
:|#+new| (update-record-new record)))

(defmethod render-difference ((record unchanged-record))
(list (change record)))

(defmethod render-difference ((record compound-record))
(list (loop for r in (reverse (changes record))
append (render-difference r))))
append (render-difference r))))

(defun min/edit (record &rest records)
"Returns record with minimum edit distance."
(flet ((min/edit/2 (a b)
(if (<= (edit-distance a)
(if (<= (edit-distance a)
(edit-distance b))
a b)))
(declare (dynamic-extent #'min/edit/2))
Expand All @@ -154,12 +154,12 @@
(defun initial-distance (function list)
"Prepares initial data vectors for Levenshtein algorithm from LIST."
(loop with seq = (make-sequence '(vector edit-record) (1+ (length list))
:initial-element (empty-compound-record))
for i from 0
for elt in list do
(setf (elt seq (1+ i))
:initial-element (empty-compound-record))
for i from 0
for elt in list do
(setf (elt seq (1+ i))
(extend-compound-record (elt seq i) (funcall function elt)))
finally (return seq)))
finally (return seq)))

(defun levenshtein-tree-edit (old-tree new-tree)
"Calculates the minimal edits needed to transform OLD-TREE into NEW-TREE.
Expand All @@ -174,22 +174,22 @@ edit conditionals."
(min/edit
(update-record old-tree new-tree)
(loop with row = (initial-distance #'deletion-record old-tree)
and col = (initial-distance #'insertion-record new-tree)
and best-edit
for new-part in new-tree
for current across (subseq col 1) do
(loop for old-part in old-tree
for row-idx from 0 do
(setq best-edit
(min/edit (extend-compound-record (elt row (1+ row-idx))
(insertion-record new-part))
(extend-compound-record current
(deletion-record old-part))
(extend-compound-record (elt row row-idx)
(levenshtein-tree-edit old-part new-part))))
(shiftf (elt row row-idx) current best-edit))
(setf (elt row (1- (length row))) best-edit)
finally (return best-edit))))))
and col = (initial-distance #'insertion-record new-tree)
and best-edit
for new-part in new-tree
for current across (subseq col 1) do
(loop for old-part in old-tree
for row-idx from 0 do
(setq best-edit
(min/edit (extend-compound-record (elt row (1+ row-idx))
(insertion-record new-part))
(extend-compound-record current
(deletion-record old-part))
(extend-compound-record (elt row row-idx)
(levenshtein-tree-edit old-part new-part))))
(shiftf (elt row row-idx) current best-edit))
(setf (elt row (1- (length row))) best-edit)
finally (return best-edit))))))

(defun diff-sexp (old-tree new-tree)
"Computes a diff between OLD-TREE and NEW-TREE which minimizes the
Expand All @@ -208,8 +208,8 @@ number of atoms in the result tree, also counting inserted edit conditionals
(defun time/diff-sexp (n &key (arity 2))
(let ((x 1))
(flet ((generator ()
(prog1 x (incf x))))
(prog1 x (incf x))))
(let ((t1 (n-ary-tree arity n #'generator))
(t2 (n-ary-tree arity n #'generator)))
(time (diff-sexp t1 t2))))))
(t2 (n-ary-tree arity n #'generator)))
(time (diff-sexp t1 t2))))))
||#
6 changes: 3 additions & 3 deletions contrib/lpolzer/number-range.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
() (:documentation "A presentation for number ranges."))

(defmethod render-view-field-value (value (presentation number-range-presentation)
(field form-view-field) (view form-view)
widget obj &rest args
(field form-view-field) (view form-view)
widget obj &rest args
&key intermediate-values &allow-other-keys)
(declare (ignore args))
(multiple-value-bind (intermediate-value intermediate-value-p)
Expand All @@ -21,7 +21,7 @@
())

(defmethod parse-view-field-value ((parser number-range-parser) value obj
(view form-view) (field form-view-field) &rest args)
(view form-view) (field form-view-field) &rest args)
(declare (ignore args))
(flet ((maybe-float (str) (find #\. str)))
(let* ((value* (cl-ppcre:split "-" value))
Expand Down
8 changes: 4 additions & 4 deletions contrib/lpolzer/util.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,18 @@
(defun render-custom-link (action draw-fn &key (ajaxp t) id class url (before-fire ""))
(declare (special weblocks::*uri-tokens*))
(let* ((action-code (weblocks::function-or-action->action action))
(url (if url
(url (if url
(let ((weblocks::*uri-tokens* (list url)))
(declare (special weblocks::*uri-tokens*))
(weblocks::make-action-url action-code))
(weblocks::make-action-url action-code))))
(with-html
(:a :id id :class class
:href url :onclick (when ajaxp
(format nil "~A initiateAction(\"~A\", \"~A\"); return false;"
:href url :onclick (when ajaxp
(format nil "~A initiateAction(\"~A\", \"~A\"); return false;"
before-fire action-code
(weblocks::session-name-string-pair)))
(funcall draw-fn)))))
(funcall draw-fn)))))

(defun render-button-link (action button &rest args)
(apply #'render-custom-link action
Expand Down
46 changes: 23 additions & 23 deletions contrib/lpolzer/yui/yui-base.lisp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
(in-package :weblocks)

(export '(yui-widget yui-widget-variable yui-target-id yui-component-config
yui-settings-mixin add-options
*yui-loader-base*
yui-settings-mixin add-options
*yui-loader-base*
add-component-config js-bool))

(defparameter *yui-loader-base* "http://yui.yahooapis.com/2.6.0/build/"
Expand All @@ -17,8 +17,8 @@

(defmethod add-options ((obj yui-settings-mixin) &rest options)
(setf (yui-settings obj)
(concatenate 'string (yui-settings obj)
(args-to-component-settings (yui-widget-variable obj) options))))
(concatenate 'string (yui-settings obj)
(args-to-component-settings (yui-widget-variable obj) options))))

(defun args-to-component-settings (component-name &rest args)
(iterate:iter (iterate:for (option value) on args by #'cddr)
Expand All @@ -31,21 +31,21 @@
(defwidget yui-widget (widget yui-settings-mixin)
((widget-variable :reader yui-widget-variable
:initarg :widget-variable
:initform (intern (gen-id "yuiWidget")) ; ps-gensym is broken on some lisps
:documentation "Global JavaScript variable that will
hold the YUI widget.")
:initform (intern (gen-id "yuiWidget")) ; ps-gensym is broken on some lisps
:documentation "Global JavaScript variable that will
hold the YUI widget.")
(target-id :accessor yui-target-id
:initarg :target-id
:initform nil
:documentation "Target HTML element that will be replaced
or acted upon by the YUI widget.")
:initarg :target-id
:initform nil
:documentation "Target HTML element that will be replaced
or acted upon by the YUI widget.")
(component-config :accessor yui-component-config
:initarg :config
:initform nil
:documentation "A list of JavaScript widget
configuration options. Will be passed straight
through to `(create ,@options) in parenscript
code. Usually a list of keyword value pairs..")
:initarg :config
:initform nil
:documentation "A list of JavaScript widget
configuration options. Will be passed straight
through to `(create ,@options) in parenscript
code. Usually a list of keyword value pairs..")
(modules :type list
:reader yui-modules
:initarg :modules
Expand Down Expand Up @@ -90,15 +90,15 @@ DOM-ready event is triggered."
"Take &body and put it in a function that will be called back once
required modules have been loaded and the DOM is ready."
(let ((callback-name (ps-gensym "$yui_callback"))
(loader-name (ps-gensym "$yui_loader")))
(loader-name (ps-gensym "$yui_loader")))
`(progn
(defun ,callback-name ()
(ensure-dom-ready ,@body))
(ensure-dom-ready ,@body))
(defvar ,loader-name (new (|:YAHOO.util.:YUILoader|
(create :require (array ,@modules)
:load-optional ,load-optional
,@(when base `(:base ,base))
:on-success ,callback-name))))
(create :require (array ,@modules)
:load-optional ,load-optional
,@(when base `(:base ,base))
:on-success ,callback-name))))
((@ ,loader-name insert) ,@(unless include-css-p '({} "js"))))))

(defpsmacro keywords-to-object (args)
Expand Down
2 changes: 1 addition & 1 deletion contrib/lpolzer/yui/yui-tabview.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
(ps:ps* `(new (|:YAHOO.widget.:TabView| ,(widget-dom-id widget)))))
(send-script
(ps* `(with-lazy-loaded-modules (,(yui-modules widget)
,@(yui-loader-args widget))
,@(yui-loader-args widget))
(setf ,(yui-widget-variable widget)
(new (|:YAHOO.widget.:TabView| ,(yui-target-id widget)
(keywords-to-object ,(yui-component-config widget))))))))
Expand Down
Loading

0 comments on commit a1097b5

Please sign in to comment.