Changeset 135 for lang/elisp/twittering-mode
- Timestamp:
- 06/16/09 16:15:38 (15 years ago)
- Location:
- lang/elisp/twittering-mode/trunk
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/elisp/twittering-mode/trunk/ChangeLog
r81 r135 1 2009-06-17 Tsuyoshi CHO <Tsuyoshi.CHO+develop@Gmail.com> 2 3 * twittering-mode.el (twittering-last-timeline-interactive): New add variable. 4 (twittering-new-tweets-count): Ditto. 5 (twittering-new-tweets-hook): Ditto. 6 (twittering-mode-map): Add new binding v/V 7 (twittering-http-get-default-sentinel): Add new hook support 8 `twittering-new-tweets-hook'. 9 (twittering-render-timeline, twittering-get-timeline): Support 10 console emacs. 11 (twittering-current-timeline-interactive): Add new function. 12 (twittering-current-timeline-noninteractive): Ditto. 13 (twittering-other-user-timeline): Ditto. 14 (twittering-other-user-timeline-interactive): Ditto. 15 (twittering-status-to-status-datum): Add support status id and 16 reply to id. 17 (twittering-update-status-if-not-blank): Ditto. 18 (twittering-update-status-from-minibuffer): Ditto. 19 1 20 2009-03-12 Tsuyoshi CHO <Tsuyoshi.CHO+develop@Gmail.com> 2 21 -
lang/elisp/twittering-mode/trunk/twittering-mode.el
r134 r135 15 15 ;; twittering-public-timeline 16 16 ;; twittering-user-timeline 17 ;; twittering-current-timeline 17 ;; twittering-current-timeline(-(non)interractive) 18 ;; twittering-other-user-timeline 19 ;; twittering-other-user-timeline-interactive 18 20 19 21 ;; This file is free software; you can redistribute it and/or modify … … 52 54 (require 'parse-time) 53 55 54 (defconst twittering-mode-version "0. 6")56 (defconst twittering-mode-version "0.7") 55 57 56 58 (defun twittering-mode-version () … … 77 79 78 80 (defvar twittering-last-timeline-retrieved nil) 81 82 (defvar twittering-last-timeline-interactive nil) 83 84 (defvar twittering-new-tweets-count 0 85 "Number of new tweets when `twittering-new-tweets-hook' is run") 86 87 (defvar twittering-new-tweets-hook nil 88 "Hook run when new twits are received. 89 90 You can read `twittering-new-tweets-count' to get the number of new 91 tweets received when this hook is run.") 79 92 80 93 (defvar twittering-scroll-mode nil) … … 257 270 (define-key km [mouse-1] 'twittering-click) 258 271 (define-key km "\C-c\C-v" 'twittering-view-user-page) 259 (define-key km "g" 'twittering-current-timeline) 272 (define-key km "g" 'twittering-current-timeline-interactive) 273 (define-key km "v" 'twittering-other-user-timeline) 274 (define-key km "V" 'twittering-other-user-timeline-interactive) 260 275 ;; (define-key km "j" 'next-line) 261 276 ;; (define-key km "k" 'previous-line) … … 431 446 status 432 447 (("200 OK") 433 (mapcar 434 #'twittering-cache-status-datum 435 (reverse (twittering-xmltree-to-status 436 body))) 448 (setq twittering-new-tweets-count 449 (count t (mapcar 450 #'twittering-cache-status-datum 451 (reverse (twittering-xmltree-to-status 452 body))))) 453 (if (and (> twittering-new-tweets-count 0) 454 (not twittering-last-timeline-interactive)) 455 (run-hooks 'twittering-new-tweets-hook)) 456 (setq twittering-last-timeline-interactive t) 437 457 (twittering-render-timeline) 438 458 (message (if suc-msg suc-msg "Success: Get."))) … … 454 474 (insert "\n")) 455 475 twittering-timeline-data) 456 (if twittering-image-stack476 (if (and twittering-image-stack window-system) 457 477 (clear-image-cache)) 458 478 (setq buffer-read-only t) … … 527 547 (list-push (attr 'created-at) result)) 528 548 ((?C) ; %C{time-format-str} - created_at (formatted with 529 549 ; time-format-str) 530 550 (list-push (twittering-local-strftime 531 551 (or (match-string-no-properties 2 format-str) "%H:%M:%S") … … 759 779 `(mouse-face highlight 760 780 uri ,(concat "http://twitter.com/" user-screen-name) 781 status-id ,id 761 782 face twittering-username-face) 762 783 user-name) … … 766 787 0 (length user-screen-name) 767 788 `(mouse-face highlight 768 face twittering-username-face769 789 uri ,(concat "http://twitter.com/" user-screen-name) 790 status-id ,id 770 791 face twittering-username-face) 771 792 user-screen-name) … … 893 914 ))) 894 915 895 (defun twittering-update-status-if-not-blank (status )916 (defun twittering-update-status-if-not-blank (status &optional reply-to-id) 896 917 (if (string-match "^\\s-*\\(?:@[-_a-z0-9]+\\)?\\s-*$" status) 897 918 nil 898 (twittering-http-post "statuses" "update" 899 `(("status" . ,status) 900 ("source" . "twmode"))) 919 (let ((parameters `(("status" . ,status) 920 ("source" . "twmode")))) 921 (twittering-http-post "statuses" "update" 922 (if reply-to-id 923 (cons `("in_reply_to_status_id" . ,(format "%s" reply-to-id)) 924 parameters) 925 parameters))) 901 926 t)) 902 927 903 (defun twittering-update-status-from-minibuffer (&optional init-str) 928 (defun twittering-update-status-from-minibuffer (&optional init-str 929 reply-to-id) 904 930 (if (null init-str) (setq init-str "")) 905 931 (let ((status init-str) (not-posted-p t)) … … 907 933 (setq status (read-from-minibuffer "status: " status nil nil nil nil t)) 908 934 (setq not-posted-p 909 (not (twittering-update-status-if-not-blank status)))))) 935 (not (twittering-update-status-if-not-blank status reply-to-id)))) 936 )) 910 937 911 938 (defun twittering-update-lambda () … … 934 961 (interactive) 935 962 (if (null action) 936 (setq action #'twittering-current-timeline ))963 (setq action #'twittering-current-timeline-noninteractive)) 937 964 (if twittering-timer 938 965 nil … … 965 992 `(("since" . ,since))))))) 966 993 967 (if twittering-icon-mode994 (if (and twittering-icon-mode window-system) 968 995 (if twittering-image-stack 969 996 (let ((proc … … 1001 1028 (twittering-get-timeline "user_timeline")) 1002 1029 1030 (defun twittering-current-timeline-interactive () 1031 (interactive) 1032 (setq twittering-last-timeline-interactive t) 1033 (twittering-current-timeline)) 1034 1035 (defun twittering-current-timeline-noninteractive () 1036 (setq twittering-last-timeline-interactive nil) 1037 (twittering-current-timeline)) 1038 1003 1039 (defun twittering-current-timeline () 1004 (interactive)1005 1040 (if (not twittering-last-timeline-retrieved) 1006 1041 (setq twittering-last-timeline-retrieved "friends_timeline")) … … 1035 1070 (interactive) 1036 1071 (let ((username (get-text-property (point) 'username)) 1072 (status-id (get-text-property (point) 'status-id)) 1037 1073 (uri (get-text-property (point) 'uri))) 1038 1074 (if username 1039 (twittering-update-status-from-minibuffer (concat "@" username " ")) 1075 (twittering-update-status-from-minibuffer (concat "@" username " ") 1076 status-id) 1040 1077 (if uri 1041 1078 (browse-url uri))))) … … 1046 1083 (if uri 1047 1084 (browse-url uri)))) 1085 1086 (defun twittering-other-user-timeline () 1087 (interactive) 1088 (let ((username (get-text-property (point) 'username))) 1089 (if (> (length username) 0) 1090 (twittering-get-timeline (concat "user_timeline/" username)) 1091 (message "No user selected")))) 1092 1093 (defun twittering-other-user-timeline-interactive () 1094 (interactive) 1095 (let ((username (read-from-minibuffer "user: " (get-text-property (point) 'username)))) 1096 (if (> (length username) 0) 1097 (twittering-get-timeline (concat "user_timeline/" username)) 1098 (message "No user selected")))) 1048 1099 1049 1100 (defun twittering-reply-to-user ()