From 4ed47b56a48fd0e02befb109ea7fe7ffa448eec0 Mon Sep 17 00:00:00 2001 From: Yuto Hayamizu Date: Mon, 7 Dec 2009 14:52:47 +0900 Subject: [PATCH] rename&refactor --- ChangeLog | 6 ++++++ twittering-mode.el | 28 ++++++++++++++-------------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index aa6fb717..cdabc947 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-12-07 Yuto Hayamizu + + * twittering-mode.el (twittering-read-username-with-completion): + rename from `twittering-get-username-with-completion' + (twittering-make-list-from-assoc): simplified + 2009-12-06 Tadashi MATSUO * twittering-mode.el (twittering-use-wget): new variable for diff --git a/twittering-mode.el b/twittering-mode.el index a3e688ae..bd901dec 100644 --- a/twittering-mode.el +++ b/twittering-mode.el @@ -1564,7 +1564,7 @@ return value of (funcall TO the-following-string the-match-data). (method (if remove "destroy" "create")) (mes (if remove "unfollowing" "following"))) (unless username - (setq username (twittering-get-username-with-completion + (setq username (twittering-read-username-with-completion "who: " "" 'twittering-user-history))) (if (> (length username) 0) (when (y-or-n-p (format "%s %s? " mes username)) @@ -1611,7 +1611,7 @@ return value of (funcall TO the-following-string the-match-data). (defun twittering-other-user-timeline-interactive () (interactive) (let ((username - (twittering-get-username-with-completion + (twittering-read-username-with-completion "user: " (or (get-text-property (point) 'screen-name-in-text) (get-text-property (point) 'username)) @@ -1622,9 +1622,10 @@ return value of (funcall TO the-following-string the-match-data). (defun twittering-other-user-list-interactive () (interactive) - (let ((username (twittering-get-username-with-completion + (let ((username (twittering-read-username-with-completion "whose list: " - (get-text-property (point) 'username)))) + (get-text-property (point) 'username) + 'twittering-user-history))) (if (> (length username) 0) (progn (setq twittering-list-index-retrieved nil) @@ -1658,17 +1659,16 @@ return value of (funcall TO the-following-string the-match-data). (twittering-update-status-from-minibuffer (concat "@" username " "))))) (defun twittering-make-list-from-assoc (key data) - (let ((ret nil)) - (mapc (lambda (status) - (push (cdr (assoc key status)) ret)) - data) - ret)) - -(defun twittering-get-username-with-completion (prompt init-user - &optional history) + (mapcar (lambda (status) + (cdr (assoc key status))) + data)) + +(defun twittering-read-username-with-completion (prompt init-user + &optional history) (completing-read prompt - (twittering-make-list-from-assoc - 'user-screen-name twittering-timeline-data) + (append (twittering-make-list-from-assoc + 'user-screen-name twittering-timeline-data) + twittering-user-history) nil nil init-user history)) (defun twittering-get-username ()