Skip to content

Commit

Permalink
Ensure that the pointed tweet is visible on editing a tweet.
Browse files Browse the repository at this point in the history
* twittering-mode.el: Ensure that the pointed tweet is visible on
editing a tweet.
(twittering-ensure-whole-of-status-is-visible): new function.
  • Loading branch information
cvmat committed Jan 16, 2011
1 parent c519bad commit 8a8e4fe
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
6 changes: 6 additions & 0 deletions ChangeLog
@@ -1,3 +1,9 @@
2011-01-16 Tadashi MATSUO <tad@mymail.twin.jp>

* twittering-mode.el: Ensure that the pointed tweet is visible on
editing a tweet.
(twittering-ensure-whole-of-status-is-visible): new function.

2011-01-09 Tadashi MATSUO <tad@mymail.twin.jp> 2011-01-09 Tadashi MATSUO <tad@mymail.twin.jp>


* twittering-mode.el: Ensure that encrypted strings are written * twittering-mode.el: Ensure that encrypted strings are written
Expand Down
17 changes: 16 additions & 1 deletion twittering-mode.el
Expand Up @@ -6251,12 +6251,27 @@ been initialized yet."


(defvar twittering-reply-recipient nil) (defvar twittering-reply-recipient nil)


(defun twittering-ensure-whole-of-status-is-visible (&optional window)
"Ensure that the whole of the tweet on the current point is visible."
(interactive)
(let ((window (or window (selected-window))))
(with-current-buffer (window-buffer window)
(save-excursion
(let* ((next-head (or (twittering-get-next-status-head) (point-max)))
(current-tail (max (1- next-head) (point-min))))
(when (< (window-end window t) current-tail)
(twittering-set-window-end window current-tail)))))))

(defun twittering-update-status-from-pop-up-buffer (&optional init-str reply-to-id username spec) (defun twittering-update-status-from-pop-up-buffer (&optional init-str reply-to-id username spec)
(interactive) (interactive)
(let ((buf (generate-new-buffer twittering-edit-buffer))) (let ((buf (generate-new-buffer twittering-edit-buffer)))
(setq twittering-pre-edit-window-configuration (setq twittering-pre-edit-window-configuration
(current-window-configuration)) (current-window-configuration))
(pop-to-buffer buf) ;; This is required because the new window generated by `pop-to-buffer'
;; may hide the region following the current position.
(let ((win (selected-window)))
(pop-to-buffer buf)
(twittering-ensure-whole-of-status-is-visible win))
(twittering-edit-mode) (twittering-edit-mode)
(twittering-edit-setup-help username spec) (twittering-edit-setup-help username spec)
(if (twittering-timeline-spec-is-direct-messages-p spec) (if (twittering-timeline-spec-is-direct-messages-p spec)
Expand Down

0 comments on commit 8a8e4fe

Please sign in to comment.