Skip to content

Commit

Permalink
`twittering-get-first-status-head' returns nil if no statuses exist.
Browse files Browse the repository at this point in the history
* twittering-mode.el (twittering-get-first-status-head): return
nil if no statuses are rendered in the current buffer.
(twittering-goto-first-status): go to the beginning of buffer if
no statuses are rendered in the current buffer.
(twittering-render-timeline): render tweets from the beginning of
buffer if no statuses are rendered.
  • Loading branch information
cvmat committed Feb 15, 2010
1 parent 0a172c9 commit 7d71518
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
11 changes: 10 additions & 1 deletion ChangeLog
@@ -1,8 +1,17 @@
2010-02-16 Tadashi MATSUO <tad@mymail.twin.jp>

* twittering-mode.el (twittering-get-first-status-head): return
nil if no statuses are rendered in the current buffer.
(twittering-goto-first-status): go to the beginning of buffer if
no statuses are rendered in the current buffer.
(twittering-render-timeline): render tweets from the beginning of
buffer if no statuses are rendered.

2010-02-15 Satoshi Yatagawa <yata_github@y.hauN.org>

* twittering-mode.el (twittering-http-get-list-index-sentinel):
Get a listname from `slug' element which is only in `list' node.

2010-02-15 Tadashi MATSUO <tad@mymail.twin.jp>

* twittering-mode.el (twittering-get-and-render-timeline): copy
Expand Down
14 changes: 9 additions & 5 deletions twittering-mode.el
Expand Up @@ -2154,6 +2154,7 @@ BUFFER may be a buffer or the name of an existing buffer."
(with-current-buffer (twittering-buffer)
(let* ((timeline-data (or timeline-data
(twittering-current-timeline-data)))
(empty (null (twittering-get-first-status-head)))
(window-list (get-buffer-window-list (current-buffer) nil t))
(point-window-list
(mapcar (lambda (window)
Expand All @@ -2165,7 +2166,9 @@ BUFFER may be a buffer or the name of an existing buffer."
(save-excursion
(unless additional
(erase-buffer))
(let ((pos (twittering-get-first-status-head)))
(let ((pos (if empty
(point-min)
(twittering-get-first-status-head))))
(mapc
(lambda (status)
(let* ((id (cdr (assoc 'id status))))
Expand Down Expand Up @@ -3153,14 +3156,15 @@ variable `twittering-status-format'."
(defun twittering-goto-first-status ()
"Go to the first status."
(interactive)
(goto-char (twittering-get-first-status-head)))
(goto-char (or (twittering-get-first-status-head)
(point-min))))

(defun twittering-get-first-status-head ()
"Return the head position of the first status in the current buffer.
Return nil if no statuses are rendered."
(if (get-text-property (point-min) 'id)
(point-min)
(or (twittering-get-next-status-head (point-min))
;; The current buffer is empty.
(point-min))))
(twittering-get-next-status-head (point-min))))

(defun twittering-goto-next-status ()
"Go to next status."
Expand Down

0 comments on commit 7d71518

Please sign in to comment.