Source

pcl-cvs / test-cookie.el

(require 'cookie)

(setq seeed 0)

(defun printer (string)
  (setq seeed (1+ seeed))
  (concat string (format " %d" seeed)))

(defun test ()
  (interactive)
  (let ((b  (generate-new-buffer "cookie-test")))
    (switch-to-buffer b)
  
    (cookie-create b
		   (function printer)
		   "This is a header."
		   "This is a footer.")
    (cookie-enter-first b "This is the first cookie.")
    (cookie-enter-last b "This is the last cookie.")
    (message (cookie-cookie b (tin-nth b -2)))
    (message (cookie-cookie b (tin-nth b -1)))
    (if (or (tin-nth b 2) (tin-nth b -3))
	(error "Error 78423."))
    (cookie-enter-cookies b '("List one." "List two." "List three."))
    (message "%s" "Entered list.")
    (setq foo (tin-nth b 2))
    (cookie-clear b)
    (cookie-enter-cookies b '("Foo" "Bar" "Baz" "Bie" "LysKOM"))
    (goto-char 1)
;    (switch-to-buffer-other-window (get-buffer-create "*Report*"))
;    (cookie-map-reverse (function (lambda (str) (insert str) (insert ?\n))) b)
    (cookie-filter b (function (lambda (foo) (sit-for 0) (yes-or-no-p foo))))
    (let ((a (point-min))
	  (c (point-max))
	  sell)
      (switch-to-buffer-other-window (get-buffer-create "*Report*"))
      (erase-buffer)
      (while (< a c)
	(setq sel  (tin-get-selection b a))
	(if sel 
	    (insert (format "%d - %s\n" a
			    (cookie-cookie b sel))))
	(setq a (1+ a))))))

(defun d (b tin)
  (message "%s" (cookie-cookie b tin))
  (sit-for 2))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.