From 28cb9dd2c59dfe5e5711a99beb9a8a88fb6ba84f Mon Sep 17 00:00:00 2001 From: Satoshi Yatagawa Date: Sun, 10 Jan 2010 02:27:34 +0900 Subject: [PATCH] (twittering-read-username-with-completion): convert a list of username strings to an alist before calling 'completing-read' to work on Emacs21; same as 'twittering-read-timeline-spec-with-completion'. --- ChangeLog | 5 +++++ twittering-mode.el | 15 ++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 20b05dc2..c5544155 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,6 +19,11 @@ (twittering-timeline-spec-to-host-method): Likewise. (twittering-get-and-render-timeline): Likewise. + * twittering-mode.el (twittering-read-username-with-completion): + Convert a list of username strings to an alist before calling + `completing-read' to work on Emacs21; same as + `twittering-read-timeline-spec-with-completion'. + 2010-01-09 Tadashi MATSUO * twittering-mode.el (twittering-http-get-list-index-sentinel): diff --git a/twittering-mode.el b/twittering-mode.el index cc6e2225..6ed615cf 100644 --- a/twittering-mode.el +++ b/twittering-mode.el @@ -2384,11 +2384,16 @@ following symbols; data)) (defun twittering-read-username-with-completion (prompt init-user &optional history) - (completing-read prompt - (append (twittering-make-list-from-assoc - 'user-screen-name twittering-timeline-data) - twittering-user-history) - nil nil init-user history)) + ;; completing-read() of Emacs21 does not accepts candidates as a + ;; list. Candidates must be given as an alist. + (let ((user-alist (mapcar + (lambda (x) (cons x nil)) + (append (twittering-make-list-from-assoc + 'user-screen-name twittering-timeline-data) + twittering-user-history)))) + (when (fboundp 'delete-dups) + (delete-dups user-alist)) + (completing-read prompt user-alist nil nil init-user history))) (defun twittering-read-list-name (username &optional list-index) (let* ((list-index (or list-index