From mboxrd@z Thu Jan 1 00:00:00 1970 From: andrea Crotti Subject: Final bookmark exporting Date: Mon, 2 Nov 2009 22:55:06 +0000 (UTC) Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N55oI-0001De-6H for emacs-orgmode@gnu.org; Mon, 02 Nov 2009 17:55:38 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N55oC-0001D8-QM for emacs-orgmode@gnu.org; Mon, 02 Nov 2009 17:55:36 -0500 Received: from [199.232.76.173] (port=57034 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N55oC-0001D5-K3 for emacs-orgmode@gnu.org; Mon, 02 Nov 2009 17:55:32 -0500 Received: from lo.gmane.org ([80.91.229.12]:54532) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1N55oC-0007AP-6D for emacs-orgmode@gnu.org; Mon, 02 Nov 2009 17:55:32 -0500 Received: from list by lo.gmane.org with local (Exim 4.50) id 1N55o8-0001px-OW for emacs-orgmode@gnu.org; Mon, 02 Nov 2009 23:55:28 +0100 Received: from ip116-027.hgracht.RWTH-Aachen.DE ([134.130.116.27]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 02 Nov 2009 23:55:28 +0100 Received: from andrea.crotti.0 by ip116-027.hgracht.RWTH-Aachen.DE with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 02 Nov 2009 23:55:28 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Given that I finally have my nice org-agenda-files defined I would also like to have an automatic bookmark exporting. I was thinking to something like hook on write-file that - checks if file is org-mode and in the org-directories - if it is and not in agenda files add it (and not do the whole scan again) - otherwise start the bookmark exportation for that file (and also ICS export) I don't know if it's possible to do them incrementally though. It would be nice to add only new bookmarks, but that could be complicated... And in plus I need a way to tell the programs to reload it. For ICS files I could just put them in a webdav directory but I don't know about bookmarks, any idea? Isn't there a format for bookmarks that work for every browser maybe? I tried this ugly code (defun org-to-bookmarks () (interactive) (dolist (org-file org-agenda-files) (find-file org-file) (org-export-html-bookmarks) (let ((fbook (concat (file-name-sans-extension org-file) "-bookmarks.html"))) (rename-file fbook (concat bookmark-dir (file-name-nondirectory fbook)))))) Which uses a function that I "stole" from here ;; TODO: add parameters for source and destination (defun org-export-html-bookmarks (&optional source-file dest-dir) "Extract bookmarks from the current org file and create an html file that can be imported into a web browser." (interactive) (unless (eq major-mode 'org-mode) (error "Not in an org buffer")) (let ((file (file-name-nondirectory (buffer-file-name))) bookmarks) (save-excursion (goto-char (point-min)) (while (re-search-forward org-bracket-link-analytic-regexp nil t) (when (equal (match-string 2) "http") (let ((url (concat (match-string 1) (match-string 3))) (desc (match-string 5))) (push (concat "
" desc "\n") bookmarks)))) (with-temp-buffer (insert "\n" "\n" "\n" "Bookmarks\n" "

Bookmarks

\n" "

" file " (" (format-time-string "%Y-%m-%d") ")

\n" "

\n") (apply 'insert (nreverse bookmarks)) (insert "

\n" "") (write-file (concat (file-name-sans-extension file) "-bookmarks.html")))))) It works but I need it more flexible..