Mercurial > emacs
comparison lisp/play/landmark.el @ 105829:328150f0cf76
* url-util.el (url-insert-entities-in-string):
* url-nfs.el (url-nfs-unescape):
* url-ldap.el (url-ldap):
* url-imap.el (url-imap):
* url-cid.el (url-cid-gnus, url-cid): Use with-current-buffer.
* erc.el (erc-display-line-1, erc-process-away):
* erc-truncate.el (erc-truncate-buffer-to-size):
Use with-current-buffer.
* term/ns-win.el (ns-scroll-bar-move, ns-face-at-pos):
* play/mpuz.el (mpuz-create-buffer):
* play/landmark.el (lm-prompt-for-move, lm-print-wts, lm-print-smell)
(lm-print-y,s,noise, lm-print-w0, lm-init):
* play/gomoku.el (gomoku-prompt-for-move):
* play/fortune.el (fortune-in-buffer):
* play/dissociate.el (dissociated-press):
* play/decipher.el (decipher-adjacency-list, decipher-display-regexp)
(decipher-analyze-buffer, decipher-stats-buffer,decipher-stats-buffer):
* mail/supercite.el (sc-eref-show):
* mail/smtpmail.el (smtpmail-send-it):
* mail/rmailsum.el (rmail-summary-next-labeled-message)
(rmail-summary-previous-labeled-message, rmail-summary-wipe)
(rmail-summary-undelete-many, rmail-summary-rmail-update)
(rmail-summary-goto-msg, rmail-summary-expunge)
(rmail-summary-get-new-mail, rmail-summary-search-backward)
(rmail-summary-add-label, rmail-summary-output-menu)
(rmail-summary-output-body):
* mail/rfc822.el (rfc822-addresses):
* mail/reporter.el (reporter-dump-variable, reporter-dump-state):
* mail/mailpost.el (post-mail-send-it):
* mail/hashcash.el (hashcash-generate-payment):
* mail/feedmail.el (feedmail-run-the-queue)
(feedmail-queue-send-edit-prompt-help-first)
(feedmail-send-it-immediately, feedmail-give-it-to-buffer-eater)
(feedmail-deduce-address-list):
* eshell/esh-ext.el (eshell-remote-command):
* eshell/em-unix.el (eshell-occur-mode-mouse-goto):
* emulation/viper-util.el (viper-glob-unix-files, viper-save-setting)
(viper-wildcard-to-regexp, viper-glob-mswindows-files)
(viper-save-string-in-file, viper-valid-marker):
* emulation/viper-keym.el (viper-toggle-key):
* emulation/viper-ex.el (ex-expand-filsyms, viper-get-ex-file)
(ex-edit, ex-global, ex-mark, ex-next-related-buffer, ex-quit)
(ex-get-inline-cmd-args, ex-tag, ex-command, ex-compile):
* emulation/viper-cmd.el (viper-exec-form-in-vi)
(viper-exec-form-in-emacs, viper-brac-function):
* emulation/viper.el (viper-delocalize-var):
* emulation/vip.el (vip-mode, vip-get-ex-token, vip-ex, vip-get-ex-pat)
(vip-get-ex-command, vip-get-ex-opt-gc, vip-get-ex-buffer)
(vip-get-ex-count, vip-get-ex-file, ex-edit, ex-global, ex-mark)
(ex-map, ex-unmap, ex-quit, ex-read, ex-tag, ex-command):
* emulation/vi.el (vi-switch-mode, vi-ex-cmd):
* emulation/edt.el (edt-electric-helpify):
* emulation/cua-rect.el (cua--rectangle-aux-replace):
* emulation/cua-gmrk.el (cua--insert-at-global-mark)
(cua--delete-at-global-mark, cua--copy-rectangle-to-global-mark)
(cua-indent-to-global-mark-column):
* calendar/diary-lib.el (calendar-mark-1):
* calendar/cal-hebrew.el (calendar-hebrew-mark-date-pattern):
Use with-current-buffer.
* emulation/viper.el (viper-delocalize-var): Use dolist.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Tue, 03 Nov 2009 02:04:29 +0000 |
parents | 1382a0cd8022 |
children | 1d1d5d9bd884 |
comparison
equal
deleted
inserted
replaced
105828:3d8945f5688d | 105829:328150f0cf76 |
---|---|
825 (message (if (zerop lm-number-of-human-moves) | 825 (message (if (zerop lm-number-of-human-moves) |
826 "Your move? (move to a free square and hit X, RET ...)" | 826 "Your move? (move to a free square and hit X, RET ...)" |
827 "Your move?")) | 827 "Your move?")) |
828 ;; This may seem silly, but if one omits the following line (or a similar | 828 ;; This may seem silly, but if one omits the following line (or a similar |
829 ;; one), the cursor may very well go to some place where POINT is not. | 829 ;; one), the cursor may very well go to some place where POINT is not. |
830 ;; FIXME: this can't be right!! --Stef | |
830 (save-excursion (set-buffer (other-buffer)))) | 831 (save-excursion (set-buffer (other-buffer)))) |
831 | 832 |
832 (defun lm-prompt-for-other-game () | 833 (defun lm-prompt-for-other-game () |
833 "Ask for another game, and start it." | 834 "Ask for another game, and start it." |
834 (if (y-or-n-p "Another game? ") | 835 (if (y-or-n-p "Another game? ") |
1176 lm-directions) | 1177 lm-directions) |
1177 (insert "\n")) | 1178 (insert "\n")) |
1178 | 1179 |
1179 (defun lm-print-wts () | 1180 (defun lm-print-wts () |
1180 (interactive) | 1181 (interactive) |
1181 (save-excursion | 1182 (with-current-buffer "*lm-wts*" |
1182 (set-buffer "*lm-wts*") | |
1183 (insert "==============================\n") | 1183 (insert "==============================\n") |
1184 (mapc 'lm-print-wts-int lm-directions))) | 1184 (mapc 'lm-print-wts-int lm-directions))) |
1185 | 1185 |
1186 (defun lm-print-moves (moves) | 1186 (defun lm-print-moves (moves) |
1187 (interactive) | 1187 (interactive) |
1188 (save-excursion | 1188 (with-current-buffer "*lm-moves*" |
1189 (set-buffer "*lm-moves*") | |
1190 (insert (format "%S\n" moves)))) | 1189 (insert (format "%S\n" moves)))) |
1191 | 1190 |
1192 | 1191 |
1193 (defun lm-print-y,s,noise-int (direction) | 1192 (defun lm-print-y,s,noise-int (direction) |
1194 (insert (format "%S:lm-y %S, s %S, noise %S \n" | 1193 (insert (format "%S:lm-y %S, s %S, noise %S \n" |
1198 (get direction 'noise) | 1197 (get direction 'noise) |
1199 ))) | 1198 ))) |
1200 | 1199 |
1201 (defun lm-print-y,s,noise () | 1200 (defun lm-print-y,s,noise () |
1202 (interactive) | 1201 (interactive) |
1203 (save-excursion | 1202 (with-current-buffer "*lm-y,s,noise*" |
1204 (set-buffer "*lm-y,s,noise*") | |
1205 (insert "==============================\n") | 1203 (insert "==============================\n") |
1206 (mapc 'lm-print-y,s,noise-int lm-directions))) | 1204 (mapc 'lm-print-y,s,noise-int lm-directions))) |
1207 | 1205 |
1208 (defun lm-print-smell-int (direction) | 1206 (defun lm-print-smell-int (direction) |
1209 (insert (format "%S: smell: %S \n" | 1207 (insert (format "%S: smell: %S \n" |
1210 (symbol-name direction) | 1208 (symbol-name direction) |
1211 (get direction 'smell)))) | 1209 (get direction 'smell)))) |
1212 | 1210 |
1213 (defun lm-print-smell () | 1211 (defun lm-print-smell () |
1214 (interactive) | 1212 (interactive) |
1215 (save-excursion | 1213 (with-current-buffer "*lm-smell*" |
1216 (set-buffer "*lm-smell*") | |
1217 (insert "==============================\n") | 1214 (insert "==============================\n") |
1218 (insert (format "tree: %S \n" (get 'z 't))) | 1215 (insert (format "tree: %S \n" (get 'z 't))) |
1219 (mapc 'lm-print-smell-int lm-directions))) | 1216 (mapc 'lm-print-smell-int lm-directions))) |
1220 | 1217 |
1221 (defun lm-print-w0-int (direction) | 1218 (defun lm-print-w0-int (direction) |
1223 (symbol-name direction) | 1220 (symbol-name direction) |
1224 (get direction 'w0)))) | 1221 (get direction 'w0)))) |
1225 | 1222 |
1226 (defun lm-print-w0 () | 1223 (defun lm-print-w0 () |
1227 (interactive) | 1224 (interactive) |
1228 (save-excursion | 1225 (with-current-buffer "*lm-w0*" |
1229 (set-buffer "*lm-w0*") | |
1230 (insert "==============================\n") | 1226 (insert "==============================\n") |
1231 (mapc 'lm-print-w0-int lm-directions))) | 1227 (mapc 'lm-print-w0-int lm-directions))) |
1232 | 1228 |
1233 (defun lm-blackbox () | 1229 (defun lm-blackbox () |
1234 (save-excursion | 1230 (with-current-buffer "*lm-blackbox*" |
1235 (set-buffer "*lm-blackbox*") | |
1236 (insert "==============================\n") | 1231 (insert "==============================\n") |
1237 (insert "I smell: ") | 1232 (insert "I smell: ") |
1238 (mapc (lambda (direction) | 1233 (mapc (lambda (direction) |
1239 (if (> (get direction 'smell) 0) | 1234 (if (> (get direction 'smell) 0) |
1240 (insert (format "%S " direction)))) | 1235 (insert (format "%S " direction)))) |
1554 (setq lm-number-of-moves 0) | 1549 (setq lm-number-of-moves 0) |
1555 | 1550 |
1556 (lm-plot-landmarks) | 1551 (lm-plot-landmarks) |
1557 | 1552 |
1558 (if lm-debug | 1553 (if lm-debug |
1559 (progn | 1554 (save-current-buffer |
1560 (save-excursion | 1555 (set-buffer (get-buffer-create "*lm-w0*")) |
1561 (set-buffer (get-buffer-create "*lm-w0*")) | 1556 (erase-buffer) |
1562 (erase-buffer) | 1557 (set-buffer (get-buffer-create "*lm-moves*")) |
1563 (set-buffer (get-buffer-create "*lm-moves*")) | 1558 (set-buffer (get-buffer-create "*lm-wts*")) |
1564 (set-buffer (get-buffer-create "*lm-wts*")) | 1559 (erase-buffer) |
1565 (erase-buffer) | 1560 (set-buffer (get-buffer-create "*lm-y,s,noise*")) |
1566 (set-buffer (get-buffer-create "*lm-y,s,noise*")) | 1561 (erase-buffer) |
1567 (erase-buffer) | 1562 (set-buffer (get-buffer-create "*lm-smell*")) |
1568 (set-buffer (get-buffer-create "*lm-smell*")) | 1563 (erase-buffer) |
1569 (erase-buffer) | 1564 (set-buffer (get-buffer-create "*lm-blackbox*")) |
1570 (set-buffer (get-buffer-create "*lm-blackbox*")) | 1565 (erase-buffer) |
1571 (erase-buffer) | 1566 (set-buffer (get-buffer-create "*lm-distance*")) |
1572 (set-buffer (get-buffer-create "*lm-distance*")) | 1567 (erase-buffer))) |
1573 (erase-buffer)))) | |
1574 | 1568 |
1575 | 1569 |
1576 (lm-set-landmark-signal-strengths) | 1570 (lm-set-landmark-signal-strengths) |
1577 | 1571 |
1578 (mapc (lambda (direction) | 1572 (dolist (direction lm-directions) |
1579 (put direction 'y_t 0.0)) | 1573 (put direction 'y_t 0.0)) |
1580 lm-directions) | |
1581 | 1574 |
1582 (if (not save-weights) | 1575 (if (not save-weights) |
1583 (progn | 1576 (progn |
1584 (mapc 'lm-fix-weights-for lm-directions) | 1577 (mapc 'lm-fix-weights-for lm-directions) |
1585 (mapc (lambda (direction) | 1578 (dolist (direction lm-directions) |
1586 (put direction 'w0 lm-initial-w0)) | 1579 (put direction 'w0 lm-initial-w0))) |
1587 lm-directions)) | |
1588 (message "Weights preserved for this run.")) | 1580 (message "Weights preserved for this run.")) |
1589 | 1581 |
1590 (if auto-start | 1582 (if auto-start |
1591 (progn | 1583 (progn |
1592 (lm-goto-xy (1+ (random lm-board-width)) (1+ (random lm-board-height))) | 1584 (lm-goto-xy (1+ (random lm-board-width)) (1+ (random lm-board-height))) |