+2009-11-03 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * 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.
+
2009-11-03 Chong Yidong <cyd@stupidchicken.com>
* comint.el (comint-replace-by-expanded-history-before-point):
* textmodes/sgml-mode.el (sgml-mode-facemenu-add-face-function):
Support face colors.
- * textmodes/tex-mode.el (tex-facemenu-add-face-function): New
- function. Support face colors (Bug#1168).
+ * textmodes/tex-mode.el (tex-facemenu-add-face-function):
+ New function. Support face colors (Bug#1168).
(tex-common-initialization): Use it.
* facemenu.el (facemenu-enable-faces-p): Enable facemenu if the
passed to `calendar-mark-visible-date' as MARK."
;; FIXME not the same as the Bahai and Islamic cases, so can't use
;; calendar-mark-1.
- (save-excursion
- (set-buffer calendar-buffer)
+ (with-current-buffer calendar-buffer
(if (and (not (zerop month)) (not (zerop day)))
(if (not (zerop year))
;; Fully specified Hebrew date.
The function FROMABS converts absolute dates to the appropriate date system.
The function TOABS carries out the inverse operation. Optional argument
COLOR is passed to `calendar-mark-visible-date' as MARK."
- (save-excursion
- (set-buffer calendar-buffer)
+ (with-current-buffer calendar-buffer
(if (and (not (zerop month)) (not (zerop day)))
(if (not (zerop year))
;; Fully specified date.
(defun cua--insert-at-global-mark (str &optional msg)
;; Insert string at global marker and move marker
- (save-excursion
- (set-buffer (marker-buffer cua--global-mark-marker))
+ (with-current-buffer (marker-buffer cua--global-mark-marker)
(goto-char (marker-position cua--global-mark-marker))
(insert-for-yank str)
(cua--activate-global-mark))
(defun cua--delete-at-global-mark (arg &optional msg)
;; Delete chars at global marker
- (save-excursion
- (set-buffer (marker-buffer cua--global-mark-marker))
+ (with-current-buffer (marker-buffer cua--global-mark-marker)
(goto-char (marker-position cua--global-mark-marker))
(delete-char arg))
(if msg
(if (cua--global-mark-active)
(let ((src-buf (current-buffer))
(text (cua--extract-rectangle)))
- (save-excursion
- (set-buffer (marker-buffer cua--global-mark-marker))
+ (with-current-buffer (marker-buffer cua--global-mark-marker)
(goto-char (marker-position cua--global-mark-marker))
(if as-text
(while text
(interactive "*")
(if (cua--global-mark-active)
(let (col)
- (save-excursion
- (set-buffer (marker-buffer cua--global-mark-marker))
+ (with-current-buffer (marker-buffer cua--global-mark-marker)
(goto-char (marker-position cua--global-mark-marker))
(setq col (current-column)))
(if cua--rectangle
(- (cua--rectangle-right) (cua--rectangle-left) -1)))
(r (or setup-fct (cua--extract-rectangle)))
y z (tr 0))
- (save-excursion
- (set-buffer auxbuf)
+ (with-current-buffer auxbuf
(erase-buffer)
(if setup-fct
(funcall setup-fct)
(progn
(message "%s..." (capitalize (symbol-name fun)))
(and b
- (save-excursion
- (set-buffer b)
+ (with-current-buffer b
(set-buffer-modified-p t)))
(fset 'help-print-return-message 'ignore)
(call-interactively fun)
(not (buffer-modified-p b)))))
(fset 'help-print-return-message p)
(and b (buffer-name b)
- (save-excursion
- (set-buffer b)
+ (with-current-buffer b
(set-buffer-modified-p m))))))
(with-electric-help 'delete-other-windows name t))))
(if (null mode-cmd)
(with-output-to-temp-buffer "*Help*"
(princ (substitute-command-keys "Possible major modes to switch to: \\{vi-tilde-map}"))
- (save-excursion
- (set-buffer standard-output)
+ (with-current-buffer standard-output
(help-mode)))
(setq prefix-arg arg) ; prefix arg will be passed down
(command-execute mode-cmd nil) ; may need to save mode-line-format etc
;; (cond ((string-match "s"))))
(with-output-to-temp-buffer "*Help*"
(princ (documentation 'vi-ex-cmd))
- (save-excursion
- (set-buffer standard-output)
+ (with-current-buffer standard-output
(help-mode))))
(defun vi-undefined ()
(goto-char (point-min))
(if (y-or-n-p "Inhibit VIP startup message? ")
(progn
- (save-excursion
- (set-buffer
- (find-file-noselect
- (substitute-in-file-name vip-startup-file)))
+ (with-current-buffer
+ (find-file-noselect
+ (substitute-in-file-name vip-startup-file))
(goto-char (point-max))
(insert "\n(setq vip-inhibit-startup-message t)\n")
(save-buffer)
(defun vip-get-ex-token ()
"get an ex-token which is either an address or a command.
a token has type \(command, address, end-mark\) and value."
- (save-window-excursion
- (set-buffer " *ex-working-space*")
+ (with-current-buffer " *ex-working-space*"
(skip-chars-forward " \t")
(cond ((looking-at "[k#]")
(setq ex-token-type "command")
ex-g-variant nil))
(let ((com-str (or string (vip-read-string ":")))
(address nil) (cont t) (dot (point)))
- (save-window-excursion
- (set-buffer (get-buffer-create " *ex-working-space*"))
+ (with-current-buffer (get-buffer-create " *ex-working-space*")
(delete-region (point-min) (point-max))
(insert com-str "\n")
(goto-char (point-min)))
(setq cont nil))
(t
(vip-execute-ex-command)
- (save-window-excursion
- (set-buffer " *ex-working-space*")
+ (with-current-buffer " *ex-working-space*"
(skip-chars-forward " \t")
(cond ((looking-at "|")
(forward-char 1))
(defun vip-get-ex-pat ()
"get a regular expression and set ex-variant if found"
- (save-window-excursion
- (set-buffer " *ex-working-space*")
+ (with-current-buffer " *ex-working-space*"
(skip-chars-forward " \t")
(if (looking-at "!")
(progn
(defun vip-get-ex-command ()
"get an ex command"
- (save-window-excursion
- (set-buffer " *ex-working-space*")
+ (with-current-buffer " *ex-working-space*"
(if (looking-at "/") (forward-char 1))
(skip-chars-forward " \t")
(cond ((looking-at "[a-z]")
(defun vip-get-ex-opt-gc ()
"get an ex option g or c"
- (save-window-excursion
- (set-buffer " *ex-working-space*")
+ (with-current-buffer " *ex-working-space*"
(if (looking-at "/") (forward-char 1))
(skip-chars-forward " \t")
(cond ((looking-at "g")
(setq ex-buffer nil)
(setq ex-count nil)
(setq ex-flag nil)
- (save-window-excursion
- (set-buffer " *ex-working-space*")
+ (with-current-buffer " *ex-working-space*"
(skip-chars-forward " \t")
(if (looking-at "[a-zA-Z]")
(progn
(setq ex-variant nil
ex-count nil
ex-flag nil)
- (save-window-excursion
- (set-buffer " *ex-working-space*")
+ (with-current-buffer " *ex-working-space*"
(skip-chars-forward " \t")
(if (looking-at "!")
(progn
ex-variant nil
ex-append nil
ex-offset nil)
- (save-window-excursion
- (set-buffer " *ex-working-space*")
+ (with-current-buffer " *ex-working-space*"
(skip-chars-forward " \t")
(if (looking-at "!")
(progn
(goto-char (point-min))
(if ex-offset
(progn
- (save-window-excursion
- (set-buffer " *ex-working-space*")
+ (with-current-buffer " *ex-working-space*"
(delete-region (point-min) (point-max))
(insert ex-offset "\n")
(goto-char (point-min)))
(if (bobp) (setq cont nil)
(forward-line -1)
(end-of-line)))))
- (save-window-excursion
- (set-buffer " *ex-working-space*")
- (setq com-str (buffer-substring (1+ (point)) (1- (point-max)))))
- (while marks
- (goto-char (car marks))
- ; report progress of execution on a slow machine.
- ;(message "Executing global command...")
- ;(if (zerop (% mark-count 10))
- ;(message "Executing global command...%d" mark-count))
- (vip-ex com-str)
- (setq mark-count (1- mark-count))
- (setq marks (cdr marks)))))
- ;(message "Executing global command...done")))
+ (with-current-buffer " *ex-working-space*"
+ (setq com-str (buffer-substring (1+ (point)) (1- (point-max)))))
+ (while marks
+ (goto-char (car marks))
+ ;; report progress of execution on a slow machine.
+ ;;(message "Executing global command...")
+ ;;(if (zerop (% mark-count 10))
+ ;; (message "Executing global command...%d" mark-count))
+ (vip-ex com-str)
+ (setq mark-count (1- mark-count))
+ (setq marks (cdr marks)))))
+;;(message "Executing global command...done")))
(defun ex-line (com)
"ex line commands. COM is join, shift-right or shift-left."
(if (null ex-addresses)
(setq ex-addresses
(cons (point) nil)))
- (save-window-excursion
- (set-buffer " *ex-working-space*")
+ (with-current-buffer " *ex-working-space*"
(skip-chars-forward " \t")
(if (looking-at "[a-z]")
(progn
(defun ex-map ()
"ex map"
(let (char string)
- (save-window-excursion
- (set-buffer " *ex-working-space*")
+ (with-current-buffer " *ex-working-space*"
(skip-chars-forward " \t")
(setq char (char-to-string (following-char)))
(forward-char 1)
(defun ex-unmap ()
"ex unmap"
(let (char)
- (save-window-excursion
- (set-buffer " *ex-working-space*")
+ (with-current-buffer " *ex-working-space*"
(skip-chars-forward " \t")
(setq char (char-to-string (following-char)))
(forward-char 1)
(defun ex-quit ()
"ex quit"
(let (char)
- (save-window-excursion
- (set-buffer " *ex-working-space*")
+ (with-current-buffer " *ex-working-space*"
(skip-chars-forward " \t")
(setq char (following-char)))
(if (= char ?!) (kill-emacs t) (save-buffers-kill-emacs))))
(goto-char point)
(if (not (= point 0)) (with-no-warnings (next-line 1)))
(beginning-of-line)
- (save-window-excursion
- (set-buffer " *ex-working-space*")
+ (with-current-buffer " *ex-working-space*"
(skip-chars-forward " \t")
(if (looking-at "!")
(progn
(defun ex-tag ()
"ex tag"
(let (tag)
- (save-window-excursion
- (set-buffer " *ex-working-space*")
+ (with-current-buffer " *ex-working-space*"
(skip-chars-forward " \t")
(set-mark (point))
(skip-chars-forward "^ |\t\n")
(defun ex-command ()
"execute shell command"
(let (command)
- (save-window-excursion
- (set-buffer " *ex-working-space*")
+ (with-current-buffer " *ex-working-space*"
(skip-chars-forward " \t")
(set-mark (point))
(end-of-line)
(signal 'quit nil)))
(if (not (equal buff (current-buffer))) ; cmd switched buffer
- (save-excursion
- (set-buffer buff)
+ (with-current-buffer buff
(viper-set-mode-vars-for viper-current-state)))
(viper-set-mode-vars-for viper-current-state)
result))
(viper-set-mode-vars-for 'emacs-state)
(setq result (eval form))
(if (not (equal buff (current-buffer))) ; cmd switched buffer
- (save-excursion
- (set-buffer buff)
+ (with-current-buffer buff
(viper-set-mode-vars-for viper-current-state)))
(viper-set-mode-vars-for viper-current-state)
result))
(with-output-to-temp-buffer " *viper-info*"
(if (and buf pos)
(progn
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(setq line-no (1+ (count-lines (point-min) val)))
(goto-char pos)
(beginning-of-line)
;; Expand \% and \# in ex command
(defun ex-expand-filsyms (cmd buf)
(let (cf pf ret)
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(setq cf buffer-file-name)
(setq pf (ex-next nil t))) ; this finds alternative file name
(if (and (null cf) (string-match "[^\\]%\\|\\`%" cmd))
(error "No current file to substitute for `%%'"))
(if (and (null pf) (string-match "[^\\]#\\|\\`#" cmd))
(error "No alternate file to substitute for `#'"))
- (save-excursion
- (set-buffer (get-buffer-create viper-ex-tmp-buf-name))
+ (with-current-buffer (get-buffer-create viper-ex-tmp-buf-name)
(erase-buffer)
(insert cmd)
(goto-char (point-min))
ex-cmdfile nil
ex-cmdfile-args "")
(save-excursion
- (save-window-excursion
- (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name))
- (set-buffer viper-ex-work-buf)
+ (with-current-buffer (setq viper-ex-work-buf
+ (get-buffer-create viper-ex-work-buf-name))
(skip-chars-forward " \t")
(if (looking-at "!")
(if (and (not (viper-looking-back "[ \t]"))
(switch-to-buffer file))
(if ex-offset
(progn
- (save-window-excursion
- (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name))
- (set-buffer viper-ex-work-buf)
+ (with-current-buffer (setq viper-ex-work-buf
+ (get-buffer-create viper-ex-work-buf-name))
(delete-region (point-min) (point-max))
(insert ex-offset "\n")
(goto-char (point-min)))
(if (bobp) (setq cont nil)
(forward-line -1)
(end-of-line)))))
- (save-window-excursion
- (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name))
- (set-buffer viper-ex-work-buf)
+ (with-current-buffer (setq viper-ex-work-buf
+ (get-buffer-create viper-ex-work-buf-name))
;; com-str is the command string, i.e., g/pattern/ or v/pattern'
(setq com-str (buffer-substring (1+ (point)) (1- (point-max)))))
(while ex-g-marks
(setq char (string-to-char name))
(error "`%s': Spurious text \"%s\" after mark name"
name (substring name 1)))
- (save-window-excursion
- (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name))
- (set-buffer viper-ex-work-buf)
- (skip-chars-forward " \t")
- (if (looking-at "[a-z]")
- (progn
- (setq char (following-char))
- (forward-char 1)
- (skip-chars-forward " \t")
- (if (not (looking-at "[\n|]"))
- (error "`%s': %s" ex-token viper-SpuriousText)))
- (error "`%s' requires a following letter" ex-token))))
+ (with-current-buffer (setq viper-ex-work-buf
+ (get-buffer-create viper-ex-work-buf-name))
+ (skip-chars-forward " \t")
+ (if (looking-at "[a-z]")
+ (progn
+ (setq char (following-char))
+ (forward-char 1)
+ (skip-chars-forward " \t")
+ (if (not (looking-at "[\n|]"))
+ (error "`%s': %s" ex-token viper-SpuriousText)))
+ (error "`%s' requires a following letter" ex-token))))
(save-excursion
(goto-char (car ex-addresses))
(point-to-register (viper-int-to-char (1+ (- char ?a)))))))
(select-window wind)))
(save-window-excursion (select-window wind) (sit-for 1)))
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(setq viper-related-files-and-buffers-ring old-ring))
(setq viper-local-search-start-marker (point-marker))
;; Ex quit command
(defun ex-quit ()
;; skip "!", if it is q!. In Viper q!, w!, etc., behave as q, w, etc.
- (save-excursion
- (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name))
- (set-buffer viper-ex-work-buf)
+ (with-current-buffer (setq viper-ex-work-buf
+ (get-buffer-create viper-ex-work-buf-name))
(if (looking-at "!") (forward-char 1)))
(if (< viper-expert-level 3)
(save-buffers-kill-emacs)
;; Optional 3d arg is a string that should replace ' ' to prevent its
;; special meaning
(defun ex-get-inline-cmd-args (regex-forw &optional chars-back replace-str)
- (save-excursion
- (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name))
- (set-buffer viper-ex-work-buf)
+ (with-current-buffer (setq viper-ex-work-buf
+ (get-buffer-create viper-ex-work-buf-name))
(goto-char (point-min))
(re-search-forward regex-forw nil t)
(let ((beg (point))
;; Ex tag command
(defun ex-tag ()
(let (tag)
- (save-window-excursion
- (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name))
- (set-buffer viper-ex-work-buf)
+ (with-current-buffer (setq viper-ex-work-buf
+ (get-buffer-create viper-ex-work-buf-name))
(skip-chars-forward " \t")
(set-mark (point))
(skip-chars-forward "^ |\t\n")
;; Execute shell command
(defun ex-command ()
(let (command)
- (save-window-excursion
- (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name))
- (set-buffer viper-ex-work-buf)
+ (with-current-buffer (setq viper-ex-work-buf
+ (get-buffer-create viper-ex-work-buf-name))
(skip-chars-forward " \t")
(setq command (buffer-substring (point) (point-max)))
(end-of-line))
If no args are given, then it runs the last compile command.
Type 'mak ' (including the space) to run make with no args."
(let (args)
- (save-window-excursion
- (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name))
- (set-buffer viper-ex-work-buf)
+ (with-current-buffer (setq viper-ex-work-buf
+ (get-buffer-create viper-ex-work-buf-name))
(setq args (buffer-substring (point) (point-max)))
(end-of-line))
;; Remove the newline that may (will?) be at the end of the args
[(control ?z)])))
(mapc
(lambda (buf)
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(when (and (boundp 'viper-insert-basic-map)
(keymapp viper-insert-basic-map))
(when old-value
(command (cond (viper-ms-style-os-p (format "\"ls -1 -d %s\"" filespec))
(t (format "ls -1 -d %s" filespec))))
status)
- (save-excursion
- (set-buffer (get-buffer-create viper-ex-tmp-buf-name))
+ (with-current-buffer (get-buffer-create viper-ex-tmp-buf-name)
(erase-buffer)
(setq status
(if gshell-options
;; convert MS-DOS wildcards to regexp
(defun viper-wildcard-to-regexp (wcard)
- (save-excursion
- (set-buffer (get-buffer-create viper-ex-tmp-buf-name))
+ (with-current-buffer (get-buffer-create viper-ex-tmp-buf-name)
(erase-buffer)
(insert wcard)
(goto-char (point-min))
(defun viper-glob-mswindows-files (filespec)
(let ((case-fold-search t)
tmp tmp2)
- (save-excursion
- (set-buffer (get-buffer-create viper-ex-tmp-buf-name))
+ (with-current-buffer (get-buffer-create viper-ex-tmp-buf-name)
(erase-buffer)
(insert filespec)
(goto-char (point-min))
(buf (find-file-noselect (substitute-in-file-name custom-file)))
)
(message "%s" (or message ""))
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(goto-char (point-min))
(if (re-search-forward regexp nil t)
(let ((reg-end (1- (match-end 0))))
;; match this pattern.
(defun viper-save-string-in-file (string custom-file &optional pattern)
(let ((buf (find-file-noselect (substitute-in-file-name custom-file))))
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(let (buffer-read-only)
(goto-char (point-min))
(if pattern (delete-matching-lines pattern))
(if (and (markerp marker) (marker-buffer marker))
(let ((buf (marker-buffer marker))
(pos (marker-position marker)))
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(and (<= pos (point-max)) (<= (point-min) pos))))))
(defsubst viper-mark-marker ()
;; Remove local value in all existing buffers
;; This doesn't delocalize vars (which would have been desirable)
(defun viper-delocalize-var (symbol)
- (mapcar (lambda (buf) (save-excursion
- (set-buffer buf)
- (kill-local-variable symbol)))
- (buffer-list)))
+ (dolist (buf (buffer-list))
+ (with-current-buffer buf
+ (kill-local-variable symbol))))
(defun viper-go-away ()
+2009-11-03 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * erc.el (erc-display-line-1, erc-process-away):
+ * erc-truncate.el (erc-truncate-buffer-to-size):
+ Use with-current-buffer.
+
2009-10-24 Glenn Morris <rgm@gnu.org>
* erc-dcc.el (pcomplete-erc-all-nicks):
(unless (get-buffer buffer)
(error "erc-truncate-buffer-to-size: %S is not a buffer" buffer)))
(when (> (buffer-size buffer) (+ size 512))
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
;; Note that when erc-insert-post-hook runs, the buffer is
;; narrowed to the new message. So do this delicate widening.
;; I am not sure, I think this was not recommended behavior in
Afterwards, `erc-insert-modify' and `erc-insert-post-hook' get called.
If STRING is nil, the function does nothing."
(when string
- (save-excursion
- (set-buffer (or buffer (process-buffer erc-server-process)))
+ (with-current-buffer (or buffer (process-buffer erc-server-process))
(let ((insert-position (or (marker-position erc-insert-marker)
(point-max))))
(let ((string string) ;; FIXME! Can this be removed?
;; away must be set to NIL BEFORE sending anything to prevent
;; an infinite recursion
(setq erc-away nil)
- (save-excursion
- (set-buffer (erc-active-buffer))
+ (with-current-buffer (erc-active-buffer)
(when erc-public-away-p
(erc-send-action
(erc-default-target)
"In Occur mode, go to the occurrence whose line you click on."
(interactive "e")
(let (pos)
- (save-excursion
- (set-buffer (window-buffer (posn-window (event-end event))))
+ (with-current-buffer (window-buffer (posn-window (event-end event)))
(save-excursion
(goto-char (posn-point (event-end event)))
(setq pos (occur-mode-find-occurrence))))
(mapconcat 'shell-quote-argument
(append (list command) args) " ")
outbuf errbuf))
- (eshell-print (save-excursion (set-buffer outbuf)
- (buffer-string)))
- (eshell-error (save-excursion (set-buffer errbuf)
- (buffer-string))))
+ (eshell-print (with-current-buffer outbuf (buffer-string)))
+ (eshell-error (with-current-buffer errbuf (buffer-string))))
(eshell-close-handles exitcode 'nil)
(kill-buffer outbuf)
(kill-buffer errbuf))))
(if (and already-buffer (not (file-exists-p maybe-file)))
;; we have gotten rid of the file associated with the
;; buffer, so update the buffer's notion of that
- (save-excursion
- (set-buffer already-buffer)
+ (with-current-buffer already-buffer
(setq buffer-file-name nil)))))
(error (setq messages-skipped (1+ messages-skipped))))
(kill-buffer blobby-buffer)
")
(and (stringp feedmail-prompt-before-queue-help-supplement)
(princ feedmail-prompt-before-queue-help-supplement))
- (save-excursion (set-buffer standard-output) (if (fboundp 'help-mode) (help-mode)))))
+ (with-current-buffer standard-output
+ (if (fboundp 'help-mode) (help-mode)))))
(defun feedmail-look-at-queue-directory (queue-directory)
"Find out some things about a queue directory.
(mail-header-separator mail-header-separator)
)
(unwind-protect
- (save-excursion
+ (save-current-buffer
(set-buffer feedmail-error-buffer) (erase-buffer)
(set-buffer feedmail-prepped-text-buffer) (erase-buffer)
(if (and (not feedmail-queue-runner-is-active) (setq also-file (buffer-file-name feedmail-raw-text-buffer)))
(progn ; if a file but not running the queue, offer to delete it
(setq also-file (expand-file-name also-file))
- (if (or feedmail-queue-auto-file-nuke
- (y-or-n-p (format "FQM: Delete message file %s? " also-file)))
- (save-excursion
- ;; if we delete the affiliated file, get rid
- ;; of the file name association and make sure we
- ;; don't annoy people with a prompt on exit
- (delete-file also-file)
- (set-buffer feedmail-raw-text-buffer)
- (setq buffer-offer-save nil)
- (setq buffer-file-name nil)
- )
- )))
+ (when (or feedmail-queue-auto-file-nuke
+ (y-or-n-p
+ (format "FQM: Delete message file %s? "
+ also-file)))
+ ;; if we delete the affiliated file, get rid
+ ;; of the file name association and make sure we
+ ;; don't annoy people with a prompt on exit
+ (delete-file also-file)
+ (with-current-buffer feedmail-raw-text-buffer
+ (setq buffer-offer-save nil)
+ (setq buffer-file-name nil)))))
(goto-char (point-min))
;; re-insert and handle any Fcc fields (and, optionally, any Bcc).
(if fcc (letf (((default-value 'buffer-file-type)
(mapcar
'(lambda (feedmail-spray-this-address)
(let ((spray-buffer (get-buffer-create " *FQM Outgoing Email Spray*")))
- (save-excursion
- (set-buffer spray-buffer)
+ (with-current-buffer spray-buffer
(erase-buffer)
;; not life's most efficient methodology, but spraying isn't
;; an every-5-minutes event either
(insert-buffer-substring feedmail-prepped-text-buffer)
- ;; There's a good case to me made that each separate transmission of
- ;; a message in the spray should have a distinct Message-Id:. There
- ;; is also a less compelling argument in the other direction. I think
- ;; they technically should have distinct Message-Id:s, but I doubt that
- ;; anyone cares, practically. If someone complains about it, I'll add
- ;; it.
+ ;; There's a good case to me made that each separate
+ ;; transmission of a message in the spray should
+ ;; have a distinct Message-Id:. There is also a less
+ ;; compelling argument in the other direction.
+ ;; I think they technically should have distinct
+ ;; Message-Id:s, but I doubt that anyone cares,
+ ;; practically. If someone complains about it, I'll
+ ;; add it.
(feedmail-fiddle-list-of-spray-fiddle-plexes feedmail-spray-address-fiddle-plex-list)
;; this (let ) is just in case some buffer eater
;; is cheating and using the global variable name instead
(this-line)
(this-line-end))
(unwind-protect
- (save-excursion
- (set-buffer (get-buffer-create " *FQM scratch*")) (erase-buffer)
+ (with-current-buffer (get-buffer-create " *FQM scratch*")
+ (erase-buffer)
(insert-buffer-substring message-buffer header-start header-end)
(goto-char (point-min))
(let ((case-fold-search t))
"Generate a hashcash payment by finding a VAL-bit collison on STR."
(if (and (> val 0)
hashcash-path)
- (save-excursion
- (set-buffer (get-buffer-create " *hashcash*"))
+ (with-current-buffer (get-buffer-create " *hashcash*")
(erase-buffer)
(apply 'call-process hashcash-path nil t nil
"-m" "-q" "-b" (number-to-string val) str
delimline
(mailbuf (current-buffer)))
(unwind-protect
- (save-excursion
- (set-buffer tembuf)
+ (with-current-buffer tembuf
(erase-buffer)
(insert-buffer-substring mailbuf)
(goto-char (point-max))
(if (re-search-forward "^Subject:[ \t]*\n" delimline t)
(replace-match ""))
(if mail-interactive
- (save-excursion
- (set-buffer errbuf)
+ (with-current-buffer errbuf
(erase-buffer))))
(let ((m (default-file-modes)))
(unwind-protect
(if mail-interactive '("-watch") '("-nowatch"))
(list temfile)))
(if mail-interactive
- (save-excursion
- (set-buffer errbuf)
+ (with-current-buffer errbuf
(goto-char (point-min))
(while (re-search-forward "\n\n* *" nil t)
(replace-match "; "))
MAILBUF is the mail buffer being composed."
(reporter-update-status)
(condition-case nil
- (let ((val (save-excursion
- (set-buffer reporter-eval-buffer)
+ (let ((val (with-current-buffer reporter-eval-buffer
(symbol-value varsym)))
(sym (symbol-name varsym))
(print-escape-newlines t)
(reporter-beautify-list maxwidth compact-p))))
(insert "\n"))
(void-variable
- (save-excursion
- (set-buffer mailbuf)
+ (with-current-buffer mailbuf
(mail-position-on-field "X-Reporter-Void-Vars-Found")
(end-of-line)
(insert (symbol-name varsym) " ")))
(condition-case fault
(let ((mailbuf (current-buffer))
(elbuf (get-buffer-create " *tmp-reporter-buffer*")))
- (save-excursion
- (set-buffer elbuf)
+ (with-current-buffer elbuf
(emacs-lisp-mode)
(erase-buffer)
(insert "(setq\n")
(list (substring header-text (match-beginning 1) (match-end 1)))
(let ((buf (generate-new-buffer " rfc822")))
(unwind-protect
- (save-excursion
- (set-buffer buf)
- (make-local-variable 'case-fold-search)
- (setq case-fold-search nil) ;For speed(?)
- (insert header-text)
- ;; unfold continuation lines
- (goto-char (point-min))
+ (with-current-buffer buf
+ (make-local-variable 'case-fold-search)
+ (setq case-fold-search nil) ;For speed(?)
+ (insert header-text)
+ ;; unfold continuation lines
+ (goto-char (point-min))
- (while (re-search-forward "\\([^\\]\\(\\\\\\\\\\)*\\)\n[ \t]" nil t)
- (replace-match "\\1 " t))
+ (while (re-search-forward "\\([^\\]\\(\\\\\\\\\\)*\\)\n[ \t]"
+ nil t)
+ (replace-match "\\1 " t))
- (goto-char (point-min))
- (let ((list ())
- tem
- ;; This is for rfc822-bad-address. Give it a non-nil
- ;; initial value to prevent rfc822-bad-address from
- ;; raising a wrong-type-argument error
- (rfc822-address-start (point)))
- (catch 'address ; this is for rfc822-bad-address
- (rfc822-nuke-whitespace)
- (while (not (eobp))
- (setq rfc822-address-start (point))
- (setq tem
- (cond ((rfc822-looking-at ?\,)
- nil)
- ((looking-at "[][\000-\037@;:\\.>)]")
- (forward-char)
- (rfc822-bad-address
- (format "Strange character \\%c found"
- (preceding-char))))
- (t
- (rfc822-addresses-1 t))))
- (cond ((null tem))
- ((stringp tem)
- (setq list (cons tem list)))
- (t
- (setq list (nconc (nreverse tem) list)))))
- (nreverse list))))
+ (goto-char (point-min))
+ (let ((list ())
+ tem
+ ;; This is for rfc822-bad-address. Give it a non-nil
+ ;; initial value to prevent rfc822-bad-address from
+ ;; raising a wrong-type-argument error
+ (rfc822-address-start (point)))
+ (catch 'address ; this is for rfc822-bad-address
+ (rfc822-nuke-whitespace)
+ (while (not (eobp))
+ (setq rfc822-address-start (point))
+ (setq tem
+ (cond ((rfc822-looking-at ?\,)
+ nil)
+ ((looking-at "[][\000-\037@;:\\.>)]")
+ (forward-char)
+ (rfc822-bad-address
+ (format "Strange character \\%c found"
+ (preceding-char))))
+ (t
+ (rfc822-addresses-1 t))))
+ (cond ((null tem))
+ ((stringp tem)
+ (setq list (cons tem list)))
+ (t
+ (setq list (nconc (nreverse tem) list)))))
+ (nreverse list))))
(and buf (kill-buffer buf))))))
(provide 'rfc822)
With prefix argument N moves forward N messages with these labels."
(interactive "p\nsMove to next msg with labels: ")
(let (msg)
- (save-excursion
- (set-buffer rmail-buffer)
+ (with-current-buffer rmail-buffer
(rmail-next-labeled-message n labels)
(setq msg rmail-current-message))
(rmail-summary-goto-msg msg)))
With prefix argument N moves backward N messages with these labels."
(interactive "p\nsMove to previous msg with labels: ")
(let (msg)
- (save-excursion
- (set-buffer rmail-buffer)
+ (with-current-buffer rmail-buffer
(rmail-previous-labeled-message n labels)
(setq msg rmail-current-message))
(rmail-summary-goto-msg msg)))
(defun rmail-summary-undelete-many (&optional n)
"Undelete all deleted msgs, optional prefix arg N means undelete N prev msgs."
(interactive "P")
- (save-excursion
- (set-buffer rmail-buffer)
+ (with-current-buffer rmail-buffer
(let* ((init-msg (if n rmail-current-message rmail-total-messages))
(rmail-current-message init-msg)
(n (or n rmail-total-messages))
(rmail-show-message msg-num t))
(select-window owin))
(if (buffer-name rmail-buffer)
- (save-excursion
- (set-buffer rmail-buffer)
+ (with-current-buffer rmail-buffer
(rmail-show-message msg-num t))))))
(rmail-summary-update-highlight nil)))))
(curmsg (string-to-number
(buffer-substring (point)
(min (point-max) (+ 6 (point))))))
- (total (save-excursion (set-buffer buf) rmail-total-messages)))
+ (total (with-current-buffer buf rmail-total-messages)))
;; If message number N was specified, find that message's line
;; or set message-not-found.
;; If N wasn't specified or that message can't be found.
(defun rmail-summary-wipe ()
"Kill and wipe away Rmail summary, remaining within Rmail."
(interactive)
- (save-excursion (set-buffer rmail-buffer) (setq rmail-summary-buffer nil))
+ (with-current-buffer rmail-buffer (setq rmail-summary-buffer nil))
(let ((local-rmail-buffer rmail-buffer))
(kill-buffer (current-buffer))
;; Delete window if not only one.
(defun rmail-summary-expunge ()
"Actually erase all deleted messages and recompute summary headers."
(interactive)
- (save-excursion
- (set-buffer rmail-buffer)
+ (with-current-buffer rmail-buffer
(when (rmail-expunge-confirmed)
(rmail-only-expunge)))
(rmail-update-summary))
(list (if current-prefix-arg
(read-file-name "Get new mail from file: "))))
(let (msg)
- (save-excursion
- (set-buffer rmail-buffer)
+ (with-current-buffer rmail-buffer
(rmail-get-new-mail file-name)
;; Get the proper new message number.
(setq msg rmail-current-message))
(prefix-numeric-value current-prefix-arg))))
;; Don't use save-excursion because that prevents point from moving
;; properly in the summary buffer.
- (let ((buffer (current-buffer)))
- (unwind-protect
- (progn
- (set-buffer rmail-buffer)
- (rmail-search regexp (- n)))
- (set-buffer buffer))))
+ (with-current-buffer rmail-buffer
+ (rmail-search regexp (- n))))
(defun rmail-summary-search (regexp &optional n)
"Show message containing next match for REGEXP.
(defun rmail-summary-add-label (label)
"Add LABEL to labels associated with current Rmail message.
Completion is performed over known labels when reading."
- (interactive (list (save-excursion
- (set-buffer rmail-buffer)
+ (interactive (list (with-current-buffer rmail-buffer
(rmail-read-label "Add label"))))
- (save-excursion
- (set-buffer rmail-buffer)
+ (with-current-buffer rmail-buffer
(rmail-add-label label)))
(defun rmail-summary-kill-label (label)
"Remove LABEL from labels associated with current Rmail message.
Completion is performed over known labels when reading."
- (interactive (list (save-excursion
- (set-buffer rmail-buffer)
+ (interactive (list (with-current-buffer rmail-buffer
(rmail-read-label "Kill label"))))
- (save-excursion
- (set-buffer rmail-buffer)
+ (with-current-buffer rmail-buffer
(rmail-set-label label nil)))
\f
;;;; *** Rmail Summary Mailing Commands ***
The variables `rmail-secondary-file-directory' and
`rmail-secondary-file-regexp' control which files are offered in the menu."
(interactive)
- (save-excursion
- (set-buffer rmail-buffer)
+ (with-current-buffer rmail-buffer
(let ((rmail-delete-after-output nil))
(call-interactively 'rmail-output-menu)))
(if rmail-delete-after-output
"Write this message body to the file FILE-NAME.
FILE-NAME defaults, interactively, from the Subject field of the message."
(interactive)
- (save-excursion
- (set-buffer rmail-buffer)
+ (with-current-buffer rmail-buffer
(let ((rmail-delete-after-output nil))
(if file-name
(rmail-output-body-to-file file-name)
(let ((sendmail-coding-system smtpmail-code-conv-from))
(select-message-coding-system)))))
(unwind-protect
- (save-excursion
- (set-buffer tembuf)
+ (with-current-buffer tembuf
(erase-buffer)
;; Use the same `buffer-file-coding-system' as in the mail
;; buffer, otherwise any `write-region' invocations (e.g., in
(if sc-electric-circular-p
0
(progn (error msg "follow") (1- last))))))
- (save-excursion
- (set-buffer sc-electric-bufname)
- (let ((buffer-read-only nil))
- (erase-buffer)
- (goto-char (point-min))
- (sc-eref-insert-selected)
- ;; now shrink the window to just contain the electric reference
- ;; header.
- (let ((hdrlines (count-lines (point-min) (point-max)))
- (winlines (1- (window-height))))
- (if (/= hdrlines winlines)
- (if (> hdrlines winlines)
- ;; we have to enlarge the window
- (enlarge-window (- hdrlines winlines))
- ;; we have to shrink the window
- (shrink-window (- winlines (max hdrlines
- window-min-height))))))))))
+ (with-current-buffer sc-electric-bufname
+ (let ((inhibit-read-only t))
+ (erase-buffer)
+ (goto-char (point-min))
+ (sc-eref-insert-selected)
+ ;; now shrink the window to just contain the electric reference
+ ;; header.
+ (let ((hdrlines (count-lines (point-min) (point-max)))
+ (winlines (1- (window-height))))
+ (if (/= hdrlines winlines)
+ (if (> hdrlines winlines)
+ ;; we have to enlarge the window
+ (enlarge-window (- hdrlines winlines))
+ ;; we have to shrink the window
+ (shrink-window (- winlines (max hdrlines
+ window-min-height))))))))))
(defun sc-eref-next ()
"Display next reference in other buffer."
(interactive (list (upcase (following-char))))
(decipher-analyze)
(let (start end)
- (save-excursion
- (set-buffer (decipher-stats-buffer))
+ (with-current-buffer (decipher-stats-buffer)
(goto-char (point-min))
(or (re-search-forward (format "^%c: " cipher-char) nil t)
(error "Character `%c' is not used in ciphertext" cipher-char))
END-REGEXP matches the line after that which ends the display.
The ending line is included in the display unless it is blank."
(let (start end)
- (save-excursion
- (set-buffer (decipher-stats-buffer))
+ (with-current-buffer (decipher-stats-buffer)
(goto-char (point-min))
(re-search-forward start-regexp)
(beginning-of-line)
(aref decipher--after i)))
freq-list)
total-chars (+ total-chars (aref decipher--freqs i)))))
- (save-excursion
- ;; Switch to statistics buffer, creating it if necessary:
- (set-buffer (decipher-stats-buffer t))
+ ;; Switch to statistics buffer, creating it if necessary:
+ (with-current-buffer (decipher-stats-buffer t)
;; This can't happen, but it never hurts to double-check:
(or (eq major-mode 'decipher-stats-mode)
(error "Buffer %s is not in Decipher-Stats mode" (buffer-name)))
;; See if decipher-stats-buffer exists:
((and (bufferp decipher-stats-buffer)
(buffer-name decipher-stats-buffer))
- (or (save-excursion
- (set-buffer decipher-stats-buffer)
+ (or (with-current-buffer decipher-stats-buffer
(eq major-mode 'decipher-stats-mode))
(error "Buffer %s is not in Decipher-Stats mode"
(buffer-name decipher-stats-buffer)))
;; We just lost track of the statistics buffer:
(get-buffer stats-name)
(generate-new-buffer stats-name))))
- (save-excursion
- (set-buffer decipher-stats-buffer)
+ (with-current-buffer decipher-stats-buffer
(decipher-stats-mode))
decipher-stats-buffer)
;; Give up:
(provide 'decipher)
-;;;(defun decipher-show-undo-list ()
-;;; "Display the undo list (for debugging purposes)."
-;;; (interactive)
-;;; (with-output-to-temp-buffer "*Decipher Undo*"
-;;; (let ((undo-list decipher-undo-list)
-;;; undo-rec undo-map)
-;;; (save-excursion
-;;; (set-buffer "*Decipher Undo*")
-;;; (while (setq undo-rec (pop undo-list))
-;;; (or (consp (car undo-rec))
-;;; (setq undo-rec (list undo-rec)))
-;;; (insert ?\()
-;;; (while (setq undo-map (pop undo-rec))
-;;; (insert (cdr undo-map) (car undo-map) ?\ ))
-;;; (delete-backward-char 1)
-;;; (insert ")\n"))))))
+;;(defun decipher-show-undo-list ()
+;; "Display the undo list (for debugging purposes)."
+;; (interactive)
+;; (with-output-to-temp-buffer "*Decipher Undo*"
+;; (let ((undo-list decipher-undo-list)
+;; undo-rec undo-map)
+;; (with-current-buffer "*Decipher Undo*"
+;; (while (setq undo-rec (pop undo-list))
+;; (or (consp (car undo-rec))
+;; (setq undo-rec (list undo-rec)))
+;; (insert ?\()
+;; (while (setq undo-map (pop undo-rec))
+;; (insert (cdr undo-map) (car undo-map) ?\ ))
+;; (delete-backward-char 1)
+;; (insert ")\n"))))))
;; arch-tag: 8f094d88-ffe1-4f99-afe3-a5e81dd939d9
;;; decipher.el ends here
(setq last-query-point (point-max))
t))))
(let (start end)
- (save-excursion
- (set-buffer inbuf)
+ (with-current-buffer inbuf
(setq start (point))
(if (eq move-function 'forward-char)
(progn
(end-of-line)
(and (> (current-column) fill-column)
(do-auto-fill)))))
- (save-excursion
- (set-buffer inbuf)
+ (with-current-buffer inbuf
(if (eobp)
(goto-char (point-min))
(let ((overlap
(fort-file (expand-file-name
(substitute-in-file-name
(or file fortune-file)))))
- (save-excursion
- (set-buffer fortune-buffer)
+ (with-current-buffer fortune-buffer
(toggle-read-only 0)
(erase-buffer)
"Your move?"))
;; This may seem silly, but if one omits the following line (or a similar
;; one), the cursor may very well go to some place where POINT is not.
+ ;; FIXME: this can't be right!! --Stef
(save-excursion (set-buffer (other-buffer))))
(defun gomoku-prompt-for-other-game ()
"Your move?"))
;; This may seem silly, but if one omits the following line (or a similar
;; one), the cursor may very well go to some place where POINT is not.
+ ;; FIXME: this can't be right!! --Stef
(save-excursion (set-buffer (other-buffer))))
(defun lm-prompt-for-other-game ()
(defun lm-print-wts ()
(interactive)
- (save-excursion
- (set-buffer "*lm-wts*")
+ (with-current-buffer "*lm-wts*"
(insert "==============================\n")
(mapc 'lm-print-wts-int lm-directions)))
(defun lm-print-moves (moves)
(interactive)
- (save-excursion
- (set-buffer "*lm-moves*")
+ (with-current-buffer "*lm-moves*"
(insert (format "%S\n" moves))))
(defun lm-print-y,s,noise ()
(interactive)
- (save-excursion
- (set-buffer "*lm-y,s,noise*")
+ (with-current-buffer "*lm-y,s,noise*"
(insert "==============================\n")
(mapc 'lm-print-y,s,noise-int lm-directions)))
(defun lm-print-smell ()
(interactive)
- (save-excursion
- (set-buffer "*lm-smell*")
+ (with-current-buffer "*lm-smell*"
(insert "==============================\n")
(insert (format "tree: %S \n" (get 'z 't)))
(mapc 'lm-print-smell-int lm-directions)))
(defun lm-print-w0 ()
(interactive)
- (save-excursion
- (set-buffer "*lm-w0*")
+ (with-current-buffer "*lm-w0*"
(insert "==============================\n")
(mapc 'lm-print-w0-int lm-directions)))
(defun lm-blackbox ()
- (save-excursion
- (set-buffer "*lm-blackbox*")
+ (with-current-buffer "*lm-blackbox*"
(insert "==============================\n")
(insert "I smell: ")
(mapc (lambda (direction)
(lm-plot-landmarks)
(if lm-debug
- (progn
- (save-excursion
- (set-buffer (get-buffer-create "*lm-w0*"))
- (erase-buffer)
- (set-buffer (get-buffer-create "*lm-moves*"))
- (set-buffer (get-buffer-create "*lm-wts*"))
- (erase-buffer)
- (set-buffer (get-buffer-create "*lm-y,s,noise*"))
- (erase-buffer)
- (set-buffer (get-buffer-create "*lm-smell*"))
- (erase-buffer)
- (set-buffer (get-buffer-create "*lm-blackbox*"))
- (erase-buffer)
- (set-buffer (get-buffer-create "*lm-distance*"))
- (erase-buffer))))
+ (save-current-buffer
+ (set-buffer (get-buffer-create "*lm-w0*"))
+ (erase-buffer)
+ (set-buffer (get-buffer-create "*lm-moves*"))
+ (set-buffer (get-buffer-create "*lm-wts*"))
+ (erase-buffer)
+ (set-buffer (get-buffer-create "*lm-y,s,noise*"))
+ (erase-buffer)
+ (set-buffer (get-buffer-create "*lm-smell*"))
+ (erase-buffer)
+ (set-buffer (get-buffer-create "*lm-blackbox*"))
+ (erase-buffer)
+ (set-buffer (get-buffer-create "*lm-distance*"))
+ (erase-buffer)))
(lm-set-landmark-signal-strengths)
- (mapc (lambda (direction)
- (put direction 'y_t 0.0))
- lm-directions)
+ (dolist (direction lm-directions)
+ (put direction 'y_t 0.0))
(if (not save-weights)
(progn
(mapc 'lm-fix-weights-for lm-directions)
- (mapc (lambda (direction)
- (put direction 'w0 lm-initial-w0))
- lm-directions))
+ (dolist (direction lm-directions)
+ (put direction 'w0 lm-initial-w0)))
(message "Weights preserved for this run."))
(if auto-start
(let ((buf (get-buffer-create "*Mult Puzzle*"))
(face '(face mpuz-text))
buffer-read-only)
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(erase-buffer)
(insert mpuz-framework)
(set-text-properties 13 42 face)
(let* ((pos (event-end event))
(window (nth 0 pos))
(scale (nth 2 pos)))
- (save-excursion
- (set-buffer (window-buffer window))
+ (with-current-buffer (window-buffer window)
(cond
((eq (car scale) (cdr scale))
(goto-char (point-max)))
((eq window-pos 'vertical-line)
'default)
((consp window-pos)
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(let ((p (car (compute-motion (window-start window)
(cons (nth 0 edges) (nth 1 edges))
(window-end window)
+2009-11-03 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * 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.
+
2009-10-01 Glenn Morris <rgm@gnu.org>
* url-http.el (url-dav-file-attributes): Fix declaration.
(setq part (mm-get-content-id cid))
(if (not part)
(message "Unknown CID encountered: %s" cid)
- (setq data (save-excursion
- (set-buffer (mm-handle-buffer part))
+ (setq data (with-current-buffer (mm-handle-buffer part)
(buffer-string))
content-type (mm-handle-type part)
encoding (symbol-name (mm-handle-encoding part)))
(cond
((fboundp 'mm-get-content-id)
;; Using Pterodactyl Gnus or later
- (save-excursion
- (set-buffer (generate-new-buffer " *url-cid*"))
+ (with-current-buffer (generate-new-buffer " *url-cid*")
(url-cid-gnus (url-filename url))))
(t
(message "Unable to handle CID URL: %s" url))))
(defun url-imap (url)
(unless (vectorp url)
(signal 'wrong-type-error (list "Need a pre-parsed URL." url)))
- (save-excursion
- (set-buffer (generate-new-buffer " *url-imap*"))
+ (with-current-buffer (generate-new-buffer " *url-imap*")
(mm-disable-multibyte)
(let* ((host (url-host url))
(port (url-port url))
(setq url (url-generic-parse-url (url-unhex-string url)))
(if (not (vectorp url))
(error "Argument is not a valid URL")))
- (save-excursion
- (set-buffer (generate-new-buffer " *url-ldap*"))
+ (with-current-buffer (generate-new-buffer " *url-ldap*")
(setq url-current-object url)
(insert "Content-type: text/html\r\n\r\n")
(if (not (fboundp 'ldap-search-internal))
Each can be used any number of times.")
(defun url-nfs-unescape (format host port user pass file)
- (save-excursion
- (set-buffer (get-buffer-create " *nfs-parse*"))
+ (with-current-buffer (get-buffer-create " *nfs-parse*")
(erase-buffer)
(insert format)
(goto-char (point-min))
> ==> >
\" ==> ""
(if (string-match "[&<>\"]" string)
- (save-excursion
- (set-buffer (get-buffer-create " *entity*"))
+ (with-current-buffer (get-buffer-create " *entity*")
(erase-buffer)
(buffer-disable-undo (current-buffer))
(insert string)