From: Julien Danjou <julien@danjou.info>
To: emacs-devel@gnu.org
Cc: Julien Danjou <julien@danjou.info>
Subject: [PATCH] url-cache (url-store-in-cache): Make `buff' argument really optional
Date: Wed, 8 Sep 2010 14:51:00 +0200 [thread overview]
Message-ID: <1283950260-13227-1-git-send-email-julien@danjou.info> (raw)
Currently, `buff' is marked as optional, but if it is set to nil, the
function does nothing.
Signed-off-by: Julien Danjou <julien@danjou.info>
---
lisp/url/ChangeLog | 5 +++++
lisp/url/url-cache.el | 13 +++++--------
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog
index e3f76e7..2a69b48 100644
--- a/lisp/url/ChangeLog
+++ b/lisp/url/ChangeLog
@@ -1,3 +1,8 @@
+2010-09-08 Julien Danjou <julien@danjou.info>
+
+ * url-cache (url-store-in-cache): Make `buff' argument really
+ optional by using (current-buffer) if `buff' is nil.
+
2010-07-27 Michael Albinus <michael.albinus@gmx.de>
* url-http (url-http-parse-headers): Disable file name handlers at
diff --git a/lisp/url/url-cache.el b/lisp/url/url-cache.el
index 71841c9..ebd9f61 100644
--- a/lisp/url/url-cache.el
+++ b/lisp/url/url-cache.el
@@ -62,14 +62,11 @@ FILE can be created or overwritten."
;;;###autoload
(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))))))
;;;###autoload
(defun url-is-cached (url)
--
1.7.1
next reply other threads:[~2010-09-08 12:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-08 12:51 Julien Danjou [this message]
2010-09-10 21:25 ` [PATCH] url-cache (url-store-in-cache): Make `buff' argument really optional Glenn Morris
2010-09-10 21:40 ` Glenn Morris
2010-09-10 22:43 ` Julien Danjou
2010-09-13 14:33 ` Julien Danjou
2010-09-13 16:17 ` Glenn Morris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1283950260-13227-1-git-send-email-julien@danjou.info \
--to=julien@danjou.info \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).