From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Glenn Morris Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] url-cache (url-store-in-cache): Make `buff' argument really optional Date: Fri, 10 Sep 2010 17:25:09 -0400 Message-ID: References: <1283950260-13227-1-git-send-email-julien@danjou.info> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1284154068 6404 80.91.229.12 (10 Sep 2010 21:27:48 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 10 Sep 2010 21:27:48 +0000 (UTC) Cc: emacs-devel@gnu.org To: Julien Danjou Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 10 23:27:45 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OuB8K-0005Mr-L4 for ged-emacs-devel@m.gmane.org; Fri, 10 Sep 2010 23:27:44 +0200 Original-Received: from localhost ([127.0.0.1]:56302 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OuB8K-0006A3-1R for ged-emacs-devel@m.gmane.org; Fri, 10 Sep 2010 17:27:44 -0400 Original-Received: from [140.186.70.92] (port=54553 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OuB5l-0004hX-OA for emacs-devel@gnu.org; Fri, 10 Sep 2010 17:25:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OuB5k-00056M-H0 for emacs-devel@gnu.org; Fri, 10 Sep 2010 17:25:05 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]:47519) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OuB5k-00056I-Fl for emacs-devel@gnu.org; Fri, 10 Sep 2010 17:25:04 -0400 Original-Received: from rgm by fencepost.gnu.org with local (Exim 4.69) (envelope-from ) id 1OuB5p-0008Ky-7q; Fri, 10 Sep 2010 17:25:09 -0400 X-Spook: Glock CBNRC John Kerry rs9512c analyzer number key Mena X-Ran: *A;x3IjQf`Ipa\Vu$"8aU'-"$(}g*?$?MF<152o6t@6SK~)W`;'mc]4G1{mfDi%$?ajaQ" X-Hue: black X-Attribution: GM In-Reply-To: <1283950260-13227-1-git-send-email-julien@danjou.info> (Julien Danjou's message of "Wed\, 8 Sep 2010 14\:51\:00 +0200") User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:129931 Archived-At: 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.