From: Olaf Dietsche <olaf+list.orgmode@olafdietsche.de>
To: Marcelo de Moraes Serpa <celoserpa@gmail.com>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: Help with elisp function
Date: Fri, 13 Jan 2012 09:45:10 +0100 [thread overview]
Message-ID: <87pqeoc7op.fsf@rat.lan> (raw)
In-Reply-To: <CACHMzOGettukgX_JwTW-whQhXY0XM92BJgCXgqhns5d0mdUzgQ@mail.gmail.com> (Marcelo de Moraes Serpa's message of "Thu, 12 Jan 2012 18:32:20 -0600")
Marcelo de Moraes Serpa <celoserpa@gmail.com> writes:
> 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.
C-h c C-c C-q runs the command org-set-tags-command.
org-set-tags-command calls org-set-tags. Looking through org-set-tags in
org.el, there's a part starting with a comment:
;; Get a new set of tags from the user
...
(let ((org-add-colon-after-tag-completion t))
(org-trim
(org-icompleting-read "Tags: "
'org-tags-completion-function
nil nil current 'org-tags-history))))))
...
So, I guess org-icompleting-read is, what you are looking for.
Regards, Olaf
next prev parent reply other threads:[~2012-01-13 8:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-13 0:32 Help with elisp function Marcelo de Moraes Serpa
2012-01-13 8:45 ` Olaf Dietsche [this message]
2012-01-14 19:28 ` Marcelo de Moraes Serpa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pqeoc7op.fsf@rat.lan \
--to=olaf+list.orgmode@olafdietsche.de \
--cc=celoserpa@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.