|
From: | Glenn Morris |
Subject: | Re: [PATCH] url-cache (url-store-in-cache): Make `buff' argument really optional |
Date: | Fri, 10 Sep 2010 17:25:09 -0400 |
User-agent: | Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) |
Julien Danjou wrote: > (defun url-store-in-cache (&optional buff) > "Store buffer BUFF in the cache." > - (if (not (and buff (get-buffer buff))) > - nil > - (save-current-buffer > - (and buff (set-buffer buff)) > - (let* ((fname (url-cache-create-filename (url-view-url t)))) > - (if (url-cache-prepare fname) > - (let ((coding-system-for-write 'binary)) > - (write-region (point-min) (point-max) fname nil 5))))))) > + (with-current-buffer (get-buffer (or buff (current-buffer))) > + (let ((fname (url-cache-create-filename (url-view-url t)))) > + (if (url-cache-prepare fname) > + (let ((coding-system-for-write 'binary)) > + (write-region (point-min) (point-max) fname nil 5)))))) I think the original version was attempting to guard against the possibility of BUFF naming a dead or non-existent buffer, and your version has lost that feature.
[Prev in Thread] | Current Thread | [Next in Thread] |