Skip to content

Commit

Permalink
'twittering-read-list-name' is added.
Browse files Browse the repository at this point in the history
  • Loading branch information
cvmat committed Dec 20, 2009
1 parent e2b1851 commit 98fb6e4
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 19 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Expand Up @@ -262,6 +262,13 @@
(twittering-http-get-default-sentinel): Invokes
`twittering-add-timeline-history' to update history when
retrieving tweets successfully.
(twittering-other-user-list-interactive): The codes for retrieving
list index synchronously are extracted as the new function
`twittering-get-list-sync'.
(twittering-get-list-index-sync): Add new function for retrieving
list synchronously.
(twittering-read-list-name): Add new function for reading a list
name from the minibuffer.

2009-12-20 Yuto Hayamizu <y.hayamizu@gmail.com>

Expand Down
50 changes: 31 additions & 19 deletions twittering-mode.el
Expand Up @@ -1628,6 +1628,20 @@ following symbols;
t nil
'twittering-http-get-list-index-sentinel))

(defun twittering-get-list-index-sync (username)
(setq twittering-list-index-retrieved nil)
(twittering-get-list-index username)
(while (not twittering-list-index-retrieved)
(sit-for 0.1))
(cond
((stringp twittering-list-index-retrieved)
(if (string= "" twittering-list-index-retrieved)
(message (concat username " has no list"))
(message twittering-list-index-retrieved))
nil)
((listp twittering-list-index-retrieved)
twittering-list-index-retrieved)))

(defun twittering-manage-friendships (method username)
(twittering-http-post "twitter.com"
(concat "friendships/" method)
Expand Down Expand Up @@ -2026,25 +2040,11 @@ following symbols;
"whose list: "
(get-text-property (point) 'username)
'twittering-user-history)))
(if (> (length username) 0)
(progn
(setq twittering-list-index-retrieved nil)
(twittering-get-list-index username)
(while (not twittering-list-index-retrieved)
(sit-for 0.1))
(cond
((listp twittering-list-index-retrieved)
(let ((choice (completing-read
(concat username "'s list: ")
twittering-list-index-retrieved
nil t "")))
(when (and choice (not (string= "" choice)))
(twittering-get-list username choice))))
((stringp twittering-list-index-retrieved)
(if (string= "" twittering-list-index-retrieved)
(message (concat username " have no list"))
(message twittering-list-index-retrieved)))))
(message "No user selected"))))
(if (string= "" username)
(message "No user selected")
(let ((list-name (twittering-read-list-name username)))
(when list-name
(twittering-get-list username list-name))))))

(defun twittering-direct-message ()
(interactive)
Expand All @@ -2070,6 +2070,18 @@ following symbols;
twittering-user-history)
nil nil init-user history))

(defun twittering-read-list-name (username &optional list-index)
(let* ((list-index (or list-index
(twittering-get-list-index-sync username)))
(prompt (concat username "'s list: "))
(listname
(if list-index
(completing-read prompt list-index nil t nil)
nil)))
(if (string= "" listname)
nil
listname)))

(defun twittering-get-username ()
(or twittering-username-active
(setq twittering-username-active (read-string "your twitter username: "))))
Expand Down

0 comments on commit 98fb6e4

Please sign in to comment.