From: Arun Persaud <apersaud@lbl.gov>
To: emacs-orgmode@gnu.org
Subject: Re: agenda question about representing items [PATCH]
Date: Wed, 23 Jan 2013 15:28:19 -0800 [thread overview]
Message-ID: <51007213.1050301@lbl.gov> (raw)
In-Reply-To: <2013-01-23T14-54-20@devnull.Karl-Voit.at>
[-- Attachment #1: Type: text/plain, Size: 322 bytes --]
Hi
thanks everyone for the feedback! With it I managed to use the
%(expression) in org-agenda-prefix-format to show the breadcrumbs. In
case that's useful for other people too, I attached a patch that adds a
%b option to org-agenda-prefix-format to does the same. Would be great,
if this could be included.
Thanks
Arun
[-- Attachment #2: 0001-added-option-b-to-dispaly-breadcrumbs-in-agenda.patch --]
[-- Type: text/x-patch, Size: 4348 bytes --]
From 2b22b753485bbb522f1f08902bd37c673b241637 Mon Sep 17 00:00:00 2001
From: Arun Persaud <apersaud@lbl.gov>
Date: Wed, 23 Jan 2013 15:21:31 -0800
Subject: [PATCH] added option %b to dispaly breadcrumbs in agenda
if org file has the structure
* project
** task1
*** TODO item1
then when using %b in org-agenda-prefix-format will display
project->taks1->TODO item1
---
lisp/org-agenda.el | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index f48ff6f..9716345 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -1522,6 +1522,7 @@ This format works similar to a printf format, with the following meaning:
%T the last tag of the item (ignore inherited tags, which come first)
%t the HH:MM time-of-day specification if one applies to the entry
%s Scheduling/Deadline information, a short string
+ %b show breadcrumbs, i.e., the names of the higher levels
%(expression) Eval EXPRESSION and replace the control string
by the result
@@ -6301,6 +6302,9 @@ The flag is set if the currently compiled format contains a `%T'.")
(defvar org-prefix-has-effort nil
"A flag, set by `org-compile-prefix-format'.
The flag is set if the currently compiled format contains a `%e'.")
+(defvar org-prefix-has-breadcrumbs nil
+ "A flag, set by `org-compile-prefix-format'.
+The flag is set if the currently compiled format contains a `%b'.")
(defvar org-prefix-category-length nil
"Used by `org-compile-prefix-format' to remember the category field width.")
(defvar org-prefix-category-max-length nil
@@ -6448,6 +6452,10 @@ Any match of REMOVE-RE will be removed from TXT."
"......")))
(t ""))
extra (or (and (not habitp) extra) "")
+ breadcrumbs (let ((m (org-get-at-bol 'org-marker)))
+ (org-with-point-at m
+ (let ((s (org-display-outline-path nil nil "->" t)))
+ (concat s "->"))))
category (if (symbolp category) (symbol-name category) category)
thecategory (copy-sequence category)
level (or level ""))
@@ -6478,6 +6486,7 @@ Any match of REMOVE-RE will be removed from TXT."
'duration duration
'effort effort
'effort-minutes neffort
+ 'breadcrumbs breadcrumbs
'txt txt
'level level
'time time
@@ -6577,7 +6586,8 @@ and stored in the variable `org-prefix-format-compiled'."
(setq org-prefix-has-time nil
org-prefix-has-tag nil
org-prefix-category-length nil
- org-prefix-has-effort nil)
+ org-prefix-has-effort nil
+ org-prefix-has-breadcrumbs nil)
(let ((s (cond
((stringp org-agenda-prefix-format)
org-agenda-prefix-format)
@@ -6586,11 +6596,11 @@ and stored in the variable `org-prefix-format-compiled'."
(t " %-12:c%?-12t% s")))
(start 0)
varform vars var e c f opt)
- (while (string-match "%\\(\\?\\)?\\([-+]?[0-9.]*\\)\\([ .;,:!?=|/<>]?\\)\\([cltsei]\\|(.+)\\)"
+ (while (string-match "%\\(\\?\\)?\\([-+]?[0-9.]*\\)\\([ .;,:!?=|/<>]?\\)\\([cltseib]\\|(.+)\\)"
s start)
(setq var (or (cdr (assoc (match-string 4 s)
'(("c" . category) ("t" . time) ("l" . level) ("s" . extra)
- ("i" . category-icon) ("T" . tag) ("e" . effort))))
+ ("i" . category-icon) ("T" . tag) ("e" . effort) ("b" . breadcrumbs))))
'eval)
c (or (match-string 3 s) "")
opt (match-beginning 1)
@@ -6598,6 +6608,7 @@ and stored in the variable `org-prefix-format-compiled'."
(if (equal var 'time) (setq org-prefix-has-time t))
(if (equal var 'tag) (setq org-prefix-has-tag t))
(if (equal var 'effort) (setq org-prefix-has-effort t))
+ (if (equal var 'breadcrumbs) (setq org-prefix-has-breadcumbs t))
(setq f (concat "%" (match-string 2 s) "s"))
(when (equal var 'category)
(setq org-prefix-category-length
@@ -6624,7 +6635,8 @@ and stored in the variable `org-prefix-format-compiled'."
`((org-prefix-has-time ,org-prefix-has-time)
(org-prefix-has-tag ,org-prefix-has-tag)
(org-prefix-category-length ,org-prefix-category-length)
- (org-prefix-has-effort ,org-prefix-has-effort))
+ (org-prefix-has-effort ,org-prefix-has-effort)
+ (org-prefix-has-has-breadcrumbs ,org-prefix-has-breadcrumbs))
`(format ,s ,@vars))))))
(defun org-set-sorting-strategy (key)
--
1.8.1.1
next prev parent reply other threads:[~2013-01-23 23:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-23 3:57 agenda question about representing items Arun Persaud
2013-01-23 4:38 ` Nick Dokos
2013-01-23 14:04 ` Karl Voit
2013-01-23 23:28 ` Arun Persaud [this message]
2013-01-24 15:46 ` agenda question about representing items [PATCH] Bastien
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
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51007213.1050301@lbl.gov \
--to=apersaud@lbl.gov \
--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 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).