From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arun Persaud Subject: Re: agenda question about representing items [PATCH] Date: Wed, 23 Jan 2013 15:28:19 -0800 Message-ID: <51007213.1050301@lbl.gov> References: <50FF5FA9.40203@lbl.gov> <2013-01-23T14-54-20@devnull.Karl-Voit.at> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------080600090503040506060108" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:39114) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ty9k3-0002jk-94 for emacs-orgmode@gnu.org; Wed, 23 Jan 2013 18:28:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ty9k1-0000gp-1G for emacs-orgmode@gnu.org; Wed, 23 Jan 2013 18:28:27 -0500 Received: from fe2.lbl.gov ([128.3.41.134]:55209) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ty9k0-0000gK-KR for emacs-orgmode@gnu.org; Wed, 23 Jan 2013 18:28:24 -0500 Received: by mail-pb0-f69.google.com with SMTP id un15so10042606pbc.4 for ; Wed, 23 Jan 2013 15:28:22 -0800 (PST) In-Reply-To: <2013-01-23T14-54-20@devnull.Karl-Voit.at> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org This is a multi-part message in MIME format. --------------080600090503040506060108 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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 --------------080600090503040506060108 Content-Type: text/x-patch; name="0001-added-option-b-to-dispaly-breadcrumbs-in-agenda.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-added-option-b-to-dispaly-breadcrumbs-in-agenda.patch" >From 2b22b753485bbb522f1f08902bd37c673b241637 Mon Sep 17 00:00:00 2001 From: Arun Persaud 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 --------------080600090503040506060108--