Skip to content

Commit

Permalink
`twittering-render-a-field' returns whether the status is rendered.
Browse files Browse the repository at this point in the history
* twittering-mode.el: `twittering-render-a-field' returns nil if
the status is not rendered.
(twittering-render-a-field): return nil if the status is not
rendered.
(twittering-render-timeline): show replied statuses only if the
status is rendered.
  • Loading branch information
cvmat committed Feb 5, 2012
1 parent 2df090d commit fb3b143
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Expand Up @@ -34,6 +34,13 @@
`twittering-render-a-field'.
(twittering-show-replied-statuses): likewise.

* twittering-mode.el: `twittering-render-a-field' returns nil if
the status is not rendered.
(twittering-render-a-field): return nil if the status is not
rendered.
(twittering-render-timeline): show replied statuses only if the
status is rendered.

2012-01-29 Tadashi MATSUO <tad@mymail.twin.jp>

* twittering-mode.el: Follow the header conventions. Thanks to
Expand Down
25 changes: 14 additions & 11 deletions twittering-mode.el
Expand Up @@ -7411,7 +7411,9 @@ rendered at POS, return nil."
"Render a field on the current buffer managed by `twittering-mode'.
Insert a field to the position pointed by FIELD-ID. The position is searched
after POS. The string for the field is generated by the GENERATOR expression.
This function returns the position where the next status should be inserted."
This function does not render the status if a status with the same field ID
as FIELD-ID is already rendered.
Return non-nil if the status is rendered. Otherwise, return nil."
`(lexical-let ((pos ,pos)
(field-id ,field-id))
(while
Expand All @@ -7436,8 +7438,8 @@ This function returns the position where the next status should be inserted."
(insert formatted-status separator)
;; Use `insert-before-markers' in order to keep
;; which status is pointed by each marker.
(insert-before-markers formatted-status separator))))
(point)))
(insert-before-markers formatted-status separator))
t))))

(defun twittering-render-timeline (buffer &optional additional timeline-data keep-point)
(with-current-buffer buffer
Expand Down Expand Up @@ -7519,19 +7521,20 @@ This function returns the position where the next status should be inserted."
(split-string (or twittering-timeline-header "") "\n")
"\n")))
(twittering-render-a-field (point-min) footer-id footer t)
(twittering-render-a-field (point-min) header-id header t))
)))
(twittering-render-a-field (point-min) header-id header t)
(point)))))
(t
(setq pos (twittering-get-first-status-head))))
(goto-char pos)
(mapc
(lambda (status)
(twittering-render-a-field (point)
(twittering-make-field-id status)
(twittering-format-status status))
(when twittering-default-show-replied-tweets
(twittering-show-replied-statuses
twittering-default-show-replied-tweets)))
(cond
((twittering-render-a-field (point)
(twittering-make-field-id status)
(twittering-format-status status))
(when twittering-default-show-replied-tweets
(twittering-show-replied-statuses
twittering-default-show-replied-tweets)))))
timeline-data)))
(debug-print (current-buffer))
(cond
Expand Down

0 comments on commit fb3b143

Please sign in to comment.