Changeset 47 for lang/elisp/twittering-mode
- Timestamp:
- 05/11/08 12:53:10 (17 years ago)
- Location:
- lang/elisp/twittering-mode/trunk
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/elisp/twittering-mode/trunk/ChangeLog
r38 r47 1 2008-05-11 Tsuyoshi CHO <Tsuyoshi.CHO+develop@Gmail.com> 2 3 * twittering-mode.el (twittering-format-status): id/user-idのフォー 4 マット整形。時間情報にuriを付与。Nicholasのパッチにより全体に 5 username情報を付与 6 (twittering-status-to-status-datum): username/user-screen-nameにつ 7 いて整理 8 (twittering-get-status-url): 新規関数(マクロでもいいんだけど...) 9 1 10 2008-05-01 Tsuyoshi CHO <Tsuyoshi.CHO+develop@Gmail.com> 2 11 -
lang/elisp/twittering-mode/trunk/twittering-mode.el
r38 r47 46 46 (require 'parse-time) 47 47 48 (defconst twittering-mode-version "0. 4")48 (defconst twittering-mode-version "0.5") 49 49 50 50 (defun twittering-mode-version () … … 480 480 (list-push (attr 'user-url) result)) 481 481 ((?j) ; %j - user.id 482 (list-push ( attr 'user-id) result))482 (list-push (format "%d" (attr 'user-id)) result)) 483 483 ((?p) ; %p - protected? 484 484 (let ((protected (attr 'user-protected))) … … 499 499 (now (current-time))) 500 500 (let ((secs (+ (* (- (car now) (car created-at)) 65536) 501 (- (cadr now) (cadr created-at))))) 502 (list-push (cond ((< secs 5) "less than 5 seconds ago") 503 ((< secs 10) "less than 10 seconds ago") 504 ((< secs 20) "less than 20 seconds ago") 505 ((< secs 30) "half a minute ago") 506 ((< secs 60) "less than a minute ago") 507 ((< secs 150) "1 minute ago") 508 ((< secs 2400) (format "%d minutes ago" 509 (/ (+ secs 30) 60))) 510 ((< secs 5400) "about 1 hour ago") 511 ((< secs 84600) (format "about %d hours ago" 512 (/ (+ secs 1800) 3600))) 513 (t (format-time-string "%I:%M %p %B %d, %Y" created-at))) 514 result)))) 501 (- (cadr now) (cadr created-at)))) 502 time-string url) 503 (setq time-string 504 (cond ((< secs 5) "less than 5 seconds ago") 505 ((< secs 10) "less than 10 seconds ago") 506 ((< secs 20) "less than 20 seconds ago") 507 ((< secs 30) "half a minute ago") 508 ((< secs 60) "less than a minute ago") 509 ((< secs 150) "1 minute ago") 510 ((< secs 2400) (format "%d minutes ago" 511 (/ (+ secs 30) 60))) 512 ((< secs 5400) "about 1 hour ago") 513 ((< secs 84600) (format "about %d hours ago" 514 (/ (+ secs 1800) 3600))) 515 (t (format-time-string "%I:%M %p %B %d, %Y" created-at)))) 516 (setq url (twittering-get-status-url (attr 'user-screen-name) (attr 'id))) 517 ;; make status url clickable 518 (add-text-properties 519 0 (length time-string) 520 `(mouse-face highlight 521 face twittering-uri-face 522 uri ,url) 523 time-string) 524 (list-push time-string result)))) 515 525 ((?t) ; %t - text 516 526 (list-push ;(clickable-text) … … 524 534 (list-push (attr 'source) result)) 525 535 ((?#) ; %# - id 526 (list-push ( attr 'id) result))536 (list-push (format "%d" (attr 'id)) result)) 527 537 (t 528 538 (list-push (char-to-string c) result))) 529 539 ) 530 540 (list-push (substring format-str cursor) result) 531 (apply 'concat (nreverse result)) 541 (let ((formatted-status (apply 'concat (nreverse result)))) 542 (add-text-properties 0 (length formatted-status) 543 `(username ,(attr 'user-screen-name)) 544 formatted-status) 545 formatted-status) 532 546 ))) 533 547 … … 695 709 696 710 ;; make username clickable 697 (add-text-properties 0 (length user-screen-name) 698 `(mouse-face highlight 699 uri ,(concat "http://twitter.com/" user-screen-name) 700 username ,user-screen-name 701 face twittering-username-face) 702 user-screen-name) 711 (add-text-properties 712 0 (length user-name) 713 `(mouse-face highlight 714 uri ,(concat "http://twitter.com/" user-screen-name) 715 face twittering-username-face) 716 user-name) 717 718 ;; make screen-name clickable 719 (add-text-properties 720 0 (length user-screen-name) 721 `(mouse-face highlight 722 face twittering-username-face 723 uri ,(concat "http://twitter.com/" user-screen-name) 724 face twittering-username-face) 725 user-screen-name) 703 726 704 727 ;; make URI clickable … … 722 745 highlight 723 746 face twittering-uri-face 724 username ,screen-name725 747 uri ,(concat "http://twitter.com/" screen-name)) 726 748 `(mouse-face highlight … … 730 752 (setq regex-index (match-end 0)) )) 731 753 732 ;; make screen-name clickable733 (add-text-properties734 0 (length user-screen-name)735 `(mouse-face highlight736 face twittering-username-face737 uri ,(concat "http://twitter.com/" user-screen-name)738 username ,user-screen-name)739 user-screen-name)740 754 741 755 ;; make source pretty and clickable … … 1029 1043 (buffer-substring start-pos end-pos)))) 1030 1044 1045 (defun twittering-get-status-url (username id) 1046 "Generate status URL." 1047 (format "http://twitter.com/%s/statuses/%d" username id)) 1048 1031 1049 ;;;###autoload 1032 1050 (defun twit ()