Muli Ben-Yehuda's journal

February 14, 2004

Filed under: Uncategorized — Muli Ben-Yehuda @ 12:37 AM

Rewrote ljablog.el’s main loop to be more lispish in nature. Sexy!

 
(defun ljablog-post () 
  "Post a ljablog entry to both livejournal and advogato."  
  (interactive) 
  (let 
    ((blogs 
      '((lj-compose lj-post) 
        (advogato-start-post advogato-save-post)))) 
    (progn 
      (mark-whole-buffer) 
      (copy-region-as-kill (point-min) (point-max)) 
      (mapcar 
        (lambda (x) 
          (funcall (car x)) 
          (end-of-buffer) 
          (yank) 
          (if ljablog-debug-do-post 
            (funcall (cadr x)))) 
    blogs)))) 

6 Comments »

  1. Psssst: if it has *curves*, it’s sexy. All that has is indentations…

    Comment by shunra — February 13, 2004 @ 3:27 PM | Reply

  2. (looks
    &nbsp&nbsp ((cool)
    &nbsp&nbsp &nbsp&nbsp (2
    &nbsp&nbsp &nbsp&nbsp &nbsp&nbsp &nbsp&nbsp (me))))

    Comment by 77azkkr — February 13, 2004 @ 4:36 PM | Reply

  3. Ani lo mevin.
    It’s quite scary actually.

    Comment by luckluster — February 17, 2004 @ 11:14 AM | Reply

    • Here’s what it looks like now:

      (defun ljablog-post ()
        "Post a ljablog entry to both livejournal and advogato."
        (interactive)
        (let
            ((blogs (list
      	       (make-blog :compose-func 'lj-compose
      			  :pre-post-hook 'ljab-turn-lj-html-on
      			  :post-func 'lj-post
      			  :debug-really-post t)
      	       (make-blog :compose-func 'advogato-start-post
      			  :post-func 'advogato-save-post
      			  :debug-really-post t)))
             (buffer (current-buffer)))
          (mapcar
           (lambda (blog)
             (set-buffer buffer)
             (copy-region-as-kill (point-min) (point-max))
             (funcall (blog-compose-func blog))
             (end-of-buffer)
             (yank)
             (let ((hook (blog-pre-post-hook blog))
      	     (debug (blog-debug-really-post blog))
      	     (post (blog-post-func blog)))
      	 (when hook
      	   (funcall hook))
      	 (when debug
      	   (funcall post))))
           blogs)))
      

      Do you want me to explain it?

      Comment by mulix — February 17, 2004 @ 11:22 AM | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: