* Date-tree navigation question
@ 2012-03-05 15:28 Robert Horn
2012-03-05 18:34 ` Bernt Hansen
2012-03-09 20:35 ` Martin Pohlack
0 siblings, 2 replies; 3+ messages in thread
From: Robert Horn @ 2012-03-05 15:28 UTC (permalink / raw)
To: Org-mode list
Is there a short simple key sequence that will take you to the last
entry in a date-tree and open that headline? Slightly better would be a
way to go to the last, and open the last N headlines. It could be
generalized into "go to end of current item and open last N items of
whatever depth" when applied to other outline forms.
I know how to do this with tabs and cursor movement to walk down the
tree opening headlines as needed. This requires more work and paying
attention.
I have not found a simple way to do this. Does one exist?
R Horn
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Date-tree navigation question
2012-03-05 15:28 Date-tree navigation question Robert Horn
@ 2012-03-05 18:34 ` Bernt Hansen
2012-03-09 20:35 ` Martin Pohlack
1 sibling, 0 replies; 3+ messages in thread
From: Bernt Hansen @ 2012-03-05 18:34 UTC (permalink / raw)
To: rjhorn; +Cc: Org-mode list
Robert Horn <rjhorn@alum.mit.edu> writes:
> Is there a short simple key sequence that will take you to the last
> entry in a date-tree and open that headline? Slightly better would be
> a way to go to the last, and open the last N headlines. It could be
> generalized into "go to end of current item and open last N items of
> whatever depth" when applied to other outline forms.
>
> I know how to do this with tabs and cursor movement to walk down the
> tree opening headlines as needed. This requires more work and paying
> attention.
>
> I have not found a simple way to do this. Does one exist?
Can't you just do something like this on the top-level headline for the
tree
C-c C-k C-c C-f M-7 C-c C-p
(where N=7 in this example)
That puts the cursor on the 7th-last heading (hope that makes sense)
It's not particularly short though...
C-c C-k - show all siblings
C-c C-f - go forward to next headline
M-7 C-c C-p - go back to previous heading 7 times
or maybe
C-c C-f C-b C-c C-r
You should be able to build a local interactive function that takes a
prefix argument for N to get you where you want to be.
You can also use M-3 S-TAB to open show level 3 tasks and then navigate
the folded tree.
HTH,
Bernt
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Date-tree navigation question
2012-03-05 15:28 Date-tree navigation question Robert Horn
2012-03-05 18:34 ` Bernt Hansen
@ 2012-03-09 20:35 ` Martin Pohlack
1 sibling, 0 replies; 3+ messages in thread
From: Martin Pohlack @ 2012-03-09 20:35 UTC (permalink / raw)
To: rjhorn; +Cc: Org-mode list
Hi Robert,
Not sure what you want to do after opening but I have some code that
extracts a time range out of a date tree. Maybe you can reuse the
searching parts ...
Cheers,
Martin
----------------------------------------------------------------------
(defun mp26/org-find-headline-prefix-in-buffer (heading &optional buffer pos-only)
"Find node with heading-prefix HEADING in BUFFER.
Return a marker to the heading if it was found, or nil if not.
If POS-ONLY is set, return just the position instead of a marker.
The heading prefix must match as prefix of the full headline. It
may have a TODO keyword, a priority cookie and tags in the
standard locations."
(with-current-buffer (or buffer (current-buffer))
(save-excursion
(save-restriction
(widen)
(goto-char (point-min))
(let (case-fold-search)
(if (re-search-forward
(format org-complex-heading-regexp-format
(concat (regexp-quote heading) ".*")) nil t)
(if pos-only
(match-beginning 0)
(move-marker (make-marker) (match-beginning 0)))))))))
(defun mp26/org-week-from-journal ()
"Insert a copy of the current week from the journal."
(interactive)
(insert
(mapconcat
'identity
(with-current-buffer "Journal.org<Daten>"
(loop for days in '(-6 -5 -4 -3 -2 -1 0)
collect
(let* ((date (calendar-current-date days))
(date-string
(format "%d-%02d-%02d"
(nth 2 date) (nth 0 date) (nth 1 date))))
(setq pos (mp26/org-find-headline-prefix-in-buffer
date-string nil t))
(when pos
(goto-char pos)
(org-copy-subtree)
(car kill-ring)))))
"")))
----------------------------------------------------------------------
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-03-09 20:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-05 15:28 Date-tree navigation question Robert Horn
2012-03-05 18:34 ` Bernt Hansen
2012-03-09 20:35 ` Martin Pohlack
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).