* [PATCH] Allow org-collector to display heading indentation
@ 2012-03-30 19:43 ` Nicolas Girard
2012-03-30 19:52 ` Achim Gratz
2012-03-30 19:52 ` Nick Dokos
0 siblings, 2 replies; 11+ messages in thread
From: Nicolas Girard @ 2012-03-30 19:43 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1075 bytes --]
Hi all,
attached is a patch which adds a new parameter "indent" to the
propview dynamic bloc, with the following behaviour:
#+BEGIN_SRC org
,* Tree
,:PROPERTIES:
,:COLUMNS: %8ITEM %4prop1 %5prop2
,:ID: tree
,:END:
,** A
,:PROPERTIES:
,:prop1: 10
,:prop2: 20
,:END:
,*** A1
,:PROPERTIES:
,:prop1: 15
,:prop2: 19
,:END:
,*** A2
,:PROPERTIES:
,:prop1: 20
,:prop2: 18
,:END:
,** B
,:PROPERTIES:
,:prop1: 25
,:prop2: 10
,:END:
,*** B1
,:PROPERTIES:
,:prop1: 2
,:prop2: 4
,:END:
,*** B2
,:PROPERTIES:
,:prop1: 3
,:prop2: 5
,:END:
#+END_SRC
#+BEGIN: propview :id tree :cols (ITEM prop1) :noquote t :indent t
| ITEM | prop1 |
|--------+-------|
| Tree | 0 |
| \- A | 10 |
| \-- A1 | 15 |
| \-- A2 | 20 |
| \- B | 25 |
| \-- B1 | 2 |
| \-- B2 | 3 |
|--------+-------|
| | |
#+END
I wish the indentation to be displayed with nothing but spaces, but
they would be trimmed by org-table guts ; so that's middly satisfying,
but better than nothing :-)
Cheers,
Nicolas
[-- Attachment #2: org-collector.el.diff --]
[-- Type: application/octet-stream, Size: 1816 bytes --]
diff --git a/contrib/lisp/org-collector.el b/contrib/lisp/org-collector.el
index ad198ed..bc9dfae 100644
--- a/contrib/lisp/org-collector.el
+++ b/contrib/lisp/org-collector.el
@@ -121,6 +121,7 @@ preceeding the dblock, then update the contents of the dblock."
(scope (plist-get params :scope))
(noquote (plist-get params :noquote))
(colnames (plist-get params :colnames))
+ (indent (plist-get params :indent))
(content-lines (org-split-string (plist-get params :content) "\n"))
id table line pos)
(save-excursion
@@ -135,7 +136,7 @@ preceeding the dblock, then update the contents of the dblock."
(setq stringformat (if noquote "%s" "%S"))
(setq table (org-propview-to-table
(org-propview-collect cols stringformat conds match scope inherit
- (if colnames colnames cols)) stringformat))
+ (if colnames colnames cols) indent) stringformat))
(widen))
(setq pos (point))
(when content-lines
@@ -171,13 +172,18 @@ variables and values specified in props"
(when p (cons n p))))
inherit))))
-(defun org-propview-collect (cols stringformat &optional conds match scope inherit colnames)
+(defun org-propview-collect (cols stringformat &optional conds match scope inherit colnames indent)
(interactive)
;; collect the properties from every header
(let* ((header-props
(let ((org-trust-scanner-tags t) alst)
(org-map-entries
- (quote (cons (cons "ITEM" (org-get-heading t))
+ (quote (cons (cons "ITEM"
+ (let ((item (org-get-heading t))
+ (level (- (org-current-level) 1)))
+ (if (and indent (> level 0))
+ (format "\\%s %s"
+ (make-string level ?- ) item) item)))
(org-propview-get-with-inherited inherit)))
match scope)))
;; read property values
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] Allow org-collector to display heading indentation
2012-03-30 19:43 ` [PATCH] Allow org-collector to display heading indentation Nicolas Girard
@ 2012-03-30 19:52 ` Achim Gratz
2012-03-30 19:52 ` Nick Dokos
1 sibling, 0 replies; 11+ messages in thread
From: Achim Gratz @ 2012-03-30 19:52 UTC (permalink / raw)
To: emacs-orgmode
Nicolas Girard writes:
> I wish the indentation to be displayed with nothing but spaces, but
> they would be trimmed by org-table guts ; so that's middly satisfying,
> but better than nothing :-)
Then use a non-breaking space and be fully satisfied.
Regards,
Achim.
--
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+
Waldorf MIDI Implementation & additional documentation:
http://Synth.Stromeko.net/Downloads.html#WaldorfDocs
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Allow org-collector to display heading indentation
2012-03-30 19:43 ` [PATCH] Allow org-collector to display heading indentation Nicolas Girard
2012-03-30 19:52 ` Achim Gratz
@ 2012-03-30 19:52 ` Nick Dokos
2012-03-30 20:55 ` Nicolas Girard
1 sibling, 1 reply; 11+ messages in thread
From: Nick Dokos @ 2012-03-30 19:52 UTC (permalink / raw)
To: Nicolas Girard; +Cc: nicholas.dokos, emacs-orgmode
Nicolas Girard <girard.nicolas@gmail.com> wrote:
> Hi all,
> attached is a patch ...
Attachments with mime type "application/octet-stream" are *not* caught
by patchwork. Please resubmit the patch in a proper attachment: see
http://orgmode.org/worg/org-contribute.html#sec-4-3 for details.
Nick
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Allow org-collector to display heading indentation
2012-03-30 19:52 ` Nick Dokos
@ 2012-03-30 20:55 ` Nicolas Girard
2012-03-31 6:57 ` Sebastien Vauban
0 siblings, 1 reply; 11+ messages in thread
From: Nicolas Girard @ 2012-03-30 20:55 UTC (permalink / raw)
To: emacs-orgmode
From eaf9e5f06279069ed1072425fd020d8f0442d04f Mon Sep 17 00:00:00 2001
From: Nicolas Girard <girard.nicolas@gmail.com>
Date: Fri, 30 Mar 2012 22:53:13 +0200
Subject: [PATCH] Allow org-collector to display heading indentation
---
contrib/lisp/org-collector.el | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/contrib/lisp/org-collector.el b/contrib/lisp/org-collector.el
index da612e9..2476d62 100644
--- a/contrib/lisp/org-collector.el
+++ b/contrib/lisp/org-collector.el
@@ -121,6 +121,7 @@ preceeding the dblock, then update the contents of
the dblock."
(scope (plist-get params :scope))
(noquote (plist-get params :noquote))
(colnames (plist-get params :colnames))
+ (indent (plist-get params :indent))
(content-lines (org-split-string (plist-get params :content) "\n"))
id table line pos)
(save-excursion
@@ -135,7 +136,7 @@ preceeding the dblock, then update the contents of
the dblock."
(setq stringformat (if noquote "%s" "%S"))
(setq table (org-propview-to-table
(org-propview-collect cols stringformat conds match scope inherit
- (if colnames colnames cols)) stringformat))
+ (if colnames colnames cols) indent) stringformat))
(widen))
(setq pos (point))
(when content-lines
@@ -171,13 +172,18 @@ variables and values specified in props"
(when p (cons n p))))
inherit))))
-(defun org-propview-collect (cols stringformat &optional conds match
scope inherit colnames)
+(defun org-propview-collect (cols stringformat &optional conds match
scope inherit colnames indent)
(interactive)
;; collect the properties from every header
(let* ((header-props
(let ((org-trust-scanner-tags t) alst)
(org-map-entries
- (quote (cons (cons "ITEM" (org-get-heading t))
+ (quote (cons (cons "ITEM"
+ (let ((item (org-get-heading t))
+ (level (- (org-current-level) 1)))
+ (if (and indent (> level 0))
+ (format "\\%s %s"
+ (make-string level ?- ) item) item)))
(org-propview-get-with-inherited inherit)))
match scope)))
;; read property values
--
1.7.8.rc1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] Allow org-collector to display heading indentation
2012-03-30 20:55 ` Nicolas Girard
@ 2012-03-31 6:57 ` Sebastien Vauban
2012-03-31 23:58 ` Nicolas Girard
2012-03-31 23:59 ` [PATCH 1/2] Simplify org-clocktable-indent-string Nicolas Girard
0 siblings, 2 replies; 11+ messages in thread
From: Sebastien Vauban @ 2012-03-31 6:57 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hi Nicolas,
Nicolas Girard wrote:
> From eaf9e5f06279069ed1072425fd020d8f0442d04f Mon Sep 17 00:00:00 2001
> From: Nicolas Girard <girard.nicolas-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Date: Fri, 30 Mar 2012 22:53:13 +0200
> Subject: [PATCH] Allow org-collector to display heading indentation
>
> ---
> contrib/lisp/org-collector.el | 12 +++++++++---
> 1 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/contrib/lisp/org-collector.el b/contrib/lisp/org-collector.el
> index da612e9..2476d62 100644
> --- a/contrib/lisp/org-collector.el
> +++ b/contrib/lisp/org-collector.el
> @@ -121,6 +121,7 @@ preceeding the dblock, then update the contents of
> the dblock."
> (scope (plist-get params :scope))
> (noquote (plist-get params :noquote))
> (colnames (plist-get params :colnames))
> + (indent (plist-get params :indent))
> (content-lines (org-split-string (plist-get params :content) "\n"))
> id table line pos)
> (save-excursion
> @@ -135,7 +136,7 @@ preceeding the dblock, then update the contents of
> the dblock."
> (setq stringformat (if noquote "%s" "%S"))
> (setq table (org-propview-to-table
> (org-propview-collect cols stringformat conds match scope inherit
> - (if colnames colnames cols)) stringformat))
> + (if colnames colnames cols) indent) stringformat))
> (widen))
> (setq pos (point))
> (when content-lines
> @@ -171,13 +172,18 @@ variables and values specified in props"
> (when p (cons n p))))
> inherit))))
>
> -(defun org-propview-collect (cols stringformat &optional conds match
> scope inherit colnames)
> +(defun org-propview-collect (cols stringformat &optional conds match
> scope inherit colnames indent)
> (interactive)
> ;; collect the properties from every header
> (let* ((header-props
> (let ((org-trust-scanner-tags t) alst)
> (org-map-entries
> - (quote (cons (cons "ITEM" (org-get-heading t))
> + (quote (cons (cons "ITEM"
> + (let ((item (org-get-heading t))
> + (level (- (org-current-level) 1)))
> + (if (and indent (> level 0))
> + (format "\\%s %s"
> + (make-string level ?- ) item) item)))
You may want to follow the "indent" convention used for clockview: "\__"
string.
Have a look at (or reuse?) the function `org-clocktable-indent-string'...
> (org-propview-get-with-inherited inherit)))
> match scope)))
> ;; read property values
Best regards,
Seb
--
Sebastien Vauban
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Allow org-collector to display heading indentation
2012-03-31 6:57 ` Sebastien Vauban
@ 2012-03-31 23:58 ` Nicolas Girard
2012-03-31 23:59 ` [PATCH 1/2] Simplify org-clocktable-indent-string Nicolas Girard
1 sibling, 0 replies; 11+ messages in thread
From: Nicolas Girard @ 2012-03-31 23:58 UTC (permalink / raw)
To: emacs-orgmode
2012/3/31 Sebastien Vauban <wxhgmqzgwmuf@spammotel.com>:
>
> You may want to follow the "indent" convention used for clockview: "\__"
> string.
>
> Have a look at (or reuse?) the function `org-clocktable-indent-string'...
>
Hi Sébastien,
fair enough ; not that I like underscores much better but it makes
sense for the indentation in both tables to be similar.
I've rewritten my code in this respect.
Cheers,
Nicolas
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/2] Simplify org-clocktable-indent-string.
2012-03-31 6:57 ` Sebastien Vauban
2012-03-31 23:58 ` Nicolas Girard
@ 2012-03-31 23:59 ` Nicolas Girard
2012-03-31 23:59 ` [PATCH 2/2] Allow org-collector to display heading indentation by passing ':indent t' to the propview block Nicolas Girard
2012-04-20 11:12 ` [PATCH 1/2] Simplify org-clocktable-indent-string Bastien
1 sibling, 2 replies; 11+ messages in thread
From: Nicolas Girard @ 2012-03-31 23:59 UTC (permalink / raw)
To: emacs-orgmode; +Cc: Nicolas Girard
---
lisp/org-clock.el | 6 +-----
1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 591f59c..be66ce6 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -2342,11 +2342,7 @@ from the dynamic block definition."
(defun org-clocktable-indent-string (level)
(if (= level 1)
""
- (let ((str "\\__"))
- (while (> level 2)
- (setq level (1- level)
- str (concat str "___")))
- (concat str " "))))
+ (concat "\\" (make-string (* 2 (1- level)) ?_ ) " ")))
(defun org-clocktable-steps (params)
"Step through the range to make a number of clock tables."
--
1.7.8.rc1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/2] Allow org-collector to display heading indentation by passing ':indent t' to the propview block.
2012-03-31 23:59 ` [PATCH 1/2] Simplify org-clocktable-indent-string Nicolas Girard
@ 2012-03-31 23:59 ` Nicolas Girard
2012-04-02 16:56 ` Bastien
2012-04-20 11:12 ` Bastien
2012-04-20 11:12 ` [PATCH 1/2] Simplify org-clocktable-indent-string Bastien
1 sibling, 2 replies; 11+ messages in thread
From: Nicolas Girard @ 2012-03-31 23:59 UTC (permalink / raw)
To: emacs-orgmode; +Cc: Nicolas Girard
---
contrib/lisp/org-collector.el | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/contrib/lisp/org-collector.el b/contrib/lisp/org-collector.el
index da612e9..2f5e598 100644
--- a/contrib/lisp/org-collector.el
+++ b/contrib/lisp/org-collector.el
@@ -91,6 +91,7 @@
;;; Code:
(require 'org)
+(require 'org-clock)
(require 'org-table)
(defvar org-propview-default-value 0
@@ -98,6 +99,11 @@
value is calculated either through lack of required variables for
a column, or through the generation of an error.")
+(defvar org-propview-indent-function 'org-clocktable-indent-string
+ "A function called with the heading level. Should return a
+string which will be concatenated to the ITEM property when
+':indent t' is passed to the propview block.")
+
(defun and-rest (list)
(if (listp list)
(if (> (length list) 1)
@@ -121,6 +127,7 @@ preceeding the dblock, then update the contents of the dblock."
(scope (plist-get params :scope))
(noquote (plist-get params :noquote))
(colnames (plist-get params :colnames))
+ (indent (plist-get params :indent))
(content-lines (org-split-string (plist-get params :content) "\n"))
id table line pos)
(save-excursion
@@ -134,8 +141,8 @@ preceeding the dblock, then update the contents of the dblock."
(org-narrow-to-subtree)
(setq stringformat (if noquote "%s" "%S"))
(setq table (org-propview-to-table
- (org-propview-collect cols stringformat conds match scope inherit
- (if colnames colnames cols)) stringformat))
+ (org-propview-collect cols stringformat conds match scope inherit
+ (if colnames colnames cols) indent) stringformat))
(widen))
(setq pos (point))
(when content-lines
@@ -171,14 +178,19 @@ variables and values specified in props"
(when p (cons n p))))
inherit))))
-(defun org-propview-collect (cols stringformat &optional conds match scope inherit colnames)
+(defun org-propview-collect (cols stringformat &optional conds match scope inherit colnames indent)
(interactive)
;; collect the properties from every header
(let* ((header-props
(let ((org-trust-scanner-tags t) alst)
(org-map-entries
- (quote (cons (cons "ITEM" (org-get-heading t))
- (org-propview-get-with-inherited inherit)))
+ (quote
+ (cons (cons "ITEM"
+ (let ((item (org-get-heading t))
+ (level (org-current-level)))
+ (concat
+ (funcall org-propview-indent-function level) item)))
+ (org-propview-get-with-inherited inherit)))
match scope)))
;; read property values
(header-props
--
1.7.8.rc1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] Allow org-collector to display heading indentation by passing ':indent t' to the propview block.
2012-03-31 23:59 ` [PATCH 2/2] Allow org-collector to display heading indentation by passing ':indent t' to the propview block Nicolas Girard
@ 2012-04-02 16:56 ` Bastien
2012-04-20 11:12 ` Bastien
1 sibling, 0 replies; 11+ messages in thread
From: Bastien @ 2012-04-02 16:56 UTC (permalink / raw)
To: Nicolas Girard; +Cc: emacs-orgmode
Hi Nicolas,
Nicolas Girard <girard.nicolas@gmail.com> writes:
> ---
> contrib/lisp/org-collector.el | 22 +++++++++++++++++-----
> 1 files changed, 17 insertions(+), 5 deletions(-)
Thanks for the patch. Can you add an Emacs ChangeLog entry?
See http://orgmode.org/worg/org-contribute.html#sec-5 for details.
Also, have you signed the FSF papers?
I'm sending you the form to fill in in a private email.
Thanks,
--
Bastien
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] Simplify org-clocktable-indent-string.
2012-03-31 23:59 ` [PATCH 1/2] Simplify org-clocktable-indent-string Nicolas Girard
2012-03-31 23:59 ` [PATCH 2/2] Allow org-collector to display heading indentation by passing ':indent t' to the propview block Nicolas Girard
@ 2012-04-20 11:12 ` Bastien
1 sibling, 0 replies; 11+ messages in thread
From: Bastien @ 2012-04-20 11:12 UTC (permalink / raw)
To: Nicolas Girard; +Cc: emacs-orgmode
Hi Nicolas,
Nicolas Girard <girard.nicolas@gmail.com> writes:
> ---
> lisp/org-clock.el | 6 +-----
> 1 files changed, 1 insertions(+), 5 deletions(-)
>
> diff --git a/lisp/org-clock.el b/lisp/org-clock.el
> index 591f59c..be66ce6 100644
> --- a/lisp/org-clock.el
> +++ b/lisp/org-clock.el
> @@ -2342,11 +2342,7 @@ from the dynamic block definition."
> (defun org-clocktable-indent-string (level)
> (if (= level 1)
> ""
> - (let ((str "\\__"))
> - (while (> level 2)
> - (setq level (1- level)
> - str (concat str "___")))
> - (concat str " "))))
> + (concat "\\" (make-string (* 2 (1- level)) ?_ ) " ")))
>
> (defun org-clocktable-steps (params)
> "Step through the range to make a number of clock tables."
The "simplification" does not produce the same output.
I rejected this patch.
--
Bastien
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] Allow org-collector to display heading indentation by passing ':indent t' to the propview block.
2012-03-31 23:59 ` [PATCH 2/2] Allow org-collector to display heading indentation by passing ':indent t' to the propview block Nicolas Girard
2012-04-02 16:56 ` Bastien
@ 2012-04-20 11:12 ` Bastien
1 sibling, 0 replies; 11+ messages in thread
From: Bastien @ 2012-04-20 11:12 UTC (permalink / raw)
To: Nicolas Girard; +Cc: emacs-orgmode
Hi Nicolas,
the patch does not apply against master and does not have a changelog
entry. Please resubmit it with a Changelog entry and check that it
applies against master correctly.
Thanks,
--
Bastien
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2012-04-20 11:11 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <girard.nicolas@gmail.com>
2012-03-30 19:43 ` [PATCH] Allow org-collector to display heading indentation Nicolas Girard
2012-03-30 19:52 ` Achim Gratz
2012-03-30 19:52 ` Nick Dokos
2012-03-30 20:55 ` Nicolas Girard
2012-03-31 6:57 ` Sebastien Vauban
2012-03-31 23:58 ` Nicolas Girard
2012-03-31 23:59 ` [PATCH 1/2] Simplify org-clocktable-indent-string Nicolas Girard
2012-03-31 23:59 ` [PATCH 2/2] Allow org-collector to display heading indentation by passing ':indent t' to the propview block Nicolas Girard
2012-04-02 16:56 ` Bastien
2012-04-20 11:12 ` Bastien
2012-04-20 11:12 ` [PATCH 1/2] Simplify org-clocktable-indent-string Bastien
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.