I added a custom template for the capture-mode:
The problem is that the default "Tasks" template is not there anymore.
So I tried to add this:
("t" "Tasks" entry
(file "~/Documents/org/notes.org"))
Now, when I press M-x org-capture, the "Tasks" option appears in the
template options list.
The default behaviour for the default Tasks template is to add the new
entries under the "* Tasks" headline.
How do I achieve that same feature?
How to add all new entries under a specific header in the .org file?
Thanks in advance for your kind help and time.
Jenia
P.S.
This is how I add the custom template to the org-capture templates list:
(setq org-capture-templates '(
("c" "Class" entry
(file "~/Documents/org/class.txt")
#'org-capture-class)
("n" "Exercise session" entry
(file "~/Documents/org/notes.org"))
("t" "Tasks" entry
(file "~/Documents/org/notes.org"))
))
You can tell org-mode which headline to file captures to with (file+headline "file" "Headline") in the capture template. So your example becomes
("t" "Tasks" entry
(file+headline "~/Documents/org/notes.org" "Tasks"))
Related
I am using org mode's agenda function (keyboard short cut: C-c a ) in order to make different sorted views of all my tasks. I do this by defining the variable org-agenda-custom-commands. If I have the following code in my init file:
(setq org-agenda-custom-commands'(
("p" "Projects" tags "PROJECT")
))
I can filter out tasks with the tag "PROJECT" by using the shortcut C-c a p. Likewise I can use the code:
(setq org-agenda-custom-commands'(
("t" "tasks to be done" tags-todo "TODO=\"TODO\" ")
))
to filter out task with todo status equal to TODO by using the shortcut C-c a t. My question is, how can I define org-aganda-custom-commands to filter out tasks with todo status equal to TODO AND with a tag equal to PROJECT ?
Thanks in advance : )
The tag search view is poorly named. It actually searches tags and properties. tag-todo adds an extra condition that only matches todo headlines. Use "+" to indicated that a condition is required (and "-" that it's forbidden). So +PROJECT+TODO=\"TODO\" will match headlines with the tag :PROJECT: and a todo keyword of TODO. Putting into a custom command looks like
(setq org-agenda-custom-commands
'(("p" "List Non-done projects"
tags "+PROJECT+TODO=\"TODO\"")))
I use org mode's capture functionality to make all my todo's. It is clean and practical and let me add a consistent content to all my todo's, including a prompt for heading, a prompt for tags and an automatic insertion of created date. Here is my code:
(setq org-capture-templates '((
"t" ; key
"Todo" ; description
entry ; type
(file+headline "C:/.../org/notes.org" "tasks") ; target
"* TODO [#B] %^{Todo} :%^{Tags}: \n:PROPERTIES:\n:Created: %U\n:END:\n\n%?" ; template
:prepend t ; properties
:empty-lines 1 ; properties
:created t ; properties
)))
However, my prompt for tags forces me to enter tags from memory. How could I add tags from the tags list set by the following code:
(setq org-tag-alist `(
("OFFICE" . ?o)
("HOME" . ?h)
("ERRAND" . ?e) ))
When my point is in the heading of an already created task, this list pops up when I hit C-c C-c and let me chose the tags by their short cut single letters "o", "h" or "e".
So my question is: is it possible to include this pop-up list of tags inside the code for my capture?
The built in solution is to use %^g. From the help for org-capture-templates:
%^g Prompt for tags, with completion on tags in target file.
%^G Prompt for tags, with completion on all tags in all agenda files.
You can also do this "by hand" by calling some function that adds the tags. Adding tags is generally done with org-set-tags (this is what C-c C-c is doing). So, all we have to do is call that in our template with the %(func) syntax:
(setq org-capture-templates '((
"t" ; key
"Todo" ; description
entry ; type
(file+headline "C:/.../org/notes.org" "tasks") ; target
"* TODO [#B] %^{Todo} %(org-set-tags) \n:PROPERTIES:\n:Created: %U\n:END:\n\n%?" ; template
:prepend t ; properties
:empty-lines 1 ; properties
:created t ; properties
)))
If you have a specific list of tags you want to select from (say org-tag-alist) you can use completing-read to select from it:
(completing-read "Tag: " (mapcar #'first org-tag-persistent-alist) nil t)
I would like to create an agenda view with org-agenda-custom-commands, which will connect capabilities todo-tree and tags-tree.
That's what I want to achieve, this sparse tree suited to such a search
C-c / m
JOB+TODO="NEXT"
I was able to find the answer. In .emacs I must add:
(setq org-agenda-custom-commands
'(
("j" "JOB next" tags-tree "JOB+TODO=\"NEXT\"" )))
I hate assigning tags when the tag already exists in the headline. I'd like to figure out a way to have org-mode evaluate a headline (preferably right after I hit "enter") and, if it contains any words that match tags in my org-tag-alist, have those tags created for the headline.
As an example:
If I have various individual's names and various project names and possibly even terms like "today", "tomorrow", and "next week" already in my org-tag-alist then, when I type something like:
"TODO Remember to ask Joe tomorrow about the due dates for the XYZ project."
and hit enter, then the headline would be evaluated and the tags :Joe:XYZ:Tomorrow: would be generated for the item.
Has anyone seen something like this or have a suggestion as to how I could go about it myself?
This function gets the headline of the entry the point is one, splits it into words and adds as a tag any word it finds in either org-tag-alist or org-tag-persistent-alist
(defun org-auto-tag ()
(interactive)
(let ((alltags (append org-tag-persistent-alist org-tag-alist))
(headline-words (split-string (org-get-heading t t)))
)
(mapcar (lambda (word) (if (assoc word alltags)
(org-toggle-tag word 'on)))
headline-words))
)
It might be useful to add a function like this to org-capture-before-finalize-hook to automatically tag newly captured entries.
I maintain a diary (internal blog containing thoughts to remember) in org-mode, and sometimes, as i study Emacs, i store learned skills and tricks with references to info files.
Currently i do the following. I open the needed info file, press c to copy current node name, press < s TAB - that is an easy template which unwraps into a src-block. Then i add lisp expression and paste node name and finally the link looks like this:
#+begin_src emacs-lisp
(info "(org) Properties and Columns")
#+end_src
When i need to view the info file, i put cursor after lisp sexp and press C-x C-e (eval-last-sexp).
This process is tedious and inelegant. What is the best way to embed links to info files in org-mode?
Edit: I've found how one can add links to info nodes. Org-mode manual on External links describes these equivalent methods using links:
[[info:org#Tags]]
[[elisp:(info "(org) Tags")]]
With the first variant i'm not sure how to automatically transform (org) Tags in org#Tags. How can i further simplify this process?
You do it as in any of the supported link types (see the "Handling
links" section in the manual). In the info file, you say M-x org-store-link,
(bind it to C-c l as suggested in the manual) and then in your org
file, you insert the link with C-c C-l. There you just have to
select the link to your info file from the list of stored links.
org-store-link says "Cannot link to a buffer which is not visiting a file" when visiting an Info page because Info sets the buffer-name to *info* and the buffer-file-name to nil. To work around this, the community contributed example of how to add linking to man pages (http://orgmode.org/manual/Adding-hyperlink-types.html) can be modified slightly:
;; Modified version of contrib/lisp/org-man.el; see
;; (http://orgmode.org/manual/Adding-hyperlink-types.html#Adding-hyperlink-types)
(require 'org)
(org-add-link-type "info" 'org-info-open)
(add-hook 'org-store-link-functions 'org-info-store-link)
(defcustom org-info-command 'info
"The Emacs command to be used to display an info page."
:group 'org-link
:type '(choice (const info)))
(defun org-info-open (path)
"Visit the infopage on PATH.
PATH should be a topic that can be thrown at the info command."
(funcall org-info-command path))
(defun org-info-store-link ()
"Store a link to an info page."
(when (memq major-mode '(Info-mode))
;; This is a info page, we do make this link
(let* ((page (org-info-get-page-name))
(link (concat "info:" page))
(description (format "Infopage for %s" page)))
(org-store-link-props
:type "info"
:link link
:description description))))
(defun org-info-get-page-name ()
"Extract the page name from Info in a hackish way."
;; This works for `Info-mode'.
;; Hackity-hack: copy the node name into the kill ring.
(Info-copy-current-node-name)
;; Just return the kill.
(current-kill 0))
(provide 'org-info)
The important bit is near the end: since the info node name is not directly accessible (not that I could easily find), we can work around it by calling Info-copy-current-node-name to put it in the kill-ring, then return the first entry in the kill-ring (which should be the just inserted node name).
The step that should work
- go to info node you need then press just 'c' (node-name will be
entry to kill ring)
- on your org source-file go to point you need to insert the link
press C-c,C-l
- press Tab then select elisp: from prompted buffer shown (or any kind
of link you need).Now your prompt in mini-buffer say elisp:
- entry this context after that ':' (info "^") ,let ^ be your
node-name yank back by C-y
- press Ret ,then you'll be ask for some description just fill it with
your own. Now you are done with it ,but still don't know what happen
really.
- M-x,visibility-mode,And there how to write that content manually and
we are now came to conclusion that "%20" must be replace every
occurence of space in the context.
eg.==> do it yourself ,see it yourself
- switch back your visibility-mode
GoodLuck