Skip to content

Commit

Permalink
rename&refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
hayamiz committed Dec 7, 2009
1 parent 16872db commit 4ed47b5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
@@ -1,3 +1,9 @@
2009-12-07 Yuto Hayamizu <y.hayamizu@gmail.com>

* 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 <matsuo@i.ci.ritsumei.ac.jp>

* twittering-mode.el (twittering-use-wget): new variable for
Expand Down
28 changes: 14 additions & 14 deletions twittering-mode.el
Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand All @@ -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)
Expand Down Expand Up @@ -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 ()
Expand Down

0 comments on commit 4ed47b5

Please sign in to comment.