summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2009-06-18 17:35:59 +0200
committerCarsten Dominik <carsten.dominik@gmail.com>2009-06-18 17:35:59 +0200
commit9d59bc0d2937fb9258637d22a3ed2461e2189966 (patch)
tree0a5d5bf2641dd0e6e70c197b1906870ba8270104
parent164678d549f0e2fa5094ebc3701ca90be3795134 (diff)
downloadorg-mode-9d59bc0d2937fb9258637d22a3ed2461e2189966.tar.gz
Column view: Skip COMMENT and ARCHIVE trees when capturing
Proposal by Giovanni Ridolfi.
-rwxr-xr-xlisp/ChangeLog2
-rw-r--r--lisp/org-colview-xemacs.el51
-rw-r--r--lisp/org-colview.el45
3 files changed, 59 insertions, 39 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7a0a828..ac2858b 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -2,9 +2,11 @@
* org-colview.el (org-columns-capture-view): Protect vertical bars
in column values.
+ (org-columns-capture-view): Exclude comment and archived trees.
* org-colview-xemacs.el (org-columns-capture-view): Protect
vertical bars in column values.
+ (org-columns-capture-view): Exclude comment and archived trees.
* org.el (org-quote-vert): New function.
diff --git a/lisp/org-colview-xemacs.el b/lisp/org-colview-xemacs.el
index 2ed4725..3b885b6 100644
--- a/lisp/org-colview-xemacs.el
+++ b/lisp/org-colview-xemacs.el
@@ -1269,31 +1269,40 @@ of fields."
(if (featurep 'xemacs)
(save-excursion
(let* ((title (mapcar 'cadr org-columns-current-fmt-compiled))
+ (re-comment (concat "\\*+[ \t]+" org-comment-string "\\>"))
+ (re-archive (concat ".*:" org-archive-tag ":"))
(n (length title)) row tbl)
(goto-char (point-min))
(while (re-search-forward "^\\(\\*+\\) " nil t)
- (when (and (or (null maxlevel)
- (>= maxlevel
- (if org-odd-levels-only
- (/ (1+ (length (match-string 1))) 2)
- (length (match-string 1)))))
- (get-char-property (match-beginning 0) 'org-columns-key))
- (goto-char (match-beginning 0))
- (setq row nil)
- (loop for i from 0 to (1- n) do
- (push
- (org-quote-vert
- (or (get-char-property (point)
- 'org-columns-value-modified)
- (get-char-property (point) 'org-columns-value)
- ""))
- row)
- (org-columns-forward-char))
- (setq row (nreverse row))
- (unless (and skip-empty-rows
- (eq 1 (length (delete "" (delete-dups (copy-sequence row))))))
- (push row tbl))))
+ (catch 'next
+ (when (and (or (null maxlevel)
+ (>= maxlevel
+ (if org-odd-levels-only
+ (/ (1+ (length (match-string 1))) 2)
+ (length (match-string 1)))))
+ (get-char-property (match-beginning 0) 'org-columns-key))
+ (goto-char (match-beginning 0))
+ (when (save-excursion
+ (goto-char (point-at-bol))
+ (or (looking-at re-comment)
+ (looking-at re-archive)))
+ (org-end-of-subtree t)
+ (throw 'next t))
+ (setq row nil)
+ (loop for i from 0 to (1- n) do
+ (push
+ (org-quote-vert
+ (or (get-char-property (point)
+ 'org-columns-value-modified)
+ (get-char-property (point) 'org-columns-value)
+ ""))
+ row)
+ (org-columns-forward-char))
+ (setq row (nreverse row))
+ (unless (and skip-empty-rows
+ (eq 1 (length (delete "" (delete-dups (copy-sequence row))))))
+ (push row tbl)))))
(append (list title 'hline) (nreverse tbl))))
(save-excursion
(let* ((title (mapcar 'cadr org-columns-current-fmt-compiled))
diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 09ff02f..6d2c88f 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -1081,27 +1081,36 @@ containing the title row and all other rows. Each row is a list
of fields."
(save-excursion
(let* ((title (mapcar 'cadr org-columns-current-fmt-compiled))
+ (re-comment (concat "\\*+[ \t]+" org-comment-string "\\>"))
+ (re-archive (concat ".*:" org-archive-tag ":"))
(n (length title)) row tbl)
(goto-char (point-min))
(while (re-search-forward "^\\(\\*+\\) " nil t)
- (when (and (or (null maxlevel)
- (>= maxlevel
- (if org-odd-levels-only
- (/ (1+ (length (match-string 1))) 2)
- (length (match-string 1)))))
- (get-char-property (match-beginning 0) 'org-columns-key))
- (setq row nil)
- (loop for i from 0 to (1- n) do
- (push
- (org-quote-vert
- (or (get-char-property (+ (match-beginning 0) i) 'org-columns-value-modified)
- (get-char-property (+ (match-beginning 0) i) 'org-columns-value)
- ""))
- row))
- (setq row (nreverse row))
- (unless (and skip-empty-rows
- (eq 1 (length (delete "" (delete-dups (copy-sequence row))))))
- (push row tbl))))
+ (catch 'next
+ (when (and (or (null maxlevel)
+ (>= maxlevel
+ (if org-odd-levels-only
+ (/ (1+ (length (match-string 1))) 2)
+ (length (match-string 1)))))
+ (get-char-property (match-beginning 0) 'org-columns-key))
+ (when (save-excursion
+ (goto-char (point-at-bol))
+ (or (looking-at re-comment)
+ (looking-at re-archive)))
+ (org-end-of-subtree t)
+ (throw 'next t))
+ (setq row nil)
+ (loop for i from 0 to (1- n) do
+ (push
+ (org-quote-vert
+ (or (get-char-property (+ (match-beginning 0) i) 'org-columns-value-modified)
+ (get-char-property (+ (match-beginning 0) i) 'org-columns-value)
+ ""))
+ row))
+ (setq row (nreverse row))
+ (unless (and skip-empty-rows
+ (eq 1 (length (delete "" (delete-dups (copy-sequence row))))))
+ (push row tbl)))))
(append (list title 'hline) (nreverse tbl)))))
(defun org-dblock-write:columnview (params)