[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sudoku.el -- puzzle game, can download puzzles on the fly.
From: |
Wojciech Komornicki |
Subject: |
Re: sudoku.el -- puzzle game, can download puzzles on the fly. |
Date: |
Tue, 15 Nov 2005 11:35:59 -0600 |
I just downloaded sudoku.el and noticed that it relies on lynx. Since
the package, w3, retrieves url's. I decided to replace the call to lynx
with calls to w3. I am jsut a neophite when it comes to elisp so
hopefully others can look at the code and possibly correct anything that
I missed.
1) add
(require 'w3)
at the top of sudoku.el
2) add the following to sudoku.el (or anywhere so that it is loaded)
(defun wnk-retrieve-url (url)
"Retrieve the given url."
(let ((src nil) thebuff (oldbuff (current-buffer)))
(if url
(progn
(url-retrieve url)
(setq thebuff (current-buffer))
(switch-to-buffer oldbuff)
(insert-buffer thebuff)
))
))
3) in sudoku.el replace
(defun get-board (level)
"Downloads a board in the current buffer. Used by
sudoku-download-new-puzzle."
(let ((source (concat "http://play.websudoku.com/?level="
(int-to-string level))))
(call-process "lynx"
nil t nil
"--source" source)))
with
(defun get-board (level)
"Downloads a board in the current buffer. Used by
sudoku-download-new-puzzle."
(let ((source (concat "http://play.websudoku.com/?level="
(int-to-string level))))
(w3-wnk-retrieve-url source)))
Alternatively, introduce a variable
use-lynx
set it to t or nil and modify the defun of get-board so that it is
(defun get-board (level)
"Downloads a board in the current buffer. Used by
sudoku-download-new-puzzle."
(let ((source (concat "http://play.websudoku.com/?level="
(int-to-string level))))
(if use-lynx
(call-process "lynx"
nil t nil
"--source" source)
(w3-wnk-retrieve-url source))))
--
Wojciech Komornicki Dept of Mathematics
wnk at hamline.edu Hamline University
http://www.hamline.edu/~wnk/ St Paul, MN 55104
USA
It's not enough to know the world is absurd and restrict yourself merely to
pointing out that fact.... It is wrong to expect a reward for your struggles.
The reward is the act of struggle itself, not what you win. Even though you
can't expect to defeat the absurdity of the world, you must make the attempt.
That's morality, that's religion, that's art, that's life.
Phil Ochs