Skip to content

Commit

Permalink
enable to detect wide charactors @' and #'.
Browse files Browse the repository at this point in the history
(twittering-regexp-hash): new defvar.
(twittering-regexp-atmark): likewise.
(twittering-extract-timeline-spec): use these.
(twittering-make-clickable-status-datum): likewise.
  • Loading branch information
yata committed Mar 27, 2010
1 parent 1fa7284 commit c6e81d2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Expand Up @@ -39,6 +39,13 @@
* twittering-mode.el (twittering-retrieve-image): Use
`create-image'.

2010-03-19 Satoshi Yatagawa <yata_github@y.hauN.org>

* twittering-mode.el (twittering-regexp-hash): New defvar.
(twittering-regexp-atmark): Likewise.
(twittering-extract-timeline-spec): Use these.
(twittering-make-clickable-status-datum): Likewise.

2010-03-19 Tadashi MATSUO <tad@mymail.twin.jp>

* twittering-mode.el (twittering-remove-inactive-processes): add
Expand Down
26 changes: 21 additions & 5 deletions twittering-mode.el
Expand Up @@ -689,6 +689,12 @@ as a list of a string on Emacs21."
,@body)))
clauses)))

(defvar twittering-regexp-hash
(concat "\\(?:#\\|" (char-to-string (twittering-ucs-to-char 65283)) "\\)"))

(defvar twittering-regexp-atmark
(concat "\\(?:@\\|" (char-to-string (twittering-ucs-to-char 65312)) "\\)"))

;;;
;;; Timeline spec functions
;;;
Expand Down Expand Up @@ -805,9 +811,10 @@ Return cons of the spec and the rest string."
`((user ,user) . ,rest)))
((string-match "^~" str)
`((home) . ,(substring str (match-end 0))))
((string-match "^@" str)
((string-match (concat "^" twittering-regexp-atmark) str)
`((replies) . ,(substring str (match-end 0))))
((string-match "^#\\([a-zA-Z0-9_-]+\\)" str)
((string-match (concat "^" twittering-regexp-hash "\\([a-zA-Z0-9_-]+\\)")
str)
(let* ((tag (match-string 1 str))
(query (concat "#" tag))
(rest (substring str (match-end 0))))
Expand Down Expand Up @@ -2366,9 +2373,17 @@ BUFFER may be a buffer or the name of an existing buffer."
user-screen-name)

;; make hashtag, listname, screenname, and URI in text clickable
(let ((pos 0))
(let ((pos 0)
(regexp-str
(concat twittering-regexp-hash
"\\([a-zA-Z0-9_-]+\\)\\|"
twittering-regexp-atmark
"\\([a-zA-Z0-9_-]+/[a-zA-Z0-9_-]+\\)\\|"
twittering-regexp-atmark
"\\([a-zA-Z0-9_-]+\\)\\|"
"\\(https?://[-_.!~*'()a-zA-Z0-9;/?:@&=+$,%#]+\\)")))
(while
(and (string-match "\\(#[a-zA-Z0-9_-]+\\)\\|@\\([a-zA-Z0-9_-]+/[a-zA-Z0-9_-]+\\)\\|@\\([a-zA-Z0-9_-]+\\)\\|\\(https?://[-_.!~*'()a-zA-Z0-9;/?:@&=+$,%#]+\\)" text pos)
(and (string-match regexp-str text pos)
(let ((next-pos (match-end 0))
(hashtag (match-string-no-properties 1 text))
(listname (match-string-no-properties 2 text))
Expand All @@ -2379,7 +2394,8 @@ BUFFER may be a buffer or the name of an existing buffer."
nil
(cond
(hashtag
(setq beg (match-beginning 1)
(setq hashtag (concat "#" hashtag)
beg (match-beginning 0) ;; XXX: not 1.
end (match-end 1)
prop `(mouse-face
highlight
Expand Down

0 comments on commit c6e81d2

Please sign in to comment.