Skip to content

Instantly share code, notes, and snippets.

@mhayashi1120
Created July 30, 2011 16:27
Show Gist options
  • Save mhayashi1120/1115702 to your computer and use it in GitHub Desktop.
Save mhayashi1120/1115702 to your computer and use it in GitHub Desktop.
twittering-hashtag-patch
diff --git a/twittering-mode.el b/twittering-mode.el
index 91e0156..b1301ec 100644
--- a/twittering-mode.el
+++ b/twittering-mode.el
@@ -3384,6 +3384,9 @@ Before calling this, you have to configure `twittering-bitly-login' and
;; Unicode Character 'FULLWIDTH COMMERCIAL AT' (U+FF20)
(concat "\\(?:@\\|" (char-to-string full-width-commercial-at) "\\)")))
+(defvar twittering-regexp-hashtag-words
+ "\\(\\(?:\\w\\|[_-]\\)+\\)")
+
(defun twittering-timeline-spec-to-string (timeline-spec &optional shorten)
"Convert TIMELINE-SPEC into a string.
If SHORTEN is non-nil, the abbreviated expression will be used."
@@ -3459,7 +3462,7 @@ Return cons of the spec and the rest string."
`((home) . ,(substring str (match-end 0))))
((string-match (concat "^" twittering-regexp-atmark) str)
`((replies) . ,(substring str (match-end 0))))
- ((string-match (concat "^" twittering-regexp-hash "\\([a-zA-Z0-9_-]+\\)")
+ ((string-match (concat "^" twittering-regexp-hash twittering-regexp-hashtag-words)
str)
(let* ((tag (match-string 1 str))
(rest (substring str (match-end 0))))
@@ -5776,7 +5779,7 @@ following symbols;
'identity
(list
;; hashtag
- (concat regexp-hash "\\([a-zA-Z0-9_-]+\\)")
+ (concat regexp-hash twittering-regexp-hashtag-words)
;; @USER/LIST
(concat regexp-atmark
"\\(\\([a-zA-Z0-9_-]+\\)/\\([a-zA-Z0-9_-]+\\)\\)")
@@ -7159,7 +7162,7 @@ entry in `twittering-edit-skeleton-alist' are performed.")
(hashtags
(twittering-extract-matched-substring-all
(concat twittering-regexp-hash
- "\\([a-zA-Z0-9_-]+\\)")
+ twittering-regexp-hashtag-words)
text))
(footer
(mapconcat (lambda (tag) (concat "#" tag))
@@ -7172,7 +7175,7 @@ entry in `twittering-edit-skeleton-alist' are performed.")
current-spec))
(hashtag-list
(twittering-extract-matched-substring-all
- (concat "\\(" twittering-regexp-hash "[a-zA-Z0-9_-]+\\)")
+ (concat "\\(" twittering-regexp-hash twittering-regexp-hashtag-words "\\)")
query-string)))
(when hashtag-list
(let ((footer (mapconcat 'identity hashtag-list " ")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment