0

I currently have a keyboard shortcut bound to C-c t that shows me all of the NEXTACTION items I have, no matter what headline level they're at. It works by using a kbd macro wherein I just typed C-c / N <RET>, and that was enough to fill in everything I needed.

But now I would like that same shortcut to also show me WAITING items. I tried just recording the whole macro of C-c / NEXCTACTION|WAITING <RET>, and assigning that, but for some reason it still seems to use the old macro. I don't have any idea what's going on there, it's almost like it's ignoring that I've changed the macro.

Looking at the function help for org-sparse-tree directly, it seems that it accepts optional arguments, but I can't find any documentation describing how to use the function.

In short, all I want is a single keyboard shortcut that gives an org-sparse-tree on two keywords at the same time. Any ideas?

EDIT: This is the relevant part of my .emacs file:

(fset 'NEXTACTION-WAITING-org-tree
   [?\C-c ?/ ?T ?N ?E ?X ?T ?A ?C ?T ?I ?O ?N ?| ?W ?A ?I ?T ?I ?N ?G return])

(defun nextaction-org-tree-fun ()
  (progn
    (switch-to-buffer (find-file "~/orgfiles/personalorg.org"))
    (execute-kbd-macro (symbol-function 'NEXTACTION-WAITING-org-tree))))

(global-set-key (kbd "C-c t") (lambda ()
                                (interactive)
                                (nextaction-org-tree-fun)))

2 Answers 2

0

This is an attempt to answer your last question.

Idea

F3 C-c / r NEXTACTION\|WAITING RET F4
C-xk b F5

Then F5 yields the desired sparse tree.

5
  • I considered doing this, but the "WAITING" case-insensitively matches my "Waiting: on x and y" phrases. Is there a way to make the regex case sensitive, or will I have to change my waiting phrase?
    – Bronze
    Commented Nov 19, 2016 at 20:19
  • I don't know about the case-sensitivity at the moment.
    – Marco Wahl
    Commented Nov 20, 2016 at 11:41
  • What about C-c / T NEXTACTION|WAITING?
    – Marco Wahl
    Commented Nov 20, 2016 at 11:42
  • Curiously, typing it interactively in my org-mode buffer works, but defining it as a macro and then executing it does not. In fact, I even tried editing the macro to be sure that it was defined correctly. It is, but nevertheless it only shows me the NEXTACTION entries.
    – Bronze
    Commented Nov 21, 2016 at 20:31
  • I can not confirm your observation. Could you provide a CME?
    – Marco Wahl
    Commented Nov 22, 2016 at 9:50
0

I ended up solving my own problem with help from Marco Wahl by improving the regex a little: In org-mode, these to-do keywords must be surrounded by a space on either side. In my case that differentiates them enough from other instances of similar words. This makes it easy to search for them using the emacs regex:

\s-\(NEXTACTION\|WAITING\|term3\|term4\|...\)\s-

Then, using emacs macros, type:

F3
C-c / r \s-\(NEXTACTION\|WAITING\|term3\|term4\|...\)\s-
RET
F4

Then the macro can be assigned, inserted, etc. as you like.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.