Mon Jan 4 01:07:02 UTC 2010 pix@kepibu.org
* subject-p makes more sense as (selector, element)
For future reference, I used the following code to do this automatically, plus a
few minor manual edits (e.g., swapping rcurry and curry):
(defun seek-forward (term)
(let ((p (search-forward term nil t)))
(when p
(goto-char p))))
(defun swap-args ()
(interactive)
(save-excursion
(while (seek-forward "defmethod subject-p (")
(forward-sexp)
(transpose-sexps 1)))
(save-excursion
(while (seek-forward "(subject-p")
(forward-sexp)
(transpose-sexps 1))))
hunk ./selectors.lisp 112
-(defgeneric subject-p (element selector))
+(defgeneric subject-p (selector element))
hunk ./selectors.lisp 114
-(defmethod subject-p (element (selector type-selector))
+(defmethod subject-p ((selector type-selector) element)
hunk ./selectors.lisp 117
-(defmethod subject-p (element (selector id-selector))
+(defmethod subject-p ((selector id-selector) element)
hunk ./selectors.lisp 120
-(defmethod subject-p (element (selector nth-child-selector))
+(defmethod subject-p ((selector nth-child-selector) element)
hunk ./selectors.lisp 137
-(defmethod subject-p (element (selector class-selector))
+(defmethod subject-p ((selector class-selector) element)
hunk ./selectors.lisp 142
-(defmethod subject-p (element (selector universal-selector))
+(defmethod subject-p ((selector universal-selector) element)
hunk ./selectors.lisp 146
-(defmethod subject-p (element (selector %implicit-element-selector))
+(defmethod subject-p ((selector %implicit-element-selector) element)
hunk ./selectors.lisp 149
-(defmethod subject-p (element (selector list))
- (every (curry #'subject-p element) selector))
+(defmethod subject-p ((selector list) element)
+ (every (rcurry #'subject-p element) selector))
hunk ./selectors.lisp 152
-(defmethod subject-p (element (selector child-combinator))
- (subject-p (element-parent element) (matcher selector)))
+(defmethod subject-p ((selector child-combinator) element)
+ (subject-p (matcher selector) (element-parent element)))
hunk ./selectors.lisp 155
-(defmethod subject-p (element (selector descendant-combinator))
- (some (rcurry #'subject-p (matcher selector)) (element-ancestors element)))
+(defmethod subject-p ((selector descendant-combinator) element)
+ (some (curry #'subject-p (matcher selector)) (element-ancestors element)))
hunk ./selectors.lisp 158
-(defmethod subject-p (element (selector adjacent-combinator))
+(defmethod subject-p ((selector adjacent-combinator) element)
hunk ./selectors.lisp 164
- (subject-p (elt siblings (1- ourpos)) (matcher selector)))))
+ (subject-p (matcher selector) (elt siblings (1- ourpos))))))
hunk ./selectors.lisp 166
-(defmethod subject-p (element (selector sibling-combinator))
+(defmethod subject-p ((selector sibling-combinator) element)
hunk ./selectors.lisp 172
- (find-if (rcurry #'subject-p (matcher selector)) siblings :end ourpos))))
+ (find-if (curry #'subject-p (matcher selector)) siblings :end ourpos))))