[gnus git] branch master updated: m0-5-176-g9fae745 =1= gmm-util.el: Re-introduce gmm-flet using cl-letf
Katsumi Yamaoka <[email protected]>
| Newsgroups | gmane.emacs.gnus.cvs |
|---|---|
| Message-ID | <[email protected]> |
via 9fae74515de8731b07e2af86674f33b636ca12a1 (commit)
from 7ff634144544b4cd94d3b5696ef76bcb155b2361 (commit)
- Log -----------------------------------------------------------------
commit 9fae74515de8731b07e2af86674f33b636ca12a1
Author: Katsumi Yamaoka <[email protected]>
Date: Wed Dec 5 02:26:02 2012 +0000
gmm-util.el: Re-introduce gmm-flet using cl-letf
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ebdf773..63a75b8 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,11 @@
2012-12-05 Katsumi Yamaoka <[email protected]>
+ * gmm-utils.el (gmm-flet): Restore it using cl-letf.
+ * gnus-sync.el (gnus-sync-lesync-call)
+ * message.el (message-read-from-minibuffer): Use it.
+
+2012-12-05 Katsumi Yamaoka <[email protected]>
+
* gmm-utils.el (gmm-flet): Remove.
* gnus-sync.el (gnus-sync-lesync-call)
* message.el (message-read-from-minibuffer): Don't use it.
diff --git a/lisp/gmm-utils.el b/lisp/gmm-utils.el
index 6a64dcf..ab42b14 100644
--- a/lisp/gmm-utils.el
+++ b/lisp/gmm-utils.el
@@ -417,7 +417,23 @@ coding-system."
(write-region start end filename append visit lockname))
(write-region start end filename append visit lockname mustbenew)))
-;; `labels' got obsolete since Emacs 24.3.
+;; `flet' and `labels' got obsolete since Emacs 24.3.
+(defmacro gmm-flet (bindings &rest body)
+ "Make temporary overriding function definitions.
+This is an analogue of a dynamically scoped `let' that operates on
+the function cell of FUNCs rather than their value cell.
+
+\(fn ((FUNC ARGLIST BODY...) ...) FORM...)"
+ (require 'cl)
+ (if (fboundp 'cl-letf)
+ `(cl-letf ,(mapcar (lambda (binding)
+ `((symbol-function ',(car binding))
+ (lambda ,@(cdr binding))))
+ bindings)
+ ,@body)
+ `(flet ,bindings ,@body)))
+(put 'gmm-flet 'lisp-indent-function 1)
+
(defmacro gmm-labels (bindings &rest body)
"Make temporary function bindings.
The bindings can be recursive and the scoping is lexical, but capturing
diff --git a/lisp/gnus-sync.el b/lisp/gnus-sync.el
index 877a079..8584e94 100644
--- a/lisp/gnus-sync.el
+++ b/lisp/gnus-sync.el
@@ -99,6 +99,7 @@
(require 'gnus)
(require 'gnus-start)
(require 'gnus-util)
+(require 'gmm-utils)
(defvar gnus-topic-alist) ;; gnus-group.el
(eval-when-compile
@@ -187,21 +188,16 @@ and `gnus-topic-alist'. Also see `gnus-variable-list'."
(defun gnus-sync-lesync-call (url method headers &optional kvdata)
"Make an access request to URL using KVDATA and METHOD.
KVDATA must be an alist."
- (let ((orig-json-alist-p (symbol-function 'json-alist-p)))
- (fset 'json-alist-p
- (lambda (list) (gnus-sync-json-alist-p list))) ; temp patch
- (unwind-protect
+ (gmm-flet ((json-alist-p (list) (gnus-sync-json-alist-p list))) ; temp patch
(let ((url-request-method method)
(url-request-extra-headers headers)
(url-request-data (if kvdata (json-encode kvdata) nil)))
(with-current-buffer (url-retrieve-synchronously url)
(let ((data (gnus-sync-lesync-parse)))
- (gnus-message
- 12 "gnus-sync-lesync-call: %s URL %s sent %S got %S"
+ (gnus-message 12 "gnus-sync-lesync-call: %s URL %s sent %S got %S"
method url `((headers . ,headers) (data ,kvdata)) data)
(kill-buffer (current-buffer))
- data)))
- (fset 'json-alist-p orig-json-alist-p))))
+ data)))))
(defun gnus-sync-lesync-PUT (url headers &optional data)
(gnus-sync-lesync-call url "PUT" headers data))
diff --git a/lisp/message.el b/lisp/message.el
index 34c8203..32d0edf 100644
--- a/lisp/message.el
+++ b/lisp/message.el
@@ -8184,13 +8184,9 @@ regexp VARSTR."
"Read from the minibuffer while providing abbrev expansion."
(if (fboundp 'mail-abbrevs-setup)
(let ((minibuffer-setup-hook 'mail-abbrevs-setup)
- (minibuffer-local-map message-minibuffer-local-map)
- (orig-m-a-i-e-h-p (symbol-function
- 'mail-abbrev-in-expansion-header-p)))
- (fset 'mail-abbrev-in-expansion-header-p (lambda (&rest args) t))
- (unwind-protect
- (read-from-minibuffer prompt initial-contents)
- (fset 'mail-abbrev-in-expansion-header-p orig-m-a-i-e-h-p)))
+ (minibuffer-local-map message-minibuffer-local-map))
+ (gmm-flet ((mail-abbrev-in-expansion-header-p nil t))
+ (read-from-minibuffer prompt initial-contents)))
(let ((minibuffer-setup-hook 'mail-abbrev-minibuffer-setup-hook)
(minibuffer-local-map message-minibuffer-local-map))
(read-string prompt initial-contents))))
-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.
Summary of changes:
lisp/ChangeLog | 6 ++++++
lisp/gmm-utils.el | 18 +++++++++++++++++-
lisp/gnus-sync.el | 26 +++++++++++---------------
lisp/message.el | 10 +++-------
4 files changed, 37 insertions(+), 23 deletions(-)
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".
The branch, master has been updated
hooks/post-receive
--
Gnus Project