Programming

(Emacs Lisp) url-retrieve

steloflute 2013. 11. 28. 23:30
; synchronously    
(defun get-url (url)
  (with-current-buffer (url-retrieve-synchronously url) (buffer-string)))

(print (get-url "http://www.gnu.org"))

; asynchronously    
(defun print-url (url)
  (url-retrieve url (lambda (a) (print a))))

(print-url "http://www.gnu.org")


 

References

Retrieving URLs | http://www.gnu.org/software/emacs/manual/html_node/url/Retrieving-URLs.html

Current Buffer | http://www.gnu.org/software/emacs/manual/html_node/elisp/Current-Buffer.html

'Programming' 카테고리의 다른 글

Baby's First Garbage Collector  (0) 2013.12.09
Three algorithms for converting color to grayscale  (0) 2013.12.02
Emacs Lisp 시작하기  (0) 2013.11.27
(C) fibonacci number  (0) 2013.11.24
BUFSIZ  (0) 2013.11.24