Quantcast
Channel: programming musings: Posts tagged 'emacs'
Viewing all articles
Browse latest Browse all 2

emacs tip: tweeting from emacs-w3m

$
0
0

To follow twitter, i connect to a local Bitlbee server via emacs, using the Circe IRC client, and i browse the web using emacs-w3m.

I needed a command to automatically tweet about the page i am visiting. This being the emacs environment, i just wrote it in elisp.

The command will check if there’s a region selected in the buffer using use-region-p, in which case its contents is used as the tweet body, falling back to the page’s title. The only user-specific bit in the code below is the name that Bitlbee gives to the buffer of my twitter account, #twitter_jaotwits.

(defunjao-w3m-tweet(&optionalfromto)(interactive(when(use-region-p)(list(region-beginning)(region-end))))(let((url(orw3m-current-url(error"No URL to tweet!")))(txt(if(andfromto)(buffer-substringfromto)(w3m-current-title))))(switch-to-buffer"#twitter_jaotwits")(goto-char(point-max))(insert"'"txt"' -- "url)))

As you see, the command switches to the Bitlbee buffer and writes the contents of the tweet, but falls short of sending it, letting me to review the text before pushing return.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images