From 9ad948e2fdc7bbe7caa00fd3460ef3f47087c9c3 Mon Sep 17 00:00:00 2001 From: Katsumi Yamaoka Date: Thu, 6 Dec 2012 03:30:23 +0000 Subject: [PATCH] Avoid letf macro use from Gnus gnus/gmm-utils.el (gmm-flet): Remove. gnus/gnus-sync.el (gnus-sync-lesync-call): Avoid overriding json-alist-p. gnus/message.el (message-read-from-minibuffer): Avoid overriding mail-abbrev-in-expansion-header-p. mail/mailabbrev.el (mail-abbrev-expand-wrapper): Work in minibuffer so as to enable message-read-from-minibuffer to expand mail aliases. --- lisp/ChangeLog | 5 +++++ lisp/gnus/ChangeLog | 10 ++++++++++ lisp/gnus/gmm-utils.el | 18 +----------------- lisp/gnus/gnus-sync.el | 20 +++++++++----------- lisp/gnus/message.el | 3 +-- lisp/mail/mailabbrev.el | 8 +++++--- 6 files changed, 31 insertions(+), 33 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cb5118cde40..3c0f28da4db 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-12-06 Katsumi Yamaoka + + * mail/mailabbrev.el (mail-abbrev-expand-wrapper): Work in minibuffer + so as to enable message-read-from-minibuffer to expand mail aliases. + 2012-12-06 Stefan Monnier * minibuf-eldef.el (minibuf-eldef-update-minibuffer): Don't mess with diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 522c688fc13..0dde5f6f9b2 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,13 @@ +2012-12-06 Katsumi Yamaoka + + * gmm-utils.el (gmm-flet): Remove. + + * gnus-sync.el (gnus-sync-lesync-call): + Avoid overriding json-alist-p. + + * message.el (message-read-from-minibuffer): + Avoid overriding mail-abbrev-in-expansion-header-p. + 2012-12-05 Sam Steingold * gnus.el (gnus-delete-gnus-frame): Extract from `gnus-other-frame'. diff --git a/lisp/gnus/gmm-utils.el b/lisp/gnus/gmm-utils.el index 91e4965e91c..92a39257a76 100644 --- a/lisp/gnus/gmm-utils.el +++ b/lisp/gnus/gmm-utils.el @@ -417,23 +417,7 @@ coding-system." (write-region start end filename append visit lockname)) (write-region start end filename append visit lockname mustbenew))) -;; `flet' and `labels' are 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) - +;; `labels' is obsolete since Emacs 24.3. (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/gnus-sync.el b/lisp/gnus/gnus-sync.el index e2a71f0ee01..0ec9fedffe3 100644 --- a/lisp/gnus/gnus-sync.el +++ b/lisp/gnus/gnus-sync.el @@ -88,7 +88,6 @@ (require 'gnus) (require 'gnus-start) (require 'gnus-util) -(require 'gmm-utils) (defvar gnus-topic-alist) ;; gnus-group.el (eval-when-compile @@ -177,16 +176,15 @@ 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." - (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" - method url `((headers . ,headers) (data ,kvdata)) data) - (kill-buffer (current-buffer)) - data))))) + (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" + method url `((headers . ,headers) (data ,kvdata)) data) + (kill-buffer (current-buffer)) + data)))) (defun gnus-sync-lesync-PUT (url headers &optional data) (gnus-sync-lesync-call url "PUT" headers data)) diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 2171dcf3edc..af5bee2056f 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -8141,8 +8141,7 @@ regexp VARSTR." (if (fboundp 'mail-abbrevs-setup) (let ((minibuffer-setup-hook 'mail-abbrevs-setup) (minibuffer-local-map message-minibuffer-local-map)) - (gmm-flet ((mail-abbrev-in-expansion-header-p nil t)) - (read-from-minibuffer prompt initial-contents))) + (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)))) diff --git a/lisp/mail/mailabbrev.el b/lisp/mail/mailabbrev.el index 2e4ffec1383..aa507897243 100644 --- a/lisp/mail/mailabbrev.el +++ b/lisp/mail/mailabbrev.el @@ -472,10 +472,12 @@ of a mail alias. The value is set up, buffer-local, when first needed.") (defun mail-abbrev-expand-wrapper (expand) (if (and mail-abbrevs (not (eq mail-abbrevs t))) - (if (mail-abbrev-in-expansion-header-p) + (if (or (mail-abbrev-in-expansion-header-p) + ;; Necessary for `message-read-from-minibuffer' to work. + (window-minibuffer-p)) - ;; We are in a To: (or CC:, or whatever) header, and - ;; should use word-abbrevs to expand mail aliases. + ;; We are in a To: (or CC:, or whatever) header or a minibuffer, + ;; and should use word-abbrevs to expand mail aliases. (let ((local-abbrev-table mail-abbrevs)) ;; Before anything else, resolve aliases if they need it. -- 2.39.2