comparison lisp/emacs-lisp/ewoc.el @ 70523:bc300a06815f

(ewoc--set-buffer-bind-dll-let*): Use `with-current-buffer'.
author Thien-Thi Nguyen <ttn@gnuvola.org>
date Mon, 08 May 2006 08:00:38 +0000
parents f97678528ae8
children 84297e870585
comparison
equal deleted inserted replaced
70522:4f9cf38bdaa0 70523:bc300a06815f
219 "Execute FORMS with ewoc--buffer selected as current buffer, 219 "Execute FORMS with ewoc--buffer selected as current buffer,
220 dll bound to ewoc--dll, and VARLIST bound as in a let*. 220 dll bound to ewoc--dll, and VARLIST bound as in a let*.
221 dll will be bound when VARLIST is initialized, but the current 221 dll will be bound when VARLIST is initialized, but the current
222 buffer will *not* have been changed. 222 buffer will *not* have been changed.
223 Return value of last form in FORMS." 223 Return value of last form in FORMS."
224 (let ((old-buffer (make-symbol "old-buffer")) 224 (let ((hnd (make-symbol "ewoc")))
225 (hnd (make-symbol "ewoc"))) 225 `(let* ((,hnd ,ewoc)
226 `(let* ((,old-buffer (current-buffer))
227 (,hnd ,ewoc)
228 (dll (ewoc--dll ,hnd)) 226 (dll (ewoc--dll ,hnd))
229 ,@varlist) 227 ,@varlist)
230 (set-buffer (ewoc--buffer ,hnd)) 228 (with-current-buffer (ewoc--buffer ,hnd)
231 (unwind-protect 229 ,@forms))))
232 (progn ,@forms)
233 (set-buffer ,old-buffer)))))
234 230
235 (defmacro ewoc--set-buffer-bind-dll (ewoc &rest forms) 231 (defmacro ewoc--set-buffer-bind-dll (ewoc &rest forms)
236 `(ewoc--set-buffer-bind-dll-let* ,ewoc nil ,@forms)) 232 `(ewoc--set-buffer-bind-dll-let* ,ewoc nil ,@forms))
237 233
238 (defsubst ewoc--filter-hf-nodes (ewoc node) 234 (defsubst ewoc--filter-hf-nodes (ewoc node)