Skip to content

Commit

Permalink
New tweet format specifier "%FILL{...}" is added.
Browse files Browse the repository at this point in the history
It applies `fill-region-as-paragraph' to the strings in braces.

* twittering-mode.el (twittering-format-status): add new format
specifier "%FILL{...}", which applies `fill-region-as-paragraph'
to the strings in braces.
  • Loading branch information
cvmat committed Jan 12, 2010
1 parent bc2a9a4 commit c63692e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Expand Up @@ -12,6 +12,10 @@
* twittering-mode.el (twittering-format-status): add new format
specifier "%T", which is converted to the raw text.

* twittering-mode.el (twittering-format-status): add new format
specifier "%FILL{...}", which applies `fill-region-as-paragraph'
to the strings in braces.

2010-01-12 Yuto Hayamizu <y.hayamizu@gmail.com>

* test/run-test.sh (exit_status): add 'emacs' command to test
Expand Down
20 changes: 20 additions & 0 deletions twittering-mode.el
Expand Up @@ -169,6 +169,8 @@ Items:
%T - raw text
%t - text filled as one paragraph
%' - truncated
%FILL{...} - strings filled as a paragrah.
You can use any other specifiers in braces.
%f - source
%# - id
")
Expand Down Expand Up @@ -1795,6 +1797,24 @@ following symbols;
(format-time-string time-format created-at)))))
("c" . ,(attr 'created-at))
("d" . ,(attr 'user-description))
("FILL{\\(.*?[^%]\\)}" .
,(lambda (context)
(let* ((str (cdr (assq 'following-string context)))
(match-data (cdr (assq 'match-data context)))
(from (cdr (assq 'from context)))
(prefix (cdr (assq 'prefix context)))
(table (cdr (assq 'replacement-table context)))
(mod-table
(cons '("}" . "}")
(delq (assq from table) table))))
(store-match-data match-data)
(let* ((formatted-str
(twittering-format-string
(match-string 1 str) prefix mod-table)))
(with-temp-buffer
(insert formatted-str)
(fill-region-as-paragraph (point-min) (point-max))
(buffer-substring (point-min) (point-max)))))))
("f" . ,(attr 'source))
("i" . (lambda (context) (profile-image)))
("j" . ,(attr 'user-id))
Expand Down

0 comments on commit c63692e

Please sign in to comment.