Welcome to the CHICKEN Scheme pasting service

Using a formal hook API in awful for request-handler-hooks added by arthurmaciel on Thu Jul 23 06:22:43 2015

;; Awful would export a request-handler-hook hook, so 

;; (add-request-handler-hook!
;;  'foo
;;  (lambda (path handler)
;;    (when (string-prefix? "/foo" path)
;;      (parameterize
;;          ((debug-file "/tmp/foo-debug")
;;           (enable-ajax #t))
;;        (handler))))

;; could be written:

(let ((foo 
       (lambda (path handler)
	 (when (string-prefix? "/foo" path)
	   (parameterize
	       ((debug-file "/tmp/foo-debug")
		(enable-ajax #t))
	     (handler))))))
  (add-hook! request-handler-hook foo))

;; or 

(define (foo path handler)
  (when (string-prefix? "/foo" path)
    (parameterize
	((debug-file "/tmp/foo-debug")
	 (enable-ajax #t))
      (handler))))

(add-hook! request-handler-hook foo)

;; In both cases one could do
(remove-hook! request-handler-hook 'foo)

;; To call the procedures registered in the hook
;; you should run in Awful internals

(run-hook! request-handler-hook)

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Which procedure can be used to check whether its argument is a symbol?
Visually impaired? Let me spell it for you (wav file) download WAV