* [PATCH 1/2] Fix a bug in org-link-display-format.
@ 2009-11-11 18:17 James TD Smith
2009-11-11 18:17 ` [PATCH 2/2] Make org-agenda-columns-summarize work properly with the new summary types James TD Smith
0 siblings, 1 reply; 3+ messages in thread
From: James TD Smith @ 2009-11-11 18:17 UTC (permalink / raw)
To: emacs-orgmode
It would break if there was a '\' in the link description.
---
lisp/ChangeLog | 4 ++++
lisp/org.el | 9 +++++----
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 112e0bc..0ce2d50 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -72,6 +72,10 @@
* org-docbook.el (org-export-as-docbook): Protect targets in
verbatim emphasis.
+2009-11-07 James TD Smith <ahktenzero@mohorovi.cc>
+
+ * org.el (org-link-display-format): Should be literal replacement.
+
2009-11-06 Carsten Dominik <carsten.dominik@gmail.com>
* org-clock.el (org-show-notification): Handle messages that
diff --git a/lisp/org.el b/lisp/org.el
index c0afd10..ed32b94 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -17575,10 +17575,11 @@ Show the heading too, if it is currently invisible."
if no description is present"
(save-match-data
(if (string-match org-bracket-link-analytic-regexp link)
- (replace-match (or (match-string 5 link)
- (concat (match-string 1 link)
- (match-string 3 link)))
- nil nil link)
+ (replace-match (if (match-end 5)
+ (match-string 5 link)
+ (concat (match-string 1 link)
+ (match-string 3 link)))
+ nil t link)
link)))
;; Speedbar support
--
1.6.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] Make org-agenda-columns-summarize work properly with the new summary types.
2009-11-11 18:17 [PATCH 1/2] Fix a bug in org-link-display-format James TD Smith
@ 2009-11-11 18:17 ` James TD Smith
2009-11-11 18:22 ` James TD Smith
0 siblings, 1 reply; 3+ messages in thread
From: James TD Smith @ 2009-11-11 18:17 UTC (permalink / raw)
To: emacs-orgmode
It was assuming the values should be summarised by adding them together. It's
now updated to use the summary functions in org-columns-compile-map, and also
handles summary types with calculated values properly.
---
lisp/org-colview.el | 62 +++++++++++++++++++++++++++++++++++---------------
1 files changed, 43 insertions(+), 19 deletions(-)
diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index d0784f5..0fc843f 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -1044,9 +1044,16 @@ Don't set this, this is meant for dynamic scoping.")
(if s
(cond
((memq fmt '(min_age max_age mean_age))
- (if (string= s "")
- org-columns-time
- (time-to-number-of-days (apply 'encode-time (org-parse-time-string s t)))))
+ (cond ((string= s "") org-columns-time)
+ ((string-match
+ "\\([0-9]+\\)d \\([0-9]+\\)h \\([0-9]+\\)m \\([0-9]+\\)s"
+ s)
+ (+ (* 60 (+ (* 60 (+ (* 24 (string-to-number (match-string 1 s)))
+ (string-to-number (match-string 2 s))))
+ (string-to-number (match-string 3 s))))
+ (string-to-number (match-string 4 s))))
+ (t (time-to-number-of-days (apply 'encode-time
+ (org-parse-time-string s t))))))
((string-match ":" s)
(let ((l (nreverse (org-split-string s ":"))) (sum 0.0))
(while l
@@ -1363,10 +1370,11 @@ and tailing newline characters."
"Summarize the summarizable columns in column view in the agenda.
This will add overlays to the date lines, to show the summary for each day."
(let* ((fmt (mapcar (lambda (x)
- (list (car x) (if (equal (car x) "CLOCKSUM")
- 'add_times (nth 4 x))))
+ (if (equal (car x) "CLOCKSUM")
+ (list "CLOCKSUM" (nth 2 x) add_times + identity)
+ (cdr x)))
org-columns-current-fmt-compiled))
- line c c1 stype props lsum entries prop v)
+ line c c1 stype calc sumfunc props lsum entries prop v)
(catch 'exit
(when (delq nil (mapcar 'cadr fmt))
;; OK, at least one summation column, it makes sense to try this
@@ -1389,24 +1397,40 @@ This will add overlays to the date lines, to show the summary for each day."
(setq props
(mapcar
(lambda (f)
- (setq prop (car f) stype (nth 1 f))
+ (setq prop (car f)
+ stype (nth 3 f)
+ sumfunc (nth 5 f)
+ calc (or (nth 6 f) 'identity))
(cond
((equal prop "ITEM")
(cons prop (buffer-substring (point-at-bol)
(point-at-eol))))
((not stype) (cons prop ""))
- (t
- ;; do the summary
- (setq lsum 0)
- (mapc (lambda (x)
- (setq v (cdr (assoc prop x)))
- (if v (setq lsum (+ lsum
- (org-columns-string-to-number
- v stype)))))
- entries)
- (setq lsum (org-columns-number-to-string lsum stype))
- (put-text-property
- 0 (length lsum) 'face 'bold lsum)
+ (t ;; do the summary
+ (setq lsum nil)
+ (dolist (x entries)
+ (setq v (cdr (assoc prop x)))
+ (if v
+ (push
+ (funcall
+ (if (not (get-text-property 0 'org-computed v))
+ calc
+ 'identity)
+ (org-columns-string-to-number
+ v stype))
+ lsum)))
+ (setq lsum (remove nil lsum))
+ (setq lsum
+ (cond ((> (length lsum) 1)
+ (org-columns-number-to-string
+ (apply sumfunc lsum) stype))
+ ((eq (length lsum) 1)
+ (org-columns-number-to-string
+ (car lsum) stype))
+ (t "")))
+ (put-text-property 0 (length lsum) 'face 'bold lsum)
+ (if (neq calc 'identity)
+ (put-text-property 0 (length lsum) 'org-computed t lsum))
(cons prop lsum))))
fmt))
(org-columns-display-here props 'dateline)
--
1.6.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-11-11 18:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-11 18:17 [PATCH 1/2] Fix a bug in org-link-display-format James TD Smith
2009-11-11 18:17 ` [PATCH 2/2] Make org-agenda-columns-summarize work properly with the new summary types James TD Smith
2009-11-11 18:22 ` James TD Smith
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).