From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo de Moraes Serpa Subject: Help with elisp function Date: Thu, 12 Jan 2012 18:32:20 -0600 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=0015175cd3106f7a8604b65dffb0 Return-path: Received: from eggs.gnu.org ([140.186.70.92]:48454) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlV4B-0004Hc-1C for emacs-orgmode@gnu.org; Thu, 12 Jan 2012 19:32:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RlV49-0008U5-Pr for emacs-orgmode@gnu.org; Thu, 12 Jan 2012 19:32:23 -0500 Received: from mail-bk0-f41.google.com ([209.85.214.41]:41388) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlV49-0008Ty-Jc for emacs-orgmode@gnu.org; Thu, 12 Jan 2012 19:32:21 -0500 Received: by bkuw5 with SMTP id w5so2194529bku.0 for ; Thu, 12 Jan 2012 16:32:20 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org Mode --0015175cd3106f7a8604b65dffb0 Content-Type: text/plain; charset=ISO-8859-1 So, I made a small elisp function that basically creates a "reference file" in my org dir and indexes it in an org file, so it can be searchable with the agenda without the overhead of adding the file to the agenda list: (defun create-reference-file (filename title tags) "Creates a new reference and file it" (interactive (list (read-string "Filename: ") (read-string "Title: ") (read-string "Tags: ") )) (set-buffer (get-buffer-create filename)) (beginning-of-buffer) (insert (concat "* tags " tags)) ;;saves the buffer (when (file-writable-p filename) (write-region (point-min) (point-max) (concat "~/org/data/dynamic_reference/" filename ".org"))) (set-buffer (find-file-noselect "~/org/gtd/reference.org")) (end-of-buffer) ;;(create-wiki-page filename) (insert (concat "** " title " " tags ":reference:file:\n")) (org-insert-time-stamp nil t nil) (insert "\n") (insert (concat "[[file://~/org/data/dynamic_reference/" filename ".org]]")) (insert "\n") (save-buffer) ) I'm only beginning with elisp, so bear with me... Anyway, it works as expected, but I would like the tags prompt to be like the prompt org uses, with tags auto-completion and adding the : : automatically around the tags. Right now, I have to type the : around the words. Any hints appreciated! Marcelo. --0015175cd3106f7a8604b65dffb0 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable So, I made a small elisp function that basically creates a "reference = file" in my org dir and indexes it in an org file, so it can be search= able with the agenda without the overhead of adding the file to the agenda = list:

(defun create-reference-file (filename title tags) &quo= t;Creates a new reference and file it"
=A0 (interactive (lis= t
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (read-string "Filename: &q= uot;)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (read-string "Title: ")
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (read-string "Tags: ")
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ))
=A0 (set-buffer (get-buffer-c= reate filename))
=A0 (beginning-of-buffer)
=A0 (insert (concat "* tags " tags))
=A0 =A0;;save= s the buffer
=A0 =A0(when (file-writable-p filename)
= =A0 =A0 =A0 (write-region (point-min) (point-max) (concat "~/org/data/= dynamic_reference/" filename ".org")))
=A0 (set-buffer (find-file-noselect "~/org/gtd/reference.org"))
=A0 (end-of-buffer)
=A0 ;;(create-wiki-page filename)=A0
=A0 (insert (concat &q= uot;** " title " " tags ":reference:file:\n"))
=A0 (org-insert-time-stamp nil t nil)
=A0 (insert "\n&q= uot;)
=A0 (insert (concat "[[file://~/org/data/dynamic_refer= ence/" filename ".org]]"))
=A0 (insert "\n&qu= ot;)
=A0 (save-buffer)
=A0 )

I'= ;m only beginning with elisp, so bear with me...

A= nyway, it works as expected, but I would like the tags prompt to be like th= e prompt org uses, with tags auto-completion and adding the : : automatical= ly around the tags. Right now, I have to type the : around the words.

Any hints appreciated!

Marcelo= .
--0015175cd3106f7a8604b65dffb0--