del.icio.us and emacs
Posting directly to del.icio.us from emacs is pretty cool. Some quick changes to dp.pl make it even better:
#!/usr/bin/perl use strict; use lib "/path/to/perlmodule/dependencies"; use lib "/path/to/other/dependencies"; use Net::Delicious; use Log::Dispatch::Screen; my ($url,$dsc,$notes,$tag) = @ARGV; my $USER='your_del.icio.us_name'; my $PASSWORD='your_del.icio.us_password'; die "use: dp.pl url title notes tag" unless (defined($tag)); my $del = Net::Delicious->new({'user'=>$USER,'pswd'=>$PASSWORD}); my $result = $del->add_post({'url'=>$url, 'description'=>$dsc, 'extended'=>$notes, 'tags'=>$tag, 'shared'=>'yes'}); die "post failed\n" unless $result; 1;
Then, slip the following into .emacs:
(defun delicious-post-url () (interactive) (if (null (w3m-anchor)) (message "no anchor at point") (let ((url (w3m-anchor)) (title (buffer-substring-no-properties (previous-single-property-change (1+ (point)) 'w3m-href-anchor) (next-single-property-change (point) 'w3m-href-anchor)))) (if (w3m-url-valid url) (progn (setq delicious-notes (read-string "post notes: ")) (setq delicious-tags (read-string "post tags: ")) (setq delicious-cmd (concat "~/bin/dp.pl \"" url "\" \"" title "\" \"" delicious-notes "\" \"" delicious-tags "\"")) (shell-command (concat delicious-cmd))) (message "no URL at point!")))))
All code only slightly modified from here.
0 Comments:
Post a Comment
<< Home