Permalink
Browse files

Ensure that the pointed tweet is visible on editing a tweet.

* 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...
1 parent c519bad commit 8a8e4fed3df4302ef7ba952684c6c139be67d66f @cvmat cvmat committed Jan 16, 2011
Showing with 22 additions and 1 deletion.
  1. +6 −0 ChangeLog
  2. +16 −1 twittering-mode.el
View
@@ -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>
* twittering-mode.el: Ensure that encrypted strings are written
View
@@ -6251,12 +6251,27 @@ been initialized yet."
(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)
(interactive)
(let ((buf (generate-new-buffer twittering-edit-buffer)))
(setq twittering-pre-edit-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-setup-help username spec)
(if (twittering-timeline-spec-is-direct-messages-p spec)

0 comments on commit 8a8e4fe

Please sign in to comment.