Twitter access from GNU Emacs
twittering-mode allows you to access Twitter from GNU Emacs. If you have curl installed on your system, it mostly works out of the box except for images. Use u for new tweet, RET for reply, and C-c C-m or C-c RET for retweet.
For images, you need to follow these instructions. It basically defines a new format string %I for images in (twittering-generate-format-table).
("I" .
(let* ((entities (cdr (assq 'entity ,status-sym)))
text)
(mapc (lambda (url-info)
(setq text (or (cdr (assq 'media-url url-info)) "")))
(cdr (assq 'media entities)))
(if (string-equal "" text)
text
(let ((twittering-convert-fix-size 360))
(twittering-make-icon-string nil nil text)))))
(let* ((entities (cdr (assq 'entity ,status-sym)))
text)
(mapc (lambda (url-info)
(setq text (or (cdr (assq 'media-url url-info)) "")))
(cdr (assq 'media entities)))
(if (string-equal "" text)
text
(let ((twittering-convert-fix-size 360))
(twittering-make-icon-string nil nil text)))))
You can also change the display format string to suit your needs. Typically, you'd change the faces and the placement of fill string.
(setq twittering-use-native-retweet t
twittering-status-format
" %i %FACE[font-lock-function-name-face]{@%s} %FACE[italic]{%@} %FACE[error]{%FIELD-IF-NONZERO[❤ %d]{favorite_count}} %FACE[warning]{%FIELD-IF-NONZERO[↺ %d]{retweet_count}}
%FOLD[ ]{%FILL{%t}
%QT{
%FOLD[ ]{%FACE[font-lock-function-name-face]{@%s}\t%FACE[shadow]{%@}
%FOLD[ ]{%FILL{%t}}
}}}
%FILL{ %I}
%FACE[underline]{ }
")
" %i %FACE[font-lock-function-name-face]{@%s} %FACE[italic]{%@} %FACE[error]{%FIELD-IF-NONZERO[❤ %d]{favorite_count}} %FACE[warning]{%FIELD-IF-NONZERO[↺ %d]{retweet_count}}
%FOLD[ ]{%FILL{%t}
%QT{
%FOLD[ ]{%FACE[font-lock-function-name-face]{@%s}\t%FACE[shadow]{%@}
%FOLD[ ]{%FILL{%t}}
}}}
%FILL{ %I}
%FACE[underline]{ }
")
Comments
Post a Comment