emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Working on org again
@ 2009-07-13  8:27 James TD Smith
  2009-07-13  8:27 ` [misc-new-features 1/5] Add two new special properties, SINCE and SINCE_IA James TD Smith
  0 siblings, 1 reply; 29+ messages in thread
From: James TD Smith @ 2009-07-13  8:27 UTC (permalink / raw)
  To: emacs-orgmode

After a long absence I am returning to org development. Those of you who haven't
forgotten about my proposed rewrite of org-remember will be wondering what
happened to it. I have been working on it when I've had time, and most of the
new features are implemented but not fully tested. I plan on making a test
branch available with the parts I think are usable available in the next week or
so.

In the meantime, I have a few other patches for Org:
- Add two new properties for the age or time since last activity of an entry. These
  are based on the first timestamps in an entry. Age/time since are displayed in
  column view in dd hh mm ss format.
- Bugfixes and improvements for my org-checklist module.
- Automatic tag sorting.
- org-insert-link can now include links on the X clipboard or in the Emacs
  kill-ring in the available links list.
- A bugfix for org-plot when using the script: option.

These patches are available from git://yog-sothoth.mohorovi.cc/org-mode in the
misc-new-features branch.

I also have a modified version of org-fstree with a few improvements (default
excludes for .git/.svn dirs, emacs backup files etc, speed enhancement for the
'what links to this file' option and some general code cleanup), but it's based
on an old version. I was also planning on adding an option to use org-registry
to get the links to entries, which would speed things up even more. I'll post a
patch to the list when I've done that and merged my changes into the current
version.

James

--
|-<James TD Smith>-<email/ahktenzero@mohorovi.cc>-|

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [misc-new-features 1/5] Add two new special properties, SINCE and SINCE_IA.
  2009-07-13  8:27 Working on org again James TD Smith
@ 2009-07-13  8:27 ` James TD Smith
  2009-07-13  8:27   ` [misc-new-features 2/5] Bugfixes, documentation and custom options for org-checklist James TD Smith
                     ` (2 more replies)
  0 siblings, 3 replies; 29+ messages in thread
From: James TD Smith @ 2009-07-13  8:27 UTC (permalink / raw)
  To: emacs-orgmode

These give the elapsed time since the TIMESTAMP and TIMESTAMP_IA
properties. This value is in days, as a floating point number.

For display in column view, this is converted to a human-readable time
interval in the form 8d 02h 12m 22s.
---
 lisp/ChangeLog      |   18 ++++++++++++++++--
 lisp/org-colview.el |   36 ++++++++++++++++++++++++------------
 lisp/org.el         |   23 ++++++++++++++++++-----
 3 files changed, 58 insertions(+), 19 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 351731d..348ade3 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,17 @@
+2009-07-12  James TD Smith  <ahktenzero@mohorovi.cc>
+
+	* org-colview.el (org-format-time-period): Formats a time in
+	fractional days as days, hours, mins, seconds.
+	(org-columns-display-here): Add special handling for SINCE and
+	SINCE_IA to format for display.
+
+	* org.el (org-time-since): Add a function to get the time since an
+	org timestamp.
+	(org-entry-properties): Add two new special properties: SINCE and
+	SINCE_IA. These give the time since any active or inactive
+	timestamp in an entry.
+	(org-special-properties): Add SINCE, SINCE_IA.
+
 2009-07-08  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org-clock.el (org-clock-goto): Find hidden headlines as well.
@@ -561,7 +575,7 @@
 	`org-export-push-to-kill-ring'.
 
 	* org-exp.el (org-export-show-temporary-export-buffer): New
-	option. 
+	option.
 
 	* org-latex.el (org-export-as-latex): Use
 	`org-export-show-temporary-export-buffer'.
@@ -2861,7 +2875,7 @@
 	(org-agenda-change-all-lines, org-tags-sparse-tree)
 	(org-time-string-to-absolute, org-small-year-to-year)
 	(org-link-escape): Re-apply changes accidentially overwritten
-	by last commit to Emacs.
+	by last commit to Emacs
 
 2008-11-23  Carsten Dominik  <carsten.dominik@gmail.com>
 
diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 7633b5b..6a89849 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -190,18 +190,19 @@ This is the compiled version of the format.")
 		      (length property))
 	    f (format "%%-%d.%ds | " width width)
 	    val (or (cdr ass) "")
-	    modval (or (and org-columns-modify-value-for-display-function
-			    (functionp
-			     org-columns-modify-value-for-display-function)
-			    (funcall
-			     org-columns-modify-value-for-display-function
-			     title val))
-		       (if (equal property "ITEM")
-			   (if (org-mode-p)
-			       (org-columns-cleanup-item
-				val org-columns-current-fmt-compiled)
-			     (org-agenda-columns-cleanup-item
-			      val pl cphr org-columns-current-fmt-compiled)))))
+	    modval (cond ((and org-columns-modify-value-for-display-function
+			       (functionp
+				org-columns-modify-value-for-display-function))
+			  (funcall org-columns-modify-value-for-display-function
+				   title val))
+		       ((equal property "ITEM")
+			(if (org-mode-p)
+			    (org-columns-cleanup-item
+			     val org-columns-current-fmt-compiled)
+			  (org-agenda-columns-cleanup-item
+			   val pl cphr org-columns-current-fmt-compiled)))
+		       ((or (equal property "SINCE") (equal property "SINCE_IA"))
+			(org-format-time-period val))))
       (setq s2 (org-columns-add-ellipses (or modval val) width))
       (setq string (format f s2))
       ;; Create the overlay
@@ -1388,6 +1389,17 @@ This will add overlays to the date lines, to show the summary for each day."
 			   (equal (nth 4 a) (nth 4 fm)))
 		  (org-columns-compute (car fm)))))))))))
 
+(defun org-format-time-period (interval)
+  (if (stringp interval)
+      ""
+    (let* ((days (floor interval))
+	   (frac-hours (* 24 (- interval days)))
+	   (hours (floor frac-hours))
+	   (minutes (floor (* 60 (- frac-hours hours))))
+	   (seconds (floor (* 60 (- (* 60 (- frac-hours hours)) minutes)))))
+      (format "%dd %02dh %02dm %02ds" days hours minutes seconds))))
+
+
 (provide 'org-colview)
 
 ;; arch-tag: 61f5128d-747c-4983-9479-e3871fa3d73c
diff --git a/lisp/org.el b/lisp/org.el
index feaa115..8843486 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6481,7 +6481,10 @@ WITH-CASE, the sorting considers case as well."
 		   (string-to-char (match-string 2))
 		 org-default-priority))
 	      ((= dcst ?r)
-	       (or (org-entry-get nil property) ""))
+	       (or (org-entry-get nil property)
+		   (if (or (equal property "SINCE") (equal property "SINCE_IA"))
+		       0
+		     "")))
 	      ((= dcst ?o)
 	       (if (looking-at org-complex-heading-regexp)
 		   (- 9999 (length (member (match-string 2)
@@ -11286,10 +11289,9 @@ a *different* entry, you cannot use these techniques."
 ;;;; Properties
 
 ;;; Setting and retrieving properties
-
 (defconst org-special-properties
   '("TODO" "TAGS" "ALLTAGS" "DEADLINE" "SCHEDULED" "CLOCK" "CLOSED" "PRIORITY"
-    "TIMESTAMP" "TIMESTAMP_IA")
+    "TIMESTAMP" "TIMESTAMP_IA" "SINCE" "SINCE_IA")
   "The special properties valid in Org-mode.
 
 These are properties that are not defined in the property drawer,
@@ -11433,8 +11435,13 @@ If WHICH is nil or `all', get all properties.  If WHICH is
 		  (setq key "TIMESTAMP")))
 	      (when (or (equal key clockstr) (not (assoc key props)))
 		(push (cons key string) props)))
-
-	    )
+	    (when (assoc "TIMESTAMP_IA" props)
+	      (push (cons "SINCE_IA"
+			  (org-time-since (cdr (assoc "TIMESTAMP_IA" props))))
+		    props))
+	    (when (assoc "TIMESTAMP" props)
+	      (push (cons "SINCE" (org-time-since (cdr (assoc "TIMESTAMP" props))))
+		    props)))
 
 	  (when (memq which '(all standard))
 	    ;; Get the standard properties, like :PROP: ...
@@ -11460,6 +11467,12 @@ If WHICH is nil or `all', get all properties.  If WHICH is
 	    (push (cons "CATEGORY" value) props))
 	  (append sum-props (nreverse props)))))))
 
+(defun org-time-since (time)
+  "Get the number of days since `time'"
+  (time-to-number-of-days (time-since (apply 'encode-time
+					     (org-parse-time-string time)))))
+
+
 (defun org-entry-get (pom property &optional inherit)
   "Get value of PROPERTY for entry at point-or-marker POM.
 If INHERIT is non-nil and the entry does not have the property,
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [misc-new-features 2/5] Bugfixes, documentation and custom options for org-checklist.
  2009-07-13  8:27 ` [misc-new-features 1/5] Add two new special properties, SINCE and SINCE_IA James TD Smith
@ 2009-07-13  8:27   ` James TD Smith
  2009-07-13  8:28     ` [misc-new-features 3/5] Add an option to sort tags automatically James TD Smith
                       ` (2 more replies)
  2009-07-14 11:48   ` [misc-new-features 1/5] Add two new special properties, SINCE and SINCE_IA Bastien
  2009-07-17 16:55   ` Bastien
  2 siblings, 3 replies; 29+ messages in thread
From: James TD Smith @ 2009-07-13  8:27 UTC (permalink / raw)
  To: emacs-orgmode

* contrib/lisp/org-checklist.el
  - Fix some problems with the print/export feature in org-checklist.
  - Add custom options for this module
  - Fix some interaction with a2ps
  - Only reset checkboxes if TODO state is done.

* doc/org.texi
  - Add documentation for org-checklist

* lisp/org.el
  - Add org-checklist to org-modules
---
 contrib/ChangeLog             |   16 ++++++++++
 contrib/lisp/org-checklist.el |   67 +++++++++++++++++++++++++++++++---------
 lisp/org.el                   |    1 +
 3 files changed, 69 insertions(+), 15 deletions(-)

diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index 7e62df0..6a5c2a2 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,3 +1,19 @@
+2009-07-12  James TD Smith  <ahktenzero@mohorovi.cc>
+
+	* lisp/org-checklist.el (org-checklist): Add a custom group for
+	org-checklist. The options are all for the unchecked items export
+	function.
+	(org-checklist-export-time-format): Allow customising the
+	timestamp appended to the saved unchecked items list
+	(org-checklist-export-function): Allow customising the output
+	format for the unchecked items list.
+	(org-checklist-export-params): Options for the exporter.
+	(org-checklist-a2ps-params): Printing options.
+	(org-make-checklist-export): Use values from custom vars. Printing
+	is now controlled by the PRINT_EXPORT property in the entry, and
+	the user is only asked if it is missing. Pass the switches to
+	a2ps-buffer properly.
+
 2009-06-20  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* README: List new file org-export-generic.el
diff --git a/contrib/lisp/org-checklist.el b/contrib/lisp/org-checklist.el
index 26d228f..4ebf91b 100644
--- a/contrib/lisp/org-checklist.el
+++ b/contrib/lisp/org-checklist.el
@@ -42,11 +42,37 @@
 ;;
 ;;; Code:
 (require 'org)
+(load "a2ps-print")
 
-(defvar export-time-format "%Y%m%d%H%M"
-  "format of timestamp appended to export file")
-(defvar export-function 'org-export-as-ascii
-  "function used to prepare the export file for printing")
+(defgroup org-checklist nil
+  "Extended checklist handling for org"
+  :tag "Org-checklist"
+  :group 'org)
+
+(defcustom org-checklist-export-time-format "%Y%m%d%H%M"
+  "The format of timestamp appended to LIST_EXPORT_BASENAME to
+  make the name of the export file."
+  :link '(function-link format-time-string)
+  :group 'org-checklist
+  :type 'string)
+
+(defcustom org-checklist-export-function 'org-export-as-ascii
+  "function used to prepare the export file for printing"
+  :group 'org-checklist
+  :type '(radio (function-item :tag "ascii text" org-export-as-ascii)
+		(function-item :tag "HTML"  org-export-as-html)
+		(function-item :tag "LaTeX" :value org-export-as-latex)
+		(function-item :tag "XOXO" :value org-export-as-xoxo)))
+
+(defcustom org-checklist-export-params nil
+  "options for the export function file for printing"
+  :group 'org-checklist
+  :type '(repeat string))
+
+(defcustom org-checklist-a2ps-params nil
+  "options for a2ps for printing"
+  :group 'org-checklist
+  :type '(repeat string))
 
 (defun org-reset-checkbox-state-maybe ()
   "Reset all checkboxes in an entry if the `RESET_CHECK_BOXES' property is set"
@@ -54,23 +80,30 @@
   (if (org-entry-get (point) "RESET_CHECK_BOXES")
       (org-reset-checkbox-state-subtree)))
 
+
 (defun org-make-checklist-export ()
   "Produce a checklist containing all unchecked items from a list
 of checkbox items"
   (interactive "*")
   (if (org-entry-get (point) "LIST_EXPORT_BASENAME")
-      (let* ((export-file (concat (org-entry-get (point) "LIST_EXPORT_BASENAME")
-				  "-" (format-time-string export-time-format)
+      (let* ((export-file (concat (org-entry-get (point) "LIST_EXPORT_BASENAME" nil)
+				  "-" (format-time-string
+				       org-checklist-export-time-format)
 				  ".org"))
+	     (print (case (org-entry-get (point) "PRINT_EXPORT" nil)
+		      (("" "nil" nil) nil)
+		      (t t)
+		      (nil (y-or-n-p "Print list? "))))
 	     exported-lines
-	     title)
+	     title "Checklist export")
 	(save-restriction
 	  (save-excursion
 	    (org-narrow-to-subtree)
+	    (org-update-checkbox-count-maybe)
 	    (org-show-subtree)
 	    (goto-char (point-min))
-	    (if (looking-at org-complex-heading-regexp)
-		(setq title (match-string 4)))
+	    (when (looking-at org-complex-heading-regexp)
+	      (setq title (match-string 4)))
 	    (goto-char (point-min))
 	    (let ((end (point-max)))
 	      (while (< (point) end)
@@ -85,14 +118,18 @@ of checkbox items"
 	    (dolist (entry exported-lines) (insert entry))
 	    (org-update-checkbox-count-maybe)
 	    (write-file export-file)
-	    (if (y-or-n-p "Print list? ")
-		((funcall export-function)
-		 (a2ps-buffer))))))))
+	    (if (print)
+		(progn (funcall org-checklist-export-function
+				org-checklist-export-params)
+		       (let* ((current-a2ps-switches a2ps-switches)
+			      (a2ps-switches (append current-a2ps-switches
+						     org-checklist-a2ps-params)))
+			 (a2ps-buffer)))))))))
 
 (defun org-checklist ()
-  (if (member state org-done-keywords)
-      (org-make-checklist-export))
-  (org-reset-checkbox-state-maybe))
+  (when (member state org-done-keywords)
+    (org-make-checklist-export)
+    (org-reset-checkbox-state-maybe)))
 
 (add-hook 'org-after-todo-state-change-hook 'org-checklist)
 
diff --git a/lisp/org.el b/lisp/org.el
index 8843486..d08155a 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -184,6 +184,7 @@ to add the symbol `xyz', and the package must have a call to
 	(const :tag "C  annotation-helper: Call Remember directly from Browser (OBSOLETE, use org-protocol)" org-annotation-helper)
 	(const :tag "C  bookmark:          Org links to bookmarks" org-bookmark)
 	(const :tag "C  browser-url:       Store link, directly from Browser (OBSOLETE, use org-protocol)" org-browser-url)
+	(const :tag "C  checklist:         Extra functions for checklists in repeated tasks" org-checklist)
 	(const :tag "C  choose:            Use TODO keywords to mark decisions states" org-choose)
 	(const :tag "C  collector:         Collect properties into tables" org-collector)
 	(const :tag "C  depend:            TODO dependencies for Org-mode (PARTIALLY OBSOLETE, see built-in dependency support))" org-depend)
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [misc-new-features 3/5] Add an option to sort tags automatically.
  2009-07-13  8:27   ` [misc-new-features 2/5] Bugfixes, documentation and custom options for org-checklist James TD Smith
@ 2009-07-13  8:28     ` James TD Smith
  2009-07-13  8:28       ` [misc-new-features 4/5] Allow org-insert-link to check the X clipboard and the Emacs kill-ring for links, as well as the stored links. This makes getting URLs into org from a browser much easier, as you don't have to paste the URL into the minibuffer to insert a link James TD Smith
                         ` (2 more replies)
  2009-07-14 12:09     ` [misc-new-features 2/5] Bugfixes, documentation and custom options for org-checklist Bastien
  2009-08-03 14:47     ` Carsten Dominik
  2 siblings, 3 replies; 29+ messages in thread
From: James TD Smith @ 2009-07-13  8:28 UTC (permalink / raw)
  To: emacs-orgmode

---
 lisp/ChangeLog |    3 +++
 lisp/org.el    |   17 ++++++++++++++++-
 2 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 348ade3..9ce7a17 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -11,6 +11,9 @@
 	SINCE_IA. These give the time since any active or inactive
 	timestamp in an entry.
 	(org-special-properties): Add SINCE, SINCE_IA.
+	(org-tags-sort-function): Add custom declaration for tags
+	sorting function.
+	(org-set-tags): Sort tags if org-tags-sort-function is set
 
 2009-07-08  Carsten Dominik  <carsten.dominik@gmail.com>
 
diff --git a/lisp/org.el b/lisp/org.el
index d08155a..854d09c 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -2337,6 +2337,15 @@ is better to limit inheritance to certain tags using the variables
 	  (const :tag "Yes, do list them" t)
 	  (const :tag "List them, indented with leading dots" indented)))
 
+(defcustom org-tags-sort-function nil
+  "When set, tags are sorted using this function as a comparator"
+  :group 'org-tags
+  :type '(choice
+	  (const :tag "No sorting" nil)
+	  (const :tag "Alphabetical" string<)
+	  (const :tag "Reverse alphabetical" string>)
+	  (function :tag "Custom function" nil)))
+
 (defvar org-tags-history nil
   "History of minibuffer reads for tags.")
 (defvar org-last-tags-completion-table nil
@@ -10840,11 +10849,17 @@ With prefix ARG, realign all tags in headings in the current buffer."
 	  ;; No boolean logic, just a list
 	  (setq tags (replace-match ":" t t tags))))
 
+      (if org-tags-sort-function
+	  (setq tags (mapconcat 'identity
+				(sort (org-split-string tags (org-re "[^[:alnum:]_@]+"))
+				      org-tags-sort-function) ":")))
+
       (if (string-match "\\`[\t ]*\\'" tags)
-          (setq tags "")
+	  (setq tags "")
 	(unless (string-match ":$" tags) (setq tags (concat tags ":")))
 	(unless (string-match "^:" tags) (setq tags (concat ":" tags))))
 
+
       ;; Insert new tags at the correct column
       (beginning-of-line 1)
       (cond
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [misc-new-features 4/5] Allow org-insert-link to check the X clipboard and the Emacs kill-ring for links, as well as the stored links. This makes getting URLs into org from a browser much easier, as you don't have to paste the URL into the minibuffer to insert a link.
  2009-07-13  8:28     ` [misc-new-features 3/5] Add an option to sort tags automatically James TD Smith
@ 2009-07-13  8:28       ` James TD Smith
  2009-07-13  8:28         ` [misc-new-features 5/5] Fix a problem I was having with plots using a script. Org-plot was deleting the data file before gnuplot read it in. I've moved the deletion of the temporary data file to an idle timer, which has fixed the problem James TD Smith
                           ` (3 more replies)
  2009-07-14 11:59       ` [misc-new-features 3/5] Add an option to sort tags automatically Bastien
  2009-07-17 16:38       ` Bastien
  2 siblings, 4 replies; 29+ messages in thread
From: James TD Smith @ 2009-07-13  8:28 UTC (permalink / raw)
  To: emacs-orgmode

You can customise `org-link-check-clipboards' to check either the X clipboards
or kill-ring only, or both, or none. If you have the interprogram-cut/paste
functions set, you probably only want to use the kill-ring only.
---
 lisp/ChangeLog |    5 ++++
 lisp/org.el    |   66 ++++++++++++++++++++++++++++++++++++++++---------------
 2 files changed, 53 insertions(+), 18 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 9ce7a17..662a585 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -14,6 +14,11 @@
 	(org-tags-sort-function): Add custom declaration for tags
 	sorting function.
 	(org-set-tags): Sort tags if org-tags-sort-function is set
+	(org-link-check-clipboards): Add a custom option for
+	clipboard link checking
+	(org-insert-link): If enabled, check the X clipboard and emacs
+	kill ring for strings which look like links, and include them in
+	the stored links to select from.
 
 2009-07-08  Carsten Dominik  <carsten.dominik@gmail.com>
 
diff --git a/lisp/org.el b/lisp/org.el
index 854d09c..47fb0b6 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -1024,6 +1024,15 @@ to use."
   :group 'org-link
   :type 'function)
 
+(defcustom org-link-check-clipboards nil
+  "Should org-insert-link check clipboards for links"
+  :group 'org-link
+  :type '(choice
+	  (const :tag "Just stored links" nil)
+	  (const :tag "The X11 clipboards" x)
+	  (const :tag "The Emacs kill-ring" emacs)
+	  (const :tag "Both" both)))
+
 (defgroup org-link-store nil
   "Options concerning storing links in Org-mode."
   :tag "Org Store Link"
@@ -7323,6 +7332,7 @@ used as the link location instead of reading one interactively."
 	 (desc region)
 	 tmphist ; byte-compile incorrectly complains about this
 	 (link link-location)
+	 (stored-links org-stored-links)
 	 entry file all-prefixes)
     (cond
      (link-location) ; specified by arg, just use it.
@@ -7342,26 +7352,46 @@ used as the link location instead of reading one interactively."
      ((member complete-file '((4) (16)))
       ;; Completing read for file names.
       (setq link (org-file-complete-link complete-file)))
-     (t
-      ;; Read link, with completion for stored links.
-      (with-output-to-temp-buffer "*Org Links*"
-	(princ "Insert a link.
+     (t ;; Read link, with completion for stored links.
+      ;;Check clipboards/kill ring for links
+      (when org-link-check-clipboards
+	(setq stored-links
+	      (append stored-links
+		      (mapcar
+		       (lambda (x) (list x "Link from clipboard"))
+		       (remove
+			nil
+			(remove-duplicates
+			 (mapcar
+			  (lambda (x)
+			    (when (and x (string-match org-link-types-re x)) x))
+			  (append (when
+				      (or (eq org-link-check-clipboards 'x)
+					  (eq org-link-check-clipboards 'both))
+				    (list (org-get-x-clipboard 'PRIMARY)
+					  (org-get-x-clipboard 'CLIPBOARD)
+					  (org-get-x-clipboard 'SECONDARY)))
+				  (when
+				      (or (eq org-link-check-clipboards 'emacs)
+					  (eq org-link-check-clipboards 'both))
+				    (mapcar 'org-no-properties kill-ring))))))))))
+	(with-output-to-temp-buffer "*Org Links*"
+	  (princ "Insert a link.
 Use TAB to complete link prefixes, then RET for type-specific completion support\n")
-	(when org-stored-links
-	  (princ "\nStored links are available with <up>/<down> or M-p/n (most recent with RET):\n\n")
-	  (princ (mapconcat
-		  (lambda (x)
-		    (if (nth 1 x) (concat (car x) " (" (nth 1 x) ")") (car x)))
-		  (reverse org-stored-links) "\n"))))
-      (let ((cw (selected-window)))
-	(select-window (get-buffer-window "*Org Links*"))
+	  (when stored-links
+	    (princ "\nStored links are available with <up>/<down> or M-p/n (most recent with RET):\n\n")
+	    (princ (mapconcat
+		    (lambda (x)
+		      (if (nth 1 x) (concat (car x) " (" (nth 1 x) ")") (car x)))
+		    (reverse stored-links) "\n"))))
+	(let ((cw (selected-window)))
+	  (select-window (get-buffer-window "*Org Links*"))
 	(setq truncate-lines t)
 	(unless (pos-visible-in-window-p (point-max))
 	  (org-fit-window-to-buffer))
 	(and (window-live-p cw) (select-window cw)))
       ;; Fake a link history, containing the stored links.
-      (setq tmphist (append (mapcar 'car org-stored-links)
-			    org-insert-link-history))
+      (setq tmphist (append (mapcar 'car stored-links) org-insert-link-history))
       (setq all-prefixes (append (mapcar 'car org-link-abbrev-alist-local)
 				 (mapcar 'car org-link-abbrev-alist)
 				 org-link-types))
@@ -7375,7 +7405,7 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
 			     all-prefixes)
 		     nil nil nil
 		     'tmphist
-		     (or (car (car org-stored-links))))))
+		     (or (car (car stored-links))))))
 	    (if (or (member link all-prefixes)
 		    (and (equal ":" (substring link -1))
 			 (member (substring link 0 -1) all-prefixes)
@@ -8729,8 +8759,8 @@ This function can be used in a hook."
 ;;;; Completion
 
 (defconst org-additional-option-like-keywords
-  '("BEGIN_HTML"  "END_HTML"  "HTML:" "ATTR_HTML" 
-    "BEGIN_DocBook"  "END_DocBook"  "DocBook:" "ATTR_DocBook" 
+  '("BEGIN_HTML"  "END_HTML"  "HTML:" "ATTR_HTML"
+    "BEGIN_DocBook"  "END_DocBook"  "DocBook:" "ATTR_DocBook"
     "BEGIN_LaTeX" "END_LaTeX" "LaTeX:" "LATEX_HEADER:"  "ATTR_LaTeX"
     "BEGIN:" "END:"
     "ORGTBL" "TBLFM:" "TBLNAME:"
@@ -15842,7 +15872,7 @@ which make use of the date at the cursor."
   (org-set-local 'comment-start-skip "^#+[ \t]*")
   (org-set-local 'paragraph-separate "\f\\|\\*+ \\|[ 	]*$\\|[ \t]*[:|]")
   ;; The paragraph starter includes hand-formatted lists.
-  (org-set-local 
+  (org-set-local
    'paragraph-start
    (concat
     "\f" "\\|"
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [misc-new-features 5/5] Fix a problem I was having with plots using a script. Org-plot was deleting the data file before gnuplot read it in. I've moved the deletion of the temporary data file to an idle timer, which has fixed the problem.
  2009-07-13  8:28       ` [misc-new-features 4/5] Allow org-insert-link to check the X clipboard and the Emacs kill-ring for links, as well as the stored links. This makes getting URLs into org from a browser much easier, as you don't have to paste the URL into the minibuffer to insert a link James TD Smith
@ 2009-07-13  8:28         ` James TD Smith
  2009-07-13 11:56           ` Bernt Hansen
                             ` (2 more replies)
  2009-07-13 11:55         ` [misc-new-features 4/5] Allow org-insert-link to check the X clipboard and the Emacs kill-ring for links, as well as the stored links. This makes getting URLs into org from a browser much easier, as you don't have to paste the URL into the minibuffer to insert a link Bernt Hansen
                           ` (2 subsequent siblings)
  3 siblings, 3 replies; 29+ messages in thread
From: James TD Smith @ 2009-07-13  8:28 UTC (permalink / raw)
  To: emacs-orgmode

---
 lisp/org-plot.el |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 0e8f5a2..c9d61b3 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -333,12 +333,12 @@ line directly before or after the table."
       (with-temp-buffer
 	(if (plist-get params :script) ;; user script
 	    (progn (insert
-                    (org-plot/gnuplot-script data-file num-cols params t))
-                   (insert "\n")
-                   (insert-file-contents (plist-get params :script))
-                   (goto-char (point-min))
-                   (while (re-search-forward "$datafile" nil t)
-                     (replace-match data-file nil nil)))
+		    (org-plot/gnuplot-script data-file num-cols params t))
+		   (insert "\n")
+		   (insert-file-contents (plist-get params :script))
+		   (goto-char (point-min))
+		   (while (re-search-forward "$datafile" nil t)
+		     (replace-match data-file nil nil)))
 	  (insert
 	   (org-plot/gnuplot-script data-file num-cols params)))
 	;; graph table
@@ -346,7 +346,7 @@ line directly before or after the table."
 	(gnuplot-send-buffer-to-gnuplot))
       ;; cleanup
       (bury-buffer (get-buffer "*gnuplot*"))
-      (delete-file data-file))))
+      (run-with-idle-timer 0.1 nil (lambda () (delete-file data-file))))))
 
 (provide 'org-plot)
 
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* Re: [misc-new-features 4/5] Allow org-insert-link to check the X clipboard and the Emacs kill-ring for links, as well as the stored links. This makes getting URLs into org from a browser much easier, as you don't have to paste the URL into the minibuffer to insert a link.
  2009-07-13  8:28       ` [misc-new-features 4/5] Allow org-insert-link to check the X clipboard and the Emacs kill-ring for links, as well as the stored links. This makes getting URLs into org from a browser much easier, as you don't have to paste the URL into the minibuffer to insert a link James TD Smith
  2009-07-13  8:28         ` [misc-new-features 5/5] Fix a problem I was having with plots using a script. Org-plot was deleting the data file before gnuplot read it in. I've moved the deletion of the temporary data file to an idle timer, which has fixed the problem James TD Smith
@ 2009-07-13 11:55         ` Bernt Hansen
  2009-07-13 12:13           ` [misc-new-features 4/5] extra long subject lines James TD Smith
  2009-07-14 12:07         ` [misc-new-features 4/5] Allow org-insert-link to check the X clipboard and the Emacs kill-ring for links, as well as the stored links. This makes getting URLs into org from a browser much easier, as you don't have to paste the URL into the minibuffer to insert a link Bastien
  2009-07-17 17:20         ` Bastien
  3 siblings, 1 reply; 29+ messages in thread
From: Bernt Hansen @ 2009-07-13 11:55 UTC (permalink / raw)
  To: James TD Smith; +Cc: emacs-orgmode

James TD Smith <ahktenzero@mohorovi.cc> writes:

> You can customise `org-link-check-clipboards' to check either the X clipboards
> or kill-ring only, or both, or none. If you have the interprogram-cut/paste
> functions set, you probably only want to use the kill-ring only.
> ---

Hi James,

The summary line (subject) is way too long.  If this gets applied it
won't show up very nicely in git shortlog or git log.

Normally the subject line (first line of the commit) is a short one-line
summary of the patch that fits in less than 80 chars.  If you find you
that is not enough that is usually a sign that the patch should be split
into multiple smaller commits.

You can put as much detail as you want in the body of the patch (line
3+).  Line 2 is blank - to separate the one-line summary from the
description for the commit.

Regards,
Bernt

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [misc-new-features 5/5] Fix a problem I was having with plots using a script. Org-plot was deleting the data file before gnuplot read it in. I've moved the deletion of the temporary data file to an idle timer, which has fixed the problem.
  2009-07-13  8:28         ` [misc-new-features 5/5] Fix a problem I was having with plots using a script. Org-plot was deleting the data file before gnuplot read it in. I've moved the deletion of the temporary data file to an idle timer, which has fixed the problem James TD Smith
@ 2009-07-13 11:56           ` Bernt Hansen
  2009-07-14 11:57           ` Bastien
  2009-07-17 17:03           ` Bastien
  2 siblings, 0 replies; 29+ messages in thread
From: Bernt Hansen @ 2009-07-13 11:56 UTC (permalink / raw)
  To: James TD Smith; +Cc: emacs-orgmode

James TD Smith <ahktenzero@mohorovi.cc> writes:

> ---

Same comment for this one as patch 4/5.

-Bernt

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [misc-new-features 4/5] extra long subject lines
  2009-07-13 11:55         ` [misc-new-features 4/5] Allow org-insert-link to check the X clipboard and the Emacs kill-ring for links, as well as the stored links. This makes getting URLs into org from a browser much easier, as you don't have to paste the URL into the minibuffer to insert a link Bernt Hansen
@ 2009-07-13 12:13           ` James TD Smith
  2009-07-13 15:35             ` Bernt Hansen
  0 siblings, 1 reply; 29+ messages in thread
From: James TD Smith @ 2009-07-13 12:13 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode

Hi Bernt,

On 2009-07-13 07:55:04(-0400), Bernt Hansen wrote:
> James TD Smith <ahktenzero@mohorovi.cc> writes:
>
> > You can customise `org-link-check-clipboards' to check either the X clipboards
> > or kill-ring only, or both, or none. If you have the interprogram-cut/paste
> > functions set, you probably only want to use the kill-ring only.
> > ---
>
> Hi James,
>
> The summary line (subject) is way too long.  If this gets applied it
> won't show up very nicely in git shortlog or git log.
>
> Normally the subject line (first line of the commit) is a short one-line
> summary of the patch that fits in less than 80 chars.  If you find you
> that is not enough that is usually a sign that the patch should be split
> into multiple smaller commits.
>
> You can put as much detail as you want in the body of the patch (line
> 3+).  Line 2 is blank - to separate the one-line summary from the
> description for the commit.

Sorry about that, guess I'm a bit rusty :). I've fixed the commit logs and
pushed them to my git repository.

James

--
|-<James TD Smith>-<email/ahktenzero@mohorovi.cc>-|

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [misc-new-features 4/5] extra long subject lines
  2009-07-13 12:13           ` [misc-new-features 4/5] extra long subject lines James TD Smith
@ 2009-07-13 15:35             ` Bernt Hansen
  0 siblings, 0 replies; 29+ messages in thread
From: Bernt Hansen @ 2009-07-13 15:35 UTC (permalink / raw)
  To: James TD Smith; +Cc: emacs-orgmode

James TD Smith <ahktenzero@mohorovi.cc> writes:

> Sorry about that, guess I'm a bit rusty :). I've fixed the commit logs and
> pushed them to my git repository.

Thanks :)

-Bernt

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [misc-new-features 2/5] Bugfixes, documentation and custom options for org-checklist.
  2009-07-14 12:09     ` [misc-new-features 2/5] Bugfixes, documentation and custom options for org-checklist Bastien
@ 2009-07-14  8:52       ` James TD Smith
  0 siblings, 0 replies; 29+ messages in thread
From: James TD Smith @ 2009-07-14  8:52 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

Hi Bastien,

On 2009-07-14 14:09:12(+0200), Bastien wrote:
> I will apply this one tomorrow.  Note that your changelog announces
> changes to org.texi that your patch don't contain.

I started the patch before the documentation for modules in contrib was
moved to Worg. I pushed the docs just now.

The changelog is fixed in the version in my git repo.

James

--
|-<James TD Smith>-<email/ahktenzero@mohorovi.cc>-|

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [misc-new-features 1/5] Add two new special properties, SINCE and SINCE_IA.
  2009-07-13  8:27 ` [misc-new-features 1/5] Add two new special properties, SINCE and SINCE_IA James TD Smith
  2009-07-13  8:27   ` [misc-new-features 2/5] Bugfixes, documentation and custom options for org-checklist James TD Smith
@ 2009-07-14 11:48   ` Bastien
  2009-07-14 17:44     ` James TD Smith
  2009-07-17 16:55   ` Bastien
  2 siblings, 1 reply; 29+ messages in thread
From: Bastien @ 2009-07-14 11:48 UTC (permalink / raw)
  To: James TD Smith; +Cc: emacs-orgmode

Hi James,

welcome back.  Carsten is on vacation for three weeks and I'm
maintaining Org in the meanwhile.

I won't take the decision of adding new special properties without
asking him so I don't apply this patch for now.  But I will use your
patch for a while and see if I find it useful.  If others can test it
as well and give their feedback, even better.

Thanks!

James TD Smith <ahktenzero@mohorovi.cc> writes:

> These give the elapsed time since the TIMESTAMP and TIMESTAMP_IA
> properties. This value is in days, as a floating point number.
>
> For display in column view, this is converted to a human-readable time
> interval in the form 8d 02h 12m 22s.
> ---
>  lisp/ChangeLog      |   18 ++++++++++++++++--
>  lisp/org-colview.el |   36 ++++++++++++++++++++++++------------
>  lisp/org.el         |   23 ++++++++++++++++++-----
>  3 files changed, 58 insertions(+), 19 deletions(-)
>
> diff --git a/lisp/ChangeLog b/lisp/ChangeLog
> index 351731d..348ade3 100755
> --- a/lisp/ChangeLog
> +++ b/lisp/ChangeLog
> @@ -1,3 +1,17 @@
> +2009-07-12  James TD Smith  <ahktenzero@mohorovi.cc>
> +
> +	* org-colview.el (org-format-time-period): Formats a time in
> +	fractional days as days, hours, mins, seconds.
> +	(org-columns-display-here): Add special handling for SINCE and
> +	SINCE_IA to format for display.
> +
> +	* org.el (org-time-since): Add a function to get the time since an
> +	org timestamp.
> +	(org-entry-properties): Add two new special properties: SINCE and
> +	SINCE_IA. These give the time since any active or inactive
> +	timestamp in an entry.
> +	(org-special-properties): Add SINCE, SINCE_IA.
> +
>  2009-07-08  Carsten Dominik  <carsten.dominik@gmail.com>
>  
>  	* org-clock.el (org-clock-goto): Find hidden headlines as well.
> @@ -561,7 +575,7 @@
>  	`org-export-push-to-kill-ring'.
>  
>  	* org-exp.el (org-export-show-temporary-export-buffer): New
> -	option. 
> +	option.
>  
>  	* org-latex.el (org-export-as-latex): Use
>  	`org-export-show-temporary-export-buffer'.
> @@ -2861,7 +2875,7 @@
>  	(org-agenda-change-all-lines, org-tags-sparse-tree)
>  	(org-time-string-to-absolute, org-small-year-to-year)
>  	(org-link-escape): Re-apply changes accidentially overwritten
> -	by last commit to Emacs.
> +	by last commit to Emacs
>  
>  2008-11-23  Carsten Dominik  <carsten.dominik@gmail.com>
>  
> diff --git a/lisp/org-colview.el b/lisp/org-colview.el
> index 7633b5b..6a89849 100644
> --- a/lisp/org-colview.el
> +++ b/lisp/org-colview.el
> @@ -190,18 +190,19 @@ This is the compiled version of the format.")
>  		      (length property))
>  	    f (format "%%-%d.%ds | " width width)
>  	    val (or (cdr ass) "")
> -	    modval (or (and org-columns-modify-value-for-display-function
> -			    (functionp
> -			     org-columns-modify-value-for-display-function)
> -			    (funcall
> -			     org-columns-modify-value-for-display-function
> -			     title val))
> -		       (if (equal property "ITEM")
> -			   (if (org-mode-p)
> -			       (org-columns-cleanup-item
> -				val org-columns-current-fmt-compiled)
> -			     (org-agenda-columns-cleanup-item
> -			      val pl cphr org-columns-current-fmt-compiled)))))
> +	    modval (cond ((and org-columns-modify-value-for-display-function
> +			       (functionp
> +				org-columns-modify-value-for-display-function))
> +			  (funcall org-columns-modify-value-for-display-function
> +				   title val))
> +		       ((equal property "ITEM")
> +			(if (org-mode-p)
> +			    (org-columns-cleanup-item
> +			     val org-columns-current-fmt-compiled)
> +			  (org-agenda-columns-cleanup-item
> +			   val pl cphr org-columns-current-fmt-compiled)))
> +		       ((or (equal property "SINCE") (equal property "SINCE_IA"))
> +			(org-format-time-period val))))
>        (setq s2 (org-columns-add-ellipses (or modval val) width))
>        (setq string (format f s2))
>        ;; Create the overlay
> @@ -1388,6 +1389,17 @@ This will add overlays to the date lines, to show the summary for each day."
>  			   (equal (nth 4 a) (nth 4 fm)))
>  		  (org-columns-compute (car fm)))))))))))
>  
> +(defun org-format-time-period (interval)
> +  (if (stringp interval)
> +      ""
> +    (let* ((days (floor interval))
> +	   (frac-hours (* 24 (- interval days)))
> +	   (hours (floor frac-hours))
> +	   (minutes (floor (* 60 (- frac-hours hours))))
> +	   (seconds (floor (* 60 (- (* 60 (- frac-hours hours)) minutes)))))
> +      (format "%dd %02dh %02dm %02ds" days hours minutes seconds))))
> +
> +
>  (provide 'org-colview)
>  
>  ;; arch-tag: 61f5128d-747c-4983-9479-e3871fa3d73c
> diff --git a/lisp/org.el b/lisp/org.el
> index feaa115..8843486 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -6481,7 +6481,10 @@ WITH-CASE, the sorting considers case as well."
>  		   (string-to-char (match-string 2))
>  		 org-default-priority))
>  	      ((= dcst ?r)
> -	       (or (org-entry-get nil property) ""))
> +	       (or (org-entry-get nil property)
> +		   (if (or (equal property "SINCE") (equal property "SINCE_IA"))
> +		       0
> +		     "")))
>  	      ((= dcst ?o)
>  	       (if (looking-at org-complex-heading-regexp)
>  		   (- 9999 (length (member (match-string 2)
> @@ -11286,10 +11289,9 @@ a *different* entry, you cannot use these techniques."
>  ;;;; Properties
>  
>  ;;; Setting and retrieving properties
> -
>  (defconst org-special-properties
>    '("TODO" "TAGS" "ALLTAGS" "DEADLINE" "SCHEDULED" "CLOCK" "CLOSED" "PRIORITY"
> -    "TIMESTAMP" "TIMESTAMP_IA")
> +    "TIMESTAMP" "TIMESTAMP_IA" "SINCE" "SINCE_IA")
>    "The special properties valid in Org-mode.
>  
>  These are properties that are not defined in the property drawer,
> @@ -11433,8 +11435,13 @@ If WHICH is nil or `all', get all properties.  If WHICH is
>  		  (setq key "TIMESTAMP")))
>  	      (when (or (equal key clockstr) (not (assoc key props)))
>  		(push (cons key string) props)))
> -
> -	    )
> +	    (when (assoc "TIMESTAMP_IA" props)
> +	      (push (cons "SINCE_IA"
> +			  (org-time-since (cdr (assoc "TIMESTAMP_IA" props))))
> +		    props))
> +	    (when (assoc "TIMESTAMP" props)
> +	      (push (cons "SINCE" (org-time-since (cdr (assoc "TIMESTAMP" props))))
> +		    props)))
>  
>  	  (when (memq which '(all standard))
>  	    ;; Get the standard properties, like :PROP: ...
> @@ -11460,6 +11467,12 @@ If WHICH is nil or `all', get all properties.  If WHICH is
>  	    (push (cons "CATEGORY" value) props))
>  	  (append sum-props (nreverse props)))))))
>  
> +(defun org-time-since (time)
> +  "Get the number of days since `time'"
> +  (time-to-number-of-days (time-since (apply 'encode-time
> +					     (org-parse-time-string time)))))
> +
> +
>  (defun org-entry-get (pom property &optional inherit)
>    "Get value of PROPERTY for entry at point-or-marker POM.
>  If INHERIT is non-nil and the entry does not have the property,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [misc-new-features 5/5] Fix a problem I was having with plots using a script. Org-plot was deleting the data file before gnuplot read it in. I've moved the deletion of the temporary data file to an idle timer, which has fixed the problem.
  2009-07-13  8:28         ` [misc-new-features 5/5] Fix a problem I was having with plots using a script. Org-plot was deleting the data file before gnuplot read it in. I've moved the deletion of the temporary data file to an idle timer, which has fixed the problem James TD Smith
  2009-07-13 11:56           ` Bernt Hansen
@ 2009-07-14 11:57           ` Bastien
  2009-07-17 17:03           ` Bastien
  2 siblings, 0 replies; 29+ messages in thread
From: Bastien @ 2009-07-14 11:57 UTC (permalink / raw)
  To: schulte eric, James TD Smith; +Cc: emacs-orgmode

Thanks.  Eric, does it look good to you?

James TD Smith <ahktenzero@mohorovi.cc> writes:

> ---
>  lisp/org-plot.el |   14 +++++++-------
>  1 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/lisp/org-plot.el b/lisp/org-plot.el
> index 0e8f5a2..c9d61b3 100644
> --- a/lisp/org-plot.el
> +++ b/lisp/org-plot.el
> @@ -333,12 +333,12 @@ line directly before or after the table."
>        (with-temp-buffer
>  	(if (plist-get params :script) ;; user script
>  	    (progn (insert
> -                    (org-plot/gnuplot-script data-file num-cols params t))
> -                   (insert "\n")
> -                   (insert-file-contents (plist-get params :script))
> -                   (goto-char (point-min))
> -                   (while (re-search-forward "$datafile" nil t)
> -                     (replace-match data-file nil nil)))
> +		    (org-plot/gnuplot-script data-file num-cols params t))
> +		   (insert "\n")
> +		   (insert-file-contents (plist-get params :script))
> +		   (goto-char (point-min))
> +		   (while (re-search-forward "$datafile" nil t)
> +		     (replace-match data-file nil nil)))
>  	  (insert
>  	   (org-plot/gnuplot-script data-file num-cols params)))
>  	;; graph table
> @@ -346,7 +346,7 @@ line directly before or after the table."
>  	(gnuplot-send-buffer-to-gnuplot))
>        ;; cleanup
>        (bury-buffer (get-buffer "*gnuplot*"))
> -      (delete-file data-file))))
> +      (run-with-idle-timer 0.1 nil (lambda () (delete-file data-file))))))
>  
>  (provide 'org-plot)

-- 
 Bastien

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [misc-new-features 3/5] Add an option to sort tags automatically.
  2009-07-13  8:28     ` [misc-new-features 3/5] Add an option to sort tags automatically James TD Smith
  2009-07-13  8:28       ` [misc-new-features 4/5] Allow org-insert-link to check the X clipboard and the Emacs kill-ring for links, as well as the stored links. This makes getting URLs into org from a browser much easier, as you don't have to paste the URL into the minibuffer to insert a link James TD Smith
@ 2009-07-14 11:59       ` Bastien
  2009-07-14 16:01         ` James TD Smith
  2009-07-17 16:38       ` Bastien
  2 siblings, 1 reply; 29+ messages in thread
From: Bastien @ 2009-07-14 11:59 UTC (permalink / raw)
  To: James TD Smith; +Cc: emacs-orgmode

Thanks James.

Can people try this and give some feedback if they find it useful?

James TD Smith <ahktenzero@mohorovi.cc> writes:

> ---
>  lisp/ChangeLog |    3 +++
>  lisp/org.el    |   17 ++++++++++++++++-
>  2 files changed, 19 insertions(+), 1 deletions(-)
>
> diff --git a/lisp/ChangeLog b/lisp/ChangeLog
> index 348ade3..9ce7a17 100755
> --- a/lisp/ChangeLog
> +++ b/lisp/ChangeLog
> @@ -11,6 +11,9 @@
>  	SINCE_IA. These give the time since any active or inactive
>  	timestamp in an entry.
>  	(org-special-properties): Add SINCE, SINCE_IA.
> +	(org-tags-sort-function): Add custom declaration for tags
> +	sorting function.
> +	(org-set-tags): Sort tags if org-tags-sort-function is set
>  
>  2009-07-08  Carsten Dominik  <carsten.dominik@gmail.com>
>  
> diff --git a/lisp/org.el b/lisp/org.el
> index d08155a..854d09c 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -2337,6 +2337,15 @@ is better to limit inheritance to certain tags using the variables
>  	  (const :tag "Yes, do list them" t)
>  	  (const :tag "List them, indented with leading dots" indented)))
>  
> +(defcustom org-tags-sort-function nil
> +  "When set, tags are sorted using this function as a comparator"
> +  :group 'org-tags
> +  :type '(choice
> +	  (const :tag "No sorting" nil)
> +	  (const :tag "Alphabetical" string<)
> +	  (const :tag "Reverse alphabetical" string>)
> +	  (function :tag "Custom function" nil)))
> +
>  (defvar org-tags-history nil
>    "History of minibuffer reads for tags.")
>  (defvar org-last-tags-completion-table nil
> @@ -10840,11 +10849,17 @@ With prefix ARG, realign all tags in headings in the current buffer."
>  	  ;; No boolean logic, just a list
>  	  (setq tags (replace-match ":" t t tags))))
>  
> +      (if org-tags-sort-function
> +	  (setq tags (mapconcat 'identity
> +				(sort (org-split-string tags (org-re "[^[:alnum:]_@]+"))
> +				      org-tags-sort-function) ":")))
> +
>        (if (string-match "\\`[\t ]*\\'" tags)
> -          (setq tags "")
> +	  (setq tags "")
>  	(unless (string-match ":$" tags) (setq tags (concat tags ":")))
>  	(unless (string-match "^:" tags) (setq tags (concat ":" tags))))
>  
> +
>        ;; Insert new tags at the correct column
>        (beginning-of-line 1)
>        (cond

-- 
 Bastien

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [misc-new-features 4/5] Allow org-insert-link to check the X clipboard and the Emacs kill-ring for links, as well as the stored links. This makes getting URLs into org from a browser much easier, as you don't have to paste the URL into the minibuffer to insert a link.
  2009-07-13  8:28       ` [misc-new-features 4/5] Allow org-insert-link to check the X clipboard and the Emacs kill-ring for links, as well as the stored links. This makes getting URLs into org from a browser much easier, as you don't have to paste the URL into the minibuffer to insert a link James TD Smith
  2009-07-13  8:28         ` [misc-new-features 5/5] Fix a problem I was having with plots using a script. Org-plot was deleting the data file before gnuplot read it in. I've moved the deletion of the temporary data file to an idle timer, which has fixed the problem James TD Smith
  2009-07-13 11:55         ` [misc-new-features 4/5] Allow org-insert-link to check the X clipboard and the Emacs kill-ring for links, as well as the stored links. This makes getting URLs into org from a browser much easier, as you don't have to paste the URL into the minibuffer to insert a link Bernt Hansen
@ 2009-07-14 12:07         ` Bastien
  2009-07-17 17:20         ` Bastien
  3 siblings, 0 replies; 29+ messages in thread
From: Bastien @ 2009-07-14 12:07 UTC (permalink / raw)
  To: James TD Smith; +Cc: emacs-orgmode

I think it's a good idea, I will test this a bit further before applying
the patch.  Thanks!

James TD Smith <ahktenzero@mohorovi.cc> writes:

> You can customise `org-link-check-clipboards' to check either the X clipboards
> or kill-ring only, or both, or none. If you have the interprogram-cut/paste
> functions set, you probably only want to use the kill-ring only.
> ---
>  lisp/ChangeLog |    5 ++++
>  lisp/org.el    |   66 ++++++++++++++++++++++++++++++++++++++++---------------
>  2 files changed, 53 insertions(+), 18 deletions(-)
>
> diff --git a/lisp/ChangeLog b/lisp/ChangeLog
> index 9ce7a17..662a585 100755
> --- a/lisp/ChangeLog
> +++ b/lisp/ChangeLog
> @@ -14,6 +14,11 @@
>  	(org-tags-sort-function): Add custom declaration for tags
>  	sorting function.
>  	(org-set-tags): Sort tags if org-tags-sort-function is set
> +	(org-link-check-clipboards): Add a custom option for
> +	clipboard link checking
> +	(org-insert-link): If enabled, check the X clipboard and emacs
> +	kill ring for strings which look like links, and include them in
> +	the stored links to select from.
>  
>  2009-07-08  Carsten Dominik  <carsten.dominik@gmail.com>
>  
> diff --git a/lisp/org.el b/lisp/org.el
> index 854d09c..47fb0b6 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -1024,6 +1024,15 @@ to use."
>    :group 'org-link
>    :type 'function)
>  
> +(defcustom org-link-check-clipboards nil
> +  "Should org-insert-link check clipboards for links"
> +  :group 'org-link
> +  :type '(choice
> +	  (const :tag "Just stored links" nil)
> +	  (const :tag "The X11 clipboards" x)
> +	  (const :tag "The Emacs kill-ring" emacs)
> +	  (const :tag "Both" both)))
> +
>  (defgroup org-link-store nil
>    "Options concerning storing links in Org-mode."
>    :tag "Org Store Link"
> @@ -7323,6 +7332,7 @@ used as the link location instead of reading one interactively."
>  	 (desc region)
>  	 tmphist ; byte-compile incorrectly complains about this
>  	 (link link-location)
> +	 (stored-links org-stored-links)
>  	 entry file all-prefixes)
>      (cond
>       (link-location) ; specified by arg, just use it.
> @@ -7342,26 +7352,46 @@ used as the link location instead of reading one interactively."
>       ((member complete-file '((4) (16)))
>        ;; Completing read for file names.
>        (setq link (org-file-complete-link complete-file)))
> -     (t
> -      ;; Read link, with completion for stored links.
> -      (with-output-to-temp-buffer "*Org Links*"
> -	(princ "Insert a link.
> +     (t ;; Read link, with completion for stored links.
> +      ;;Check clipboards/kill ring for links
> +      (when org-link-check-clipboards
> +	(setq stored-links
> +	      (append stored-links
> +		      (mapcar
> +		       (lambda (x) (list x "Link from clipboard"))
> +		       (remove
> +			nil
> +			(remove-duplicates
> +			 (mapcar
> +			  (lambda (x)
> +			    (when (and x (string-match org-link-types-re x)) x))
> +			  (append (when
> +				      (or (eq org-link-check-clipboards 'x)
> +					  (eq org-link-check-clipboards 'both))
> +				    (list (org-get-x-clipboard 'PRIMARY)
> +					  (org-get-x-clipboard 'CLIPBOARD)
> +					  (org-get-x-clipboard 'SECONDARY)))
> +				  (when
> +				      (or (eq org-link-check-clipboards 'emacs)
> +					  (eq org-link-check-clipboards 'both))
> +				    (mapcar 'org-no-properties kill-ring))))))))))
> +	(with-output-to-temp-buffer "*Org Links*"
> +	  (princ "Insert a link.
>  Use TAB to complete link prefixes, then RET for type-specific completion support\n")
> -	(when org-stored-links
> -	  (princ "\nStored links are available with <up>/<down> or M-p/n (most recent with RET):\n\n")
> -	  (princ (mapconcat
> -		  (lambda (x)
> -		    (if (nth 1 x) (concat (car x) " (" (nth 1 x) ")") (car x)))
> -		  (reverse org-stored-links) "\n"))))
> -      (let ((cw (selected-window)))
> -	(select-window (get-buffer-window "*Org Links*"))
> +	  (when stored-links
> +	    (princ "\nStored links are available with <up>/<down> or M-p/n (most recent with RET):\n\n")
> +	    (princ (mapconcat
> +		    (lambda (x)
> +		      (if (nth 1 x) (concat (car x) " (" (nth 1 x) ")") (car x)))
> +		    (reverse stored-links) "\n"))))
> +	(let ((cw (selected-window)))
> +	  (select-window (get-buffer-window "*Org Links*"))
>  	(setq truncate-lines t)
>  	(unless (pos-visible-in-window-p (point-max))
>  	  (org-fit-window-to-buffer))
>  	(and (window-live-p cw) (select-window cw)))
>        ;; Fake a link history, containing the stored links.
> -      (setq tmphist (append (mapcar 'car org-stored-links)
> -			    org-insert-link-history))
> +      (setq tmphist (append (mapcar 'car stored-links) org-insert-link-history))
>        (setq all-prefixes (append (mapcar 'car org-link-abbrev-alist-local)
>  				 (mapcar 'car org-link-abbrev-alist)
>  				 org-link-types))
> @@ -7375,7 +7405,7 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
>  			     all-prefixes)
>  		     nil nil nil
>  		     'tmphist
> -		     (or (car (car org-stored-links))))))
> +		     (or (car (car stored-links))))))
>  	    (if (or (member link all-prefixes)
>  		    (and (equal ":" (substring link -1))
>  			 (member (substring link 0 -1) all-prefixes)
> @@ -8729,8 +8759,8 @@ This function can be used in a hook."
>  ;;;; Completion
>  
>  (defconst org-additional-option-like-keywords
> -  '("BEGIN_HTML"  "END_HTML"  "HTML:" "ATTR_HTML" 
> -    "BEGIN_DocBook"  "END_DocBook"  "DocBook:" "ATTR_DocBook" 
> +  '("BEGIN_HTML"  "END_HTML"  "HTML:" "ATTR_HTML"
> +    "BEGIN_DocBook"  "END_DocBook"  "DocBook:" "ATTR_DocBook"
>      "BEGIN_LaTeX" "END_LaTeX" "LaTeX:" "LATEX_HEADER:"  "ATTR_LaTeX"
>      "BEGIN:" "END:"
>      "ORGTBL" "TBLFM:" "TBLNAME:"
> @@ -15842,7 +15872,7 @@ which make use of the date at the cursor."
>    (org-set-local 'comment-start-skip "^#+[ \t]*")
>    (org-set-local 'paragraph-separate "\f\\|\\*+ \\|[ 	]*$\\|[ \t]*[:|]")
>    ;; The paragraph starter includes hand-formatted lists.
> -  (org-set-local 
> +  (org-set-local
>     'paragraph-start
>     (concat
>      "\f" "\\|"

-- 
 Bastien

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [misc-new-features 2/5] Bugfixes, documentation and custom options for org-checklist.
  2009-07-13  8:27   ` [misc-new-features 2/5] Bugfixes, documentation and custom options for org-checklist James TD Smith
  2009-07-13  8:28     ` [misc-new-features 3/5] Add an option to sort tags automatically James TD Smith
@ 2009-07-14 12:09     ` Bastien
  2009-07-14  8:52       ` James TD Smith
  2009-08-03 14:47     ` Carsten Dominik
  2 siblings, 1 reply; 29+ messages in thread
From: Bastien @ 2009-07-14 12:09 UTC (permalink / raw)
  To: James TD Smith; +Cc: emacs-orgmode

I will apply this one tomorrow.  Note that your changelog announces
changes to org.texi that your patch don't contain.  

Thanks!

James TD Smith <ahktenzero@mohorovi.cc> writes:

> * contrib/lisp/org-checklist.el
>   - Fix some problems with the print/export feature in org-checklist.
>   - Add custom options for this module
>   - Fix some interaction with a2ps
>   - Only reset checkboxes if TODO state is done.
>
> * doc/org.texi
>   - Add documentation for org-checklist
>
> * lisp/org.el
>   - Add org-checklist to org-modules
> ---
>  contrib/ChangeLog             |   16 ++++++++++
>  contrib/lisp/org-checklist.el |   67 +++++++++++++++++++++++++++++++---------
>  lisp/org.el                   |    1 +
>  3 files changed, 69 insertions(+), 15 deletions(-)
>
> diff --git a/contrib/ChangeLog b/contrib/ChangeLog
> index 7e62df0..6a5c2a2 100644
> --- a/contrib/ChangeLog
> +++ b/contrib/ChangeLog
> @@ -1,3 +1,19 @@
> +2009-07-12  James TD Smith  <ahktenzero@mohorovi.cc>
> +
> +	* lisp/org-checklist.el (org-checklist): Add a custom group for
> +	org-checklist. The options are all for the unchecked items export
> +	function.
> +	(org-checklist-export-time-format): Allow customising the
> +	timestamp appended to the saved unchecked items list
> +	(org-checklist-export-function): Allow customising the output
> +	format for the unchecked items list.
> +	(org-checklist-export-params): Options for the exporter.
> +	(org-checklist-a2ps-params): Printing options.
> +	(org-make-checklist-export): Use values from custom vars. Printing
> +	is now controlled by the PRINT_EXPORT property in the entry, and
> +	the user is only asked if it is missing. Pass the switches to
> +	a2ps-buffer properly.
> +
>  2009-06-20  Carsten Dominik  <carsten.dominik@gmail.com>
>  
>  	* README: List new file org-export-generic.el
> diff --git a/contrib/lisp/org-checklist.el b/contrib/lisp/org-checklist.el
> index 26d228f..4ebf91b 100644
> --- a/contrib/lisp/org-checklist.el
> +++ b/contrib/lisp/org-checklist.el
> @@ -42,11 +42,37 @@
>  ;;
>  ;;; Code:
>  (require 'org)
> +(load "a2ps-print")
>  
> -(defvar export-time-format "%Y%m%d%H%M"
> -  "format of timestamp appended to export file")
> -(defvar export-function 'org-export-as-ascii
> -  "function used to prepare the export file for printing")
> +(defgroup org-checklist nil
> +  "Extended checklist handling for org"
> +  :tag "Org-checklist"
> +  :group 'org)
> +
> +(defcustom org-checklist-export-time-format "%Y%m%d%H%M"
> +  "The format of timestamp appended to LIST_EXPORT_BASENAME to
> +  make the name of the export file."
> +  :link '(function-link format-time-string)
> +  :group 'org-checklist
> +  :type 'string)
> +
> +(defcustom org-checklist-export-function 'org-export-as-ascii
> +  "function used to prepare the export file for printing"
> +  :group 'org-checklist
> +  :type '(radio (function-item :tag "ascii text" org-export-as-ascii)
> +		(function-item :tag "HTML"  org-export-as-html)
> +		(function-item :tag "LaTeX" :value org-export-as-latex)
> +		(function-item :tag "XOXO" :value org-export-as-xoxo)))
> +
> +(defcustom org-checklist-export-params nil
> +  "options for the export function file for printing"
> +  :group 'org-checklist
> +  :type '(repeat string))
> +
> +(defcustom org-checklist-a2ps-params nil
> +  "options for a2ps for printing"
> +  :group 'org-checklist
> +  :type '(repeat string))
>  
>  (defun org-reset-checkbox-state-maybe ()
>    "Reset all checkboxes in an entry if the `RESET_CHECK_BOXES' property is set"
> @@ -54,23 +80,30 @@
>    (if (org-entry-get (point) "RESET_CHECK_BOXES")
>        (org-reset-checkbox-state-subtree)))
>  
> +
>  (defun org-make-checklist-export ()
>    "Produce a checklist containing all unchecked items from a list
>  of checkbox items"
>    (interactive "*")
>    (if (org-entry-get (point) "LIST_EXPORT_BASENAME")
> -      (let* ((export-file (concat (org-entry-get (point) "LIST_EXPORT_BASENAME")
> -				  "-" (format-time-string export-time-format)
> +      (let* ((export-file (concat (org-entry-get (point) "LIST_EXPORT_BASENAME" nil)
> +				  "-" (format-time-string
> +				       org-checklist-export-time-format)
>  				  ".org"))
> +	     (print (case (org-entry-get (point) "PRINT_EXPORT" nil)
> +		      (("" "nil" nil) nil)
> +		      (t t)
> +		      (nil (y-or-n-p "Print list? "))))
>  	     exported-lines
> -	     title)
> +	     title "Checklist export")
>  	(save-restriction
>  	  (save-excursion
>  	    (org-narrow-to-subtree)
> +	    (org-update-checkbox-count-maybe)
>  	    (org-show-subtree)
>  	    (goto-char (point-min))
> -	    (if (looking-at org-complex-heading-regexp)
> -		(setq title (match-string 4)))
> +	    (when (looking-at org-complex-heading-regexp)
> +	      (setq title (match-string 4)))
>  	    (goto-char (point-min))
>  	    (let ((end (point-max)))
>  	      (while (< (point) end)
> @@ -85,14 +118,18 @@ of checkbox items"
>  	    (dolist (entry exported-lines) (insert entry))
>  	    (org-update-checkbox-count-maybe)
>  	    (write-file export-file)
> -	    (if (y-or-n-p "Print list? ")
> -		((funcall export-function)
> -		 (a2ps-buffer))))))))
> +	    (if (print)
> +		(progn (funcall org-checklist-export-function
> +				org-checklist-export-params)
> +		       (let* ((current-a2ps-switches a2ps-switches)
> +			      (a2ps-switches (append current-a2ps-switches
> +						     org-checklist-a2ps-params)))
> +			 (a2ps-buffer)))))))))
>  
>  (defun org-checklist ()
> -  (if (member state org-done-keywords)
> -      (org-make-checklist-export))
> -  (org-reset-checkbox-state-maybe))
> +  (when (member state org-done-keywords)
> +    (org-make-checklist-export)
> +    (org-reset-checkbox-state-maybe)))
>  
>  (add-hook 'org-after-todo-state-change-hook 'org-checklist)
>  
> diff --git a/lisp/org.el b/lisp/org.el
> index 8843486..d08155a 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -184,6 +184,7 @@ to add the symbol `xyz', and the package must have a call to
>  	(const :tag "C  annotation-helper: Call Remember directly from Browser (OBSOLETE, use org-protocol)" org-annotation-helper)
>  	(const :tag "C  bookmark:          Org links to bookmarks" org-bookmark)
>  	(const :tag "C  browser-url:       Store link, directly from Browser (OBSOLETE, use org-protocol)" org-browser-url)
> +	(const :tag "C  checklist:         Extra functions for checklists in repeated tasks" org-checklist)
>  	(const :tag "C  choose:            Use TODO keywords to mark decisions states" org-choose)
>  	(const :tag "C  collector:         Collect properties into tables" org-collector)
>  	(const :tag "C  depend:            TODO dependencies for Org-mode (PARTIALLY OBSOLETE, see built-in dependency support))" org-depend)

-- 
 Bastien

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [misc-new-features 3/5] Add an option to sort tags automatically.
  2009-07-14 11:59       ` [misc-new-features 3/5] Add an option to sort tags automatically Bastien
@ 2009-07-14 16:01         ` James TD Smith
  2009-07-17 17:04           ` Bastien
  0 siblings, 1 reply; 29+ messages in thread
From: James TD Smith @ 2009-07-14 16:01 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

Hi Bastien,

On 2009-07-14 13:59:11(+0200), Bastien wrote:
> Thanks James.
>
> Can people try this and give some feedback if they find it useful?

Sure. I wrote it because I thought having tags in alphabetical order would look
better, but I think it also makes the tags easier to read. For example if you
have many entries with similar tags it's much easier to compare the tag lists
when they are ordered.

I'm thinking about writing a sort function which would sort by tag group as well
as the tag name. I have tag groups for things like location, activity type,
people I need to work with etc and putting those in a consistent order would
make it easier to pick out the relevant information quickly.

James

--
|-<James TD Smith>-<email/ahktenzero@mohorovi.cc>-|

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [misc-new-features 1/5] Add two new special properties, SINCE and SINCE_IA.
  2009-07-14 11:48   ` [misc-new-features 1/5] Add two new special properties, SINCE and SINCE_IA Bastien
@ 2009-07-14 17:44     ` James TD Smith
  0 siblings, 0 replies; 29+ messages in thread
From: James TD Smith @ 2009-07-14 17:44 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

Hi Bastien,

On 2009-07-14 13:48:09(+0200), Bastien wrote:
> Hi James,
>
> welcome back.  Carsten is on vacation for three weeks and I'm
> maintaining Org in the meanwhile.

Thanks. I'd forgotten Carsten was away.

> I won't take the decision of adding new special properties without
> asking him so I don't apply this patch for now.  But I will use your
> patch for a while and see if I find it useful.  If others can test it
> as well and give their feedback, even better.

I use this mostly to check the age of entries when reviewing my todo lists;
either to cull old tasks I haven't started and aren't interested in any more, or to
remind me that I haven't worked on a task for a while and ought to do so.

I used to use the TIMESTAMP and TIMESTAMP_IA properties for this, and the new
properties work in more or less the same way but display the results
differently.

James

--
|-<James TD Smith>-<email/ahktenzero@mohorovi.cc>-|

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [misc-new-features 3/5] Add an option to sort tags automatically.
  2009-07-13  8:28     ` [misc-new-features 3/5] Add an option to sort tags automatically James TD Smith
  2009-07-13  8:28       ` [misc-new-features 4/5] Allow org-insert-link to check the X clipboard and the Emacs kill-ring for links, as well as the stored links. This makes getting URLs into org from a browser much easier, as you don't have to paste the URL into the minibuffer to insert a link James TD Smith
  2009-07-14 11:59       ` [misc-new-features 3/5] Add an option to sort tags automatically Bastien
@ 2009-07-17 16:38       ` Bastien
  2 siblings, 0 replies; 29+ messages in thread
From: Bastien @ 2009-07-17 16:38 UTC (permalink / raw)
  To: James TD Smith; +Cc: emacs-orgmode

I applied this patch, thanks a lot.

James TD Smith <ahktenzero@mohorovi.cc> writes:

> ---
>  lisp/ChangeLog |    3 +++
>  lisp/org.el    |   17 ++++++++++++++++-
>  2 files changed, 19 insertions(+), 1 deletions(-)
>
> diff --git a/lisp/ChangeLog b/lisp/ChangeLog
> index 348ade3..9ce7a17 100755
> --- a/lisp/ChangeLog
> +++ b/lisp/ChangeLog
> @@ -11,6 +11,9 @@
>  	SINCE_IA. These give the time since any active or inactive
>  	timestamp in an entry.
>  	(org-special-properties): Add SINCE, SINCE_IA.
> +	(org-tags-sort-function): Add custom declaration for tags
> +	sorting function.
> +	(org-set-tags): Sort tags if org-tags-sort-function is set
>  
>  2009-07-08  Carsten Dominik  <carsten.dominik@gmail.com>
>  
> diff --git a/lisp/org.el b/lisp/org.el
> index d08155a..854d09c 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -2337,6 +2337,15 @@ is better to limit inheritance to certain tags using the variables
>  	  (const :tag "Yes, do list them" t)
>  	  (const :tag "List them, indented with leading dots" indented)))
>  
> +(defcustom org-tags-sort-function nil
> +  "When set, tags are sorted using this function as a comparator"
> +  :group 'org-tags
> +  :type '(choice
> +	  (const :tag "No sorting" nil)
> +	  (const :tag "Alphabetical" string<)
> +	  (const :tag "Reverse alphabetical" string>)
> +	  (function :tag "Custom function" nil)))
> +
>  (defvar org-tags-history nil
>    "History of minibuffer reads for tags.")
>  (defvar org-last-tags-completion-table nil
> @@ -10840,11 +10849,17 @@ With prefix ARG, realign all tags in headings in the current buffer."
>  	  ;; No boolean logic, just a list
>  	  (setq tags (replace-match ":" t t tags))))
>  
> +      (if org-tags-sort-function
> +	  (setq tags (mapconcat 'identity
> +				(sort (org-split-string tags (org-re "[^[:alnum:]_@]+"))
> +				      org-tags-sort-function) ":")))
> +
>        (if (string-match "\\`[\t ]*\\'" tags)
> -          (setq tags "")
> +	  (setq tags "")
>  	(unless (string-match ":$" tags) (setq tags (concat tags ":")))
>  	(unless (string-match "^:" tags) (setq tags (concat ":" tags))))
>  
> +
>        ;; Insert new tags at the correct column
>        (beginning-of-line 1)
>        (cond

-- 
 Bastien

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [misc-new-features 1/5] Add two new special properties, SINCE and SINCE_IA.
  2009-07-13  8:27 ` [misc-new-features 1/5] Add two new special properties, SINCE and SINCE_IA James TD Smith
  2009-07-13  8:27   ` [misc-new-features 2/5] Bugfixes, documentation and custom options for org-checklist James TD Smith
  2009-07-14 11:48   ` [misc-new-features 1/5] Add two new special properties, SINCE and SINCE_IA Bastien
@ 2009-07-17 16:55   ` Bastien
  2009-07-17 18:22     ` James TD Smith
  2 siblings, 1 reply; 29+ messages in thread
From: Bastien @ 2009-07-17 16:55 UTC (permalink / raw)
  To: James TD Smith; +Cc: emacs-orgmode

Hi James, 

sorry for the delay.  As I said, I will let Carsten decides about this
patch.  While I like the idea of displaying this information in column
view, I'm unsure whether it's relevant to add another special property.

Two arguments: (1) this special property, contrary to other ones, is a
_relative_ property.  The information it displays in the column view is
not displayed in the subtree, it is dynamically computed when displaying
the column.  So it is a "special special property". (2) The 2nd argument
is that, it would be more useful to have a custom summary-type mechanism
rather than adding too many special properties.  Displaying SINCE could
be done by such a mechanism.  

What do you think?

James TD Smith <ahktenzero@mohorovi.cc> writes:

> These give the elapsed time since the TIMESTAMP and TIMESTAMP_IA
> properties. This value is in days, as a floating point number.
>
> For display in column view, this is converted to a human-readable time
> interval in the form 8d 02h 12m 22s.
> ---
>  lisp/ChangeLog      |   18 ++++++++++++++++--
>  lisp/org-colview.el |   36 ++++++++++++++++++++++++------------
>  lisp/org.el         |   23 ++++++++++++++++++-----
>  3 files changed, 58 insertions(+), 19 deletions(-)
>
> diff --git a/lisp/ChangeLog b/lisp/ChangeLog
> index 351731d..348ade3 100755
> --- a/lisp/ChangeLog
> +++ b/lisp/ChangeLog
> @@ -1,3 +1,17 @@
> +2009-07-12  James TD Smith  <ahktenzero@mohorovi.cc>
> +
> +	* org-colview.el (org-format-time-period): Formats a time in
> +	fractional days as days, hours, mins, seconds.
> +	(org-columns-display-here): Add special handling for SINCE and
> +	SINCE_IA to format for display.
> +
> +	* org.el (org-time-since): Add a function to get the time since an
> +	org timestamp.
> +	(org-entry-properties): Add two new special properties: SINCE and
> +	SINCE_IA. These give the time since any active or inactive
> +	timestamp in an entry.
> +	(org-special-properties): Add SINCE, SINCE_IA.
> +
>  2009-07-08  Carsten Dominik  <carsten.dominik@gmail.com>
>  
>  	* org-clock.el (org-clock-goto): Find hidden headlines as well.
> @@ -561,7 +575,7 @@
>  	`org-export-push-to-kill-ring'.
>  
>  	* org-exp.el (org-export-show-temporary-export-buffer): New
> -	option. 
> +	option.
>  
>  	* org-latex.el (org-export-as-latex): Use
>  	`org-export-show-temporary-export-buffer'.
> @@ -2861,7 +2875,7 @@
>  	(org-agenda-change-all-lines, org-tags-sparse-tree)
>  	(org-time-string-to-absolute, org-small-year-to-year)
>  	(org-link-escape): Re-apply changes accidentially overwritten
> -	by last commit to Emacs.
> +	by last commit to Emacs
>  
>  2008-11-23  Carsten Dominik  <carsten.dominik@gmail.com>
>  
> diff --git a/lisp/org-colview.el b/lisp/org-colview.el
> index 7633b5b..6a89849 100644
> --- a/lisp/org-colview.el
> +++ b/lisp/org-colview.el
> @@ -190,18 +190,19 @@ This is the compiled version of the format.")
>  		      (length property))
>  	    f (format "%%-%d.%ds | " width width)
>  	    val (or (cdr ass) "")
> -	    modval (or (and org-columns-modify-value-for-display-function
> -			    (functionp
> -			     org-columns-modify-value-for-display-function)
> -			    (funcall
> -			     org-columns-modify-value-for-display-function
> -			     title val))
> -		       (if (equal property "ITEM")
> -			   (if (org-mode-p)
> -			       (org-columns-cleanup-item
> -				val org-columns-current-fmt-compiled)
> -			     (org-agenda-columns-cleanup-item
> -			      val pl cphr org-columns-current-fmt-compiled)))))
> +	    modval (cond ((and org-columns-modify-value-for-display-function
> +			       (functionp
> +				org-columns-modify-value-for-display-function))
> +			  (funcall org-columns-modify-value-for-display-function
> +				   title val))
> +		       ((equal property "ITEM")
> +			(if (org-mode-p)
> +			    (org-columns-cleanup-item
> +			     val org-columns-current-fmt-compiled)
> +			  (org-agenda-columns-cleanup-item
> +			   val pl cphr org-columns-current-fmt-compiled)))
> +		       ((or (equal property "SINCE") (equal property "SINCE_IA"))
> +			(org-format-time-period val))))
>        (setq s2 (org-columns-add-ellipses (or modval val) width))
>        (setq string (format f s2))
>        ;; Create the overlay
> @@ -1388,6 +1389,17 @@ This will add overlays to the date lines, to show the summary for each day."
>  			   (equal (nth 4 a) (nth 4 fm)))
>  		  (org-columns-compute (car fm)))))))))))
>  
> +(defun org-format-time-period (interval)
> +  (if (stringp interval)
> +      ""
> +    (let* ((days (floor interval))
> +	   (frac-hours (* 24 (- interval days)))
> +	   (hours (floor frac-hours))
> +	   (minutes (floor (* 60 (- frac-hours hours))))
> +	   (seconds (floor (* 60 (- (* 60 (- frac-hours hours)) minutes)))))
> +      (format "%dd %02dh %02dm %02ds" days hours minutes seconds))))
> +
> +
>  (provide 'org-colview)
>  
>  ;; arch-tag: 61f5128d-747c-4983-9479-e3871fa3d73c
> diff --git a/lisp/org.el b/lisp/org.el
> index feaa115..8843486 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -6481,7 +6481,10 @@ WITH-CASE, the sorting considers case as well."
>  		   (string-to-char (match-string 2))
>  		 org-default-priority))
>  	      ((= dcst ?r)
> -	       (or (org-entry-get nil property) ""))
> +	       (or (org-entry-get nil property)
> +		   (if (or (equal property "SINCE") (equal property "SINCE_IA"))
> +		       0
> +		     "")))
>  	      ((= dcst ?o)
>  	       (if (looking-at org-complex-heading-regexp)
>  		   (- 9999 (length (member (match-string 2)
> @@ -11286,10 +11289,9 @@ a *different* entry, you cannot use these techniques."
>  ;;;; Properties
>  
>  ;;; Setting and retrieving properties
> -
>  (defconst org-special-properties
>    '("TODO" "TAGS" "ALLTAGS" "DEADLINE" "SCHEDULED" "CLOCK" "CLOSED" "PRIORITY"
> -    "TIMESTAMP" "TIMESTAMP_IA")
> +    "TIMESTAMP" "TIMESTAMP_IA" "SINCE" "SINCE_IA")
>    "The special properties valid in Org-mode.
>  
>  These are properties that are not defined in the property drawer,
> @@ -11433,8 +11435,13 @@ If WHICH is nil or `all', get all properties.  If WHICH is
>  		  (setq key "TIMESTAMP")))
>  	      (when (or (equal key clockstr) (not (assoc key props)))
>  		(push (cons key string) props)))
> -
> -	    )
> +	    (when (assoc "TIMESTAMP_IA" props)
> +	      (push (cons "SINCE_IA"
> +			  (org-time-since (cdr (assoc "TIMESTAMP_IA" props))))
> +		    props))
> +	    (when (assoc "TIMESTAMP" props)
> +	      (push (cons "SINCE" (org-time-since (cdr (assoc "TIMESTAMP" props))))
> +		    props)))
>  
>  	  (when (memq which '(all standard))
>  	    ;; Get the standard properties, like :PROP: ...
> @@ -11460,6 +11467,12 @@ If WHICH is nil or `all', get all properties.  If WHICH is
>  	    (push (cons "CATEGORY" value) props))
>  	  (append sum-props (nreverse props)))))))
>  
> +(defun org-time-since (time)
> +  "Get the number of days since `time'"
> +  (time-to-number-of-days (time-since (apply 'encode-time
> +					     (org-parse-time-string time)))))
> +
> +
>  (defun org-entry-get (pom property &optional inherit)
>    "Get value of PROPERTY for entry at point-or-marker POM.
>  If INHERIT is non-nil and the entry does not have the property,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [misc-new-features 5/5] Fix a problem I was having with plots using a script. Org-plot was deleting the data file before gnuplot read it in. I've moved the deletion of the temporary data file to an idle timer, which has fixed the problem.
  2009-07-13  8:28         ` [misc-new-features 5/5] Fix a problem I was having with plots using a script. Org-plot was deleting the data file before gnuplot read it in. I've moved the deletion of the temporary data file to an idle timer, which has fixed the problem James TD Smith
  2009-07-13 11:56           ` Bernt Hansen
  2009-07-14 11:57           ` Bastien
@ 2009-07-17 17:03           ` Bastien
  2 siblings, 0 replies; 29+ messages in thread
From: Bastien @ 2009-07-17 17:03 UTC (permalink / raw)
  To: James TD Smith; +Cc: emacs-orgmode

Applied, thanks.

James TD Smith <ahktenzero@mohorovi.cc> writes:

> ---
>  lisp/org-plot.el |   14 +++++++-------
>  1 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/lisp/org-plot.el b/lisp/org-plot.el
> index 0e8f5a2..c9d61b3 100644
> --- a/lisp/org-plot.el
> +++ b/lisp/org-plot.el
> @@ -333,12 +333,12 @@ line directly before or after the table."
>        (with-temp-buffer
>  	(if (plist-get params :script) ;; user script
>  	    (progn (insert
> -                    (org-plot/gnuplot-script data-file num-cols params t))
> -                   (insert "\n")
> -                   (insert-file-contents (plist-get params :script))
> -                   (goto-char (point-min))
> -                   (while (re-search-forward "$datafile" nil t)
> -                     (replace-match data-file nil nil)))
> +		    (org-plot/gnuplot-script data-file num-cols params t))
> +		   (insert "\n")
> +		   (insert-file-contents (plist-get params :script))
> +		   (goto-char (point-min))
> +		   (while (re-search-forward "$datafile" nil t)
> +		     (replace-match data-file nil nil)))
>  	  (insert
>  	   (org-plot/gnuplot-script data-file num-cols params)))
>  	;; graph table
> @@ -346,7 +346,7 @@ line directly before or after the table."
>  	(gnuplot-send-buffer-to-gnuplot))
>        ;; cleanup
>        (bury-buffer (get-buffer "*gnuplot*"))
> -      (delete-file data-file))))
> +      (run-with-idle-timer 0.1 nil (lambda () (delete-file data-file))))))
>  
>  (provide 'org-plot)

-- 
 Bastien

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [misc-new-features 3/5] Add an option to sort tags automatically.
  2009-07-14 16:01         ` James TD Smith
@ 2009-07-17 17:04           ` Bastien
  0 siblings, 0 replies; 29+ messages in thread
From: Bastien @ 2009-07-17 17:04 UTC (permalink / raw)
  To: James TD Smith; +Cc: emacs-orgmode

James TD Smith <ahktenzero@mohorovi.cc> writes:

>> Can people try this and give some feedback if they find it useful?

I have applied your patch, thanks.

> Sure. I wrote it because I thought having tags in alphabetical order would look
> better, but I think it also makes the tags easier to read. For example if you
> have many entries with similar tags it's much easier to compare the tag lists
> when they are ordered.

Yes, it makes sense to me. 

> I'm thinking about writing a sort function which would sort by tag group as well
> as the tag name. I have tag groups for things like location, activity type,
> people I need to work with etc and putting those in a consistent order would
> make it easier to pick out the relevant information quickly.

Please share such a sorting function when available.

Thanks!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [misc-new-features 4/5] Allow org-insert-link to check the X clipboard and the Emacs kill-ring for links, as well as the stored links. This makes getting URLs into org from a browser much easier, as you don't have to paste the URL into the minibuffer to insert a link.
  2009-07-13  8:28       ` [misc-new-features 4/5] Allow org-insert-link to check the X clipboard and the Emacs kill-ring for links, as well as the stored links. This makes getting URLs into org from a browser much easier, as you don't have to paste the URL into the minibuffer to insert a link James TD Smith
                           ` (2 preceding siblings ...)
  2009-07-14 12:07         ` [misc-new-features 4/5] Allow org-insert-link to check the X clipboard and the Emacs kill-ring for links, as well as the stored links. This makes getting URLs into org from a browser much easier, as you don't have to paste the URL into the minibuffer to insert a link Bastien
@ 2009-07-17 17:20         ` Bastien
  3 siblings, 0 replies; 29+ messages in thread
From: Bastien @ 2009-07-17 17:20 UTC (permalink / raw)
  To: James TD Smith; +Cc: emacs-orgmode

Hi James,

I'm still hesitating for this patch.  

Something I like when I insert a link is that I get rid of it, it
doesn't stay in org-stored-links (unless explicitely told so).  If
org-insert-links accepts links from the kill-ring and/or from the
clipboard, then some links will stay.  More generally, the source of
links becomes a bit "unstable".  

I understand the purpose and I see how it could be useful but I would
need other advice on this.

Thanks!

James TD Smith <ahktenzero@mohorovi.cc> writes:

> You can customise `org-link-check-clipboards' to check either the X clipboards
> or kill-ring only, or both, or none. If you have the interprogram-cut/paste
> functions set, you probably only want to use the kill-ring only.
> ---
>  lisp/ChangeLog |    5 ++++
>  lisp/org.el    |   66 ++++++++++++++++++++++++++++++++++++++++---------------
>  2 files changed, 53 insertions(+), 18 deletions(-)
>
> diff --git a/lisp/ChangeLog b/lisp/ChangeLog
> index 9ce7a17..662a585 100755
> --- a/lisp/ChangeLog
> +++ b/lisp/ChangeLog
> @@ -14,6 +14,11 @@
>  	(org-tags-sort-function): Add custom declaration for tags
>  	sorting function.
>  	(org-set-tags): Sort tags if org-tags-sort-function is set
> +	(org-link-check-clipboards): Add a custom option for
> +	clipboard link checking
> +	(org-insert-link): If enabled, check the X clipboard and emacs
> +	kill ring for strings which look like links, and include them in
> +	the stored links to select from.
>  
>  2009-07-08  Carsten Dominik  <carsten.dominik@gmail.com>
>  
> diff --git a/lisp/org.el b/lisp/org.el
> index 854d09c..47fb0b6 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -1024,6 +1024,15 @@ to use."
>    :group 'org-link
>    :type 'function)
>  
> +(defcustom org-link-check-clipboards nil
> +  "Should org-insert-link check clipboards for links"
> +  :group 'org-link
> +  :type '(choice
> +	  (const :tag "Just stored links" nil)
> +	  (const :tag "The X11 clipboards" x)
> +	  (const :tag "The Emacs kill-ring" emacs)
> +	  (const :tag "Both" both)))
> +
>  (defgroup org-link-store nil
>    "Options concerning storing links in Org-mode."
>    :tag "Org Store Link"
> @@ -7323,6 +7332,7 @@ used as the link location instead of reading one interactively."
>  	 (desc region)
>  	 tmphist ; byte-compile incorrectly complains about this
>  	 (link link-location)
> +	 (stored-links org-stored-links)
>  	 entry file all-prefixes)
>      (cond
>       (link-location) ; specified by arg, just use it.
> @@ -7342,26 +7352,46 @@ used as the link location instead of reading one interactively."
>       ((member complete-file '((4) (16)))
>        ;; Completing read for file names.
>        (setq link (org-file-complete-link complete-file)))
> -     (t
> -      ;; Read link, with completion for stored links.
> -      (with-output-to-temp-buffer "*Org Links*"
> -	(princ "Insert a link.
> +     (t ;; Read link, with completion for stored links.
> +      ;;Check clipboards/kill ring for links
> +      (when org-link-check-clipboards
> +	(setq stored-links
> +	      (append stored-links
> +		      (mapcar
> +		       (lambda (x) (list x "Link from clipboard"))
> +		       (remove
> +			nil
> +			(remove-duplicates
> +			 (mapcar
> +			  (lambda (x)
> +			    (when (and x (string-match org-link-types-re x)) x))
> +			  (append (when
> +				      (or (eq org-link-check-clipboards 'x)
> +					  (eq org-link-check-clipboards 'both))
> +				    (list (org-get-x-clipboard 'PRIMARY)
> +					  (org-get-x-clipboard 'CLIPBOARD)
> +					  (org-get-x-clipboard 'SECONDARY)))
> +				  (when
> +				      (or (eq org-link-check-clipboards 'emacs)
> +					  (eq org-link-check-clipboards 'both))
> +				    (mapcar 'org-no-properties kill-ring))))))))))
> +	(with-output-to-temp-buffer "*Org Links*"
> +	  (princ "Insert a link.
>  Use TAB to complete link prefixes, then RET for type-specific completion support\n")
> -	(when org-stored-links
> -	  (princ "\nStored links are available with <up>/<down> or M-p/n (most recent with RET):\n\n")
> -	  (princ (mapconcat
> -		  (lambda (x)
> -		    (if (nth 1 x) (concat (car x) " (" (nth 1 x) ")") (car x)))
> -		  (reverse org-stored-links) "\n"))))
> -      (let ((cw (selected-window)))
> -	(select-window (get-buffer-window "*Org Links*"))
> +	  (when stored-links
> +	    (princ "\nStored links are available with <up>/<down> or M-p/n (most recent with RET):\n\n")
> +	    (princ (mapconcat
> +		    (lambda (x)
> +		      (if (nth 1 x) (concat (car x) " (" (nth 1 x) ")") (car x)))
> +		    (reverse stored-links) "\n"))))
> +	(let ((cw (selected-window)))
> +	  (select-window (get-buffer-window "*Org Links*"))
>  	(setq truncate-lines t)
>  	(unless (pos-visible-in-window-p (point-max))
>  	  (org-fit-window-to-buffer))
>  	(and (window-live-p cw) (select-window cw)))
>        ;; Fake a link history, containing the stored links.
> -      (setq tmphist (append (mapcar 'car org-stored-links)
> -			    org-insert-link-history))
> +      (setq tmphist (append (mapcar 'car stored-links) org-insert-link-history))
>        (setq all-prefixes (append (mapcar 'car org-link-abbrev-alist-local)
>  				 (mapcar 'car org-link-abbrev-alist)
>  				 org-link-types))
> @@ -7375,7 +7405,7 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
>  			     all-prefixes)
>  		     nil nil nil
>  		     'tmphist
> -		     (or (car (car org-stored-links))))))
> +		     (or (car (car stored-links))))))
>  	    (if (or (member link all-prefixes)
>  		    (and (equal ":" (substring link -1))
>  			 (member (substring link 0 -1) all-prefixes)
> @@ -8729,8 +8759,8 @@ This function can be used in a hook."
>  ;;;; Completion
>  
>  (defconst org-additional-option-like-keywords
> -  '("BEGIN_HTML"  "END_HTML"  "HTML:" "ATTR_HTML" 
> -    "BEGIN_DocBook"  "END_DocBook"  "DocBook:" "ATTR_DocBook" 
> +  '("BEGIN_HTML"  "END_HTML"  "HTML:" "ATTR_HTML"
> +    "BEGIN_DocBook"  "END_DocBook"  "DocBook:" "ATTR_DocBook"
>      "BEGIN_LaTeX" "END_LaTeX" "LaTeX:" "LATEX_HEADER:"  "ATTR_LaTeX"
>      "BEGIN:" "END:"
>      "ORGTBL" "TBLFM:" "TBLNAME:"
> @@ -15842,7 +15872,7 @@ which make use of the date at the cursor."
>    (org-set-local 'comment-start-skip "^#+[ \t]*")
>    (org-set-local 'paragraph-separate "\f\\|\\*+ \\|[ 	]*$\\|[ \t]*[:|]")
>    ;; The paragraph starter includes hand-formatted lists.
> -  (org-set-local 
> +  (org-set-local
>     'paragraph-start
>     (concat
>      "\f" "\\|"

-- 
 Bastien

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [misc-new-features 1/5] Add two new special properties, SINCE and SINCE_IA.
  2009-07-17 16:55   ` Bastien
@ 2009-07-17 18:22     ` James TD Smith
  2009-07-18  9:35       ` Bastien
  0 siblings, 1 reply; 29+ messages in thread
From: James TD Smith @ 2009-07-17 18:22 UTC (permalink / raw)
  To: emacs-orgmode

Hi Bastien

On 2009-07-17 18:55:01(+0200), Bastien wrote:
> sorry for the delay.  As I said, I will let Carsten decides about this
> patch.  While I like the idea of displaying this information in column
> view, I'm unsure whether it's relevant to add another special property.
>
> Two arguments: (1) this special property, contrary to other ones, is a
> _relative_ property.  The information it displays in the column view is
> not displayed in the subtree, it is dynamically computed when displaying
> the column.  So it is a "special special property". (2) The 2nd argument
> is that, it would be more useful to have a custom summary-type mechanism
> rather than adding too many special properties.  Displaying SINCE could
> be done by such a mechanism.
>
> What do you think?

Actually, I've been thinking the same thing. When I wrote the patch adding a new
property looked like the easiest way to get what I wanted, but it's somewhat
limited. It would be useful to be able to use a property for the creation time
of an entry, rather than putting an inactive timestamp in the entry. There's
also the problem of being dependent on the order of the contents of the entry
(the TIMESTAMP and TIMESTAMP_IA special properties return the first timestamp in
the entry), so it only does the right thing if the LOGBOOK and PROPERTIES
drawers are at the top of the entry and in that order.

Having a column view operator for calculating time since would avoid this
problem and be much more flexible. I've been looking at the changes Mikael
Fornius' patch to org-columnview added, and I think I can add a new operator for
this fairly easily.

I still might want to add another special property, for the latest clocked time
for an entry. That way I can have a column for the creation time (stored in a
property) and a column for the last time I worked on the entry.

James

--
|-<James TD Smith>-<email/ahktenzero@mohorovi.cc>-|

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [misc-new-features 1/5] Add two new special properties, SINCE and SINCE_IA.
  2009-07-17 18:22     ` James TD Smith
@ 2009-07-18  9:35       ` Bastien
  2009-08-27 15:50         ` Manish
  0 siblings, 1 reply; 29+ messages in thread
From: Bastien @ 2009-07-18  9:35 UTC (permalink / raw)
  To: James TD Smith; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1043 bytes --]

Hi James, 

this small patch against current org-colview.el lets you have a custom
function for computing a "summary" of a property and displaying it in
the column.

To compute the time since the timestamp, you can use this patch and some
of your code like this:

--8<---------------cut here---------------start------------->8---
(setq org-columns-custom-summary-function 
      'my-org-compute-since)

(defun org-time-since (time)
  "Get the number of days since `time'"
  (time-to-number-of-days 
  (time-since (apply 'encode-time
		     (org-parse-time-string time)))))

(defun my-org-compute-since (&rest values)
  "Eval elapsted days since the entry's timestamp."
  (let* ((ts (org-entry-get (point) "TIMESTAMP")))
    (when ts (org-time-since ts))))
--8<---------------cut here---------------end--------------->8---

This patch is just a workaround, though.  I think we should have a way
of adding more than one custom function, as Mikael Fornius suggested
when sending his first patch.

Let's see what's Carsten take on this.

Thanks!


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org-colview.el.patch --]
[-- Type: text/x-diff, Size: 1959 bytes --]

diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index d132bf6..b312d35 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -698,20 +698,30 @@ around it."
 		(org-columns-display-here (cdr x)))
 	      cache)))))
 
+(defcustom org-columns-custom-summary-function nil
+  "A user-defined custom summary function.
+This function takes one argument: a list containing the values of
+all children for the summarized property.  This function should
+return a number."
+  :group 'org-link
+  :type 'function)
+
 (defvar org-columns-compile-map
-  '(("none"  none              +)
-    (":"     add_times         +)
-    ("+"     add_numbers       +)
-    ("$"     currency          +)
-    ("X"     checkbox          +)
-    ("X/"    checkbox-n-of-m   +)
-    ("X%"    checkbox-percent  +)
-    ("max"   max_numbers       max)
-    ("min"   min_numbers       min)
-    ("mean"  mean_numbers      (lambda (&rest x) (/ (apply '+ x) (float (length x)))))
-    (":max"  max_times         max)
-    (":min"  min_times         min)
-    (":mean" mean_times        (lambda (&rest x) (/ (apply '+ x) (float (length x))))))
+  '(("none"   none              +)
+    (":"      add_times         +)
+    ("+"      add_numbers       +)
+    ("$"      currency          +)
+    ("X"      checkbox          +)
+    ("X/"     checkbox-n-of-m   +)
+    ("X%"     checkbox-percent  +)
+    ("max"    max_numbers       max)
+    ("min"    min_numbers       min)
+    ("mean"   mean_numbers      (lambda (&rest x) (/ (apply '+ x) (float (length x)))))
+    (":max"   max_times         max)
+    (":min"   min_times         min)
+    (":mean"  mean_times        (lambda (&rest x) (/ (apply '+ x) (float (length x)))))
+    ("custom" custom_function   (lambda (&rest x) 
+				  (funcall org-columns-custom-summary-function x))))
   "Operator <-> format,function map.
 Used to compile/uncompile columns format and completing read in
 interactive function org-columns-new.")

[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


-- 
 Bastien

[-- Attachment #4: Type: text/plain, Size: 204 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* Re: [misc-new-features 2/5] Bugfixes, documentation and custom options for org-checklist.
  2009-07-13  8:27   ` [misc-new-features 2/5] Bugfixes, documentation and custom options for org-checklist James TD Smith
  2009-07-13  8:28     ` [misc-new-features 3/5] Add an option to sort tags automatically James TD Smith
  2009-07-14 12:09     ` [misc-new-features 2/5] Bugfixes, documentation and custom options for org-checklist Bastien
@ 2009-08-03 14:47     ` Carsten Dominik
  2009-08-03 21:17       ` James TD Smith
  2 siblings, 1 reply; 29+ messages in thread
From: Carsten Dominik @ 2009-08-03 14:47 UTC (permalink / raw)
  To: James TD Smith; +Cc: emacs-orgmode

Hi James,

I have applied this patch, with one modification:

I added a 'no-erro argument to the (load "a2ps-print") form,
to make sure that people who have not installed a2ps-print.el can
still use the other functionality in your package.  Please let me
know if this was not the right thing to do.

- Carsten

On Jul 13, 2009, at 10:27 AM, James TD Smith wrote:

> * contrib/lisp/org-checklist.el
>  - Fix some problems with the print/export feature in org-checklist.
>  - Add custom options for this module
>  - Fix some interaction with a2ps
>  - Only reset checkboxes if TODO state is done.
>
> * doc/org.texi
>  - Add documentation for org-checklist
>
> * lisp/org.el
>  - Add org-checklist to org-modules
> ---
> contrib/ChangeLog             |   16 ++++++++++
> contrib/lisp/org-checklist.el |   67 ++++++++++++++++++++++++++++++ 
> +---------
> lisp/org.el                   |    1 +
> 3 files changed, 69 insertions(+), 15 deletions(-)
>
> diff --git a/contrib/ChangeLog b/contrib/ChangeLog
> index 7e62df0..6a5c2a2 100644
> --- a/contrib/ChangeLog
> +++ b/contrib/ChangeLog
> @@ -1,3 +1,19 @@
> +2009-07-12  James TD Smith  <ahktenzero@mohorovi.cc>
> +
> +	* lisp/org-checklist.el (org-checklist): Add a custom group for
> +	org-checklist. The options are all for the unchecked items export
> +	function.
> +	(org-checklist-export-time-format): Allow customising the
> +	timestamp appended to the saved unchecked items list
> +	(org-checklist-export-function): Allow customising the output
> +	format for the unchecked items list.
> +	(org-checklist-export-params): Options for the exporter.
> +	(org-checklist-a2ps-params): Printing options.
> +	(org-make-checklist-export): Use values from custom vars. Printing
> +	is now controlled by the PRINT_EXPORT property in the entry, and
> +	the user is only asked if it is missing. Pass the switches to
> +	a2ps-buffer properly.
> +
> 2009-06-20  Carsten Dominik  <carsten.dominik@gmail.com>
>
> 	* README: List new file org-export-generic.el
> diff --git a/contrib/lisp/org-checklist.el b/contrib/lisp/org- 
> checklist.el
> index 26d228f..4ebf91b 100644
> --- a/contrib/lisp/org-checklist.el
> +++ b/contrib/lisp/org-checklist.el
> @@ -42,11 +42,37 @@
> ;;
> ;;; Code:
> (require 'org)
> +(load "a2ps-print")
>
> -(defvar export-time-format "%Y%m%d%H%M"
> -  "format of timestamp appended to export file")
> -(defvar export-function 'org-export-as-ascii
> -  "function used to prepare the export file for printing")
> +(defgroup org-checklist nil
> +  "Extended checklist handling for org"
> +  :tag "Org-checklist"
> +  :group 'org)
> +
> +(defcustom org-checklist-export-time-format "%Y%m%d%H%M"
> +  "The format of timestamp appended to LIST_EXPORT_BASENAME to
> +  make the name of the export file."
> +  :link '(function-link format-time-string)
> +  :group 'org-checklist
> +  :type 'string)
> +
> +(defcustom org-checklist-export-function 'org-export-as-ascii
> +  "function used to prepare the export file for printing"
> +  :group 'org-checklist
> +  :type '(radio (function-item :tag "ascii text" org-export-as-ascii)
> +		(function-item :tag "HTML"  org-export-as-html)
> +		(function-item :tag "LaTeX" :value org-export-as-latex)
> +		(function-item :tag "XOXO" :value org-export-as-xoxo)))
> +
> +(defcustom org-checklist-export-params nil
> +  "options for the export function file for printing"
> +  :group 'org-checklist
> +  :type '(repeat string))
> +
> +(defcustom org-checklist-a2ps-params nil
> +  "options for a2ps for printing"
> +  :group 'org-checklist
> +  :type '(repeat string))
>
> (defun org-reset-checkbox-state-maybe ()
>   "Reset all checkboxes in an entry if the `RESET_CHECK_BOXES'  
> property is set"
> @@ -54,23 +80,30 @@
>   (if (org-entry-get (point) "RESET_CHECK_BOXES")
>       (org-reset-checkbox-state-subtree)))
>
> +
> (defun org-make-checklist-export ()
>   "Produce a checklist containing all unchecked items from a list
> of checkbox items"
>   (interactive "*")
>   (if (org-entry-get (point) "LIST_EXPORT_BASENAME")
> -      (let* ((export-file (concat (org-entry-get (point)  
> "LIST_EXPORT_BASENAME")
> -				  "-" (format-time-string export-time-format)
> +      (let* ((export-file (concat (org-entry-get (point)  
> "LIST_EXPORT_BASENAME" nil)
> +				  "-" (format-time-string
> +				       org-checklist-export-time-format)
> 				  ".org"))
> +	     (print (case (org-entry-get (point) "PRINT_EXPORT" nil)
> +		      (("" "nil" nil) nil)
> +		      (t t)
> +		      (nil (y-or-n-p "Print list? "))))
> 	     exported-lines
> -	     title)
> +	     title "Checklist export")
> 	(save-restriction
> 	  (save-excursion
> 	    (org-narrow-to-subtree)
> +	    (org-update-checkbox-count-maybe)
> 	    (org-show-subtree)
> 	    (goto-char (point-min))
> -	    (if (looking-at org-complex-heading-regexp)
> -		(setq title (match-string 4)))
> +	    (when (looking-at org-complex-heading-regexp)
> +	      (setq title (match-string 4)))
> 	    (goto-char (point-min))
> 	    (let ((end (point-max)))
> 	      (while (< (point) end)
> @@ -85,14 +118,18 @@ of checkbox items"
> 	    (dolist (entry exported-lines) (insert entry))
> 	    (org-update-checkbox-count-maybe)
> 	    (write-file export-file)
> -	    (if (y-or-n-p "Print list? ")
> -		((funcall export-function)
> -		 (a2ps-buffer))))))))
> +	    (if (print)
> +		(progn (funcall org-checklist-export-function
> +				org-checklist-export-params)
> +		       (let* ((current-a2ps-switches a2ps-switches)
> +			      (a2ps-switches (append current-a2ps-switches
> +						     org-checklist-a2ps-params)))
> +			 (a2ps-buffer)))))))))
>
> (defun org-checklist ()
> -  (if (member state org-done-keywords)
> -      (org-make-checklist-export))
> -  (org-reset-checkbox-state-maybe))
> +  (when (member state org-done-keywords)
> +    (org-make-checklist-export)
> +    (org-reset-checkbox-state-maybe)))
>
> (add-hook 'org-after-todo-state-change-hook 'org-checklist)
>
> diff --git a/lisp/org.el b/lisp/org.el
> index 8843486..d08155a 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -184,6 +184,7 @@ to add the symbol `xyz', and the package must  
> have a call to
> 	(const :tag "C  annotation-helper: Call Remember directly from  
> Browser (OBSOLETE, use org-protocol)" org-annotation-helper)
> 	(const :tag "C  bookmark:          Org links to bookmarks" org- 
> bookmark)
> 	(const :tag "C  browser-url:       Store link, directly from  
> Browser (OBSOLETE, use org-protocol)" org-browser-url)
> +	(const :tag "C  checklist:         Extra functions for checklists  
> in repeated tasks" org-checklist)
> 	(const :tag "C  choose:            Use TODO keywords to mark  
> decisions states" org-choose)
> 	(const :tag "C  collector:         Collect properties into tables"  
> org-collector)
> 	(const :tag "C  depend:            TODO dependencies for Org-mode  
> (PARTIALLY OBSOLETE, see built-in dependency support))" org-depend)
> -- 
> 1.6.3.3
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [misc-new-features 2/5] Bugfixes, documentation and custom options for org-checklist.
  2009-08-03 14:47     ` Carsten Dominik
@ 2009-08-03 21:17       ` James TD Smith
  0 siblings, 0 replies; 29+ messages in thread
From: James TD Smith @ 2009-08-03 21:17 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

Hi Carsten,

On 2009-08-03 16:47:55(+0200), Carsten Dominik wrote:
> I have applied this patch, with one modification:
>
> I added a 'no-erro argument to the (load "a2ps-print") form,
> to make sure that people who have not installed a2ps-print.el can
> still use the other functionality in your package.  Please let me
> know if this was not the right thing to do.

Yes, that's fine.

James

--
|-<James TD Smith>-<email/ahktenzero@mohorovi.cc>-|

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [misc-new-features 1/5] Add two new special properties, SINCE and SINCE_IA.
  2009-07-18  9:35       ` Bastien
@ 2009-08-27 15:50         ` Manish
  2009-08-28 17:59           ` James TD Smith
  0 siblings, 1 reply; 29+ messages in thread
From: Manish @ 2009-08-27 15:50 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

On Sat, Jul 18, 2009 at 3:05 PM, Bastien wrote:
> Hi James,
>
> this small patch against current org-colview.el lets you have a custom
> function for computing a "summary" of a property and displaying it in
> the column.
>
> To compute the time since the timestamp, you can use this patch and some
> of your code like this:
>
> --8<---------------cut here---------------start------------->8---
> (setq org-columns-custom-summary-function
>      'my-org-compute-since)
>
> (defun org-time-since (time)
>  "Get the number of days since `time'"
>  (time-to-number-of-days
>  (time-since (apply 'encode-time
>                     (org-parse-time-string time)))))
>
> (defun my-org-compute-since (&rest values)
>  "Eval elapsted days since the entry's timestamp."
>  (let* ((ts (org-entry-get (point) "TIMESTAMP")))
>    (when ts (org-time-since ts))))
> --8<---------------cut here---------------end--------------->8---
>
> This patch is just a workaround, though.  I think we should have a way
> of adding more than one custom function, as Mikael Fornius suggested
> when sending his first patch.
>
> Let's see what's Carsten take on this.
>

This is/was a very interesting idea.  Any thoughts if this would go
in?  Or did it already go in and I missed it?

-- 
Manish

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [misc-new-features 1/5] Add two new special properties, SINCE and SINCE_IA.
  2009-08-27 15:50         ` Manish
@ 2009-08-28 17:59           ` James TD Smith
  0 siblings, 0 replies; 29+ messages in thread
From: James TD Smith @ 2009-08-28 17:59 UTC (permalink / raw)
  To: Manish; +Cc: Bastien, emacs-orgmode

Hi Manish,

On 2009-08-27 21:20:53(+0530), Manish wrote:
> On Sat, Jul 18, 2009 at 3:05 PM, Bastien wrote:
> >
> > This patch is just a workaround, though. I think we should have a way of
> > adding more than one custom function, as Mikael Fornius suggested when
> > sending his first patch.
> >
> > Let's see what's Carsten take on this.
>
> This is/was a very interesting idea. Any thoughts if this would go in? Or did
> it already go in and I missed it?

Carsten and I agreed offlist not to apply my original patch, and that I would
work on a better implementation using column summaries. I've got it mostly
working.

--
|-<James TD Smith>-<email/ahktenzero@mohorovi.cc>-|

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2009-08-28 17:59 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-13  8:27 Working on org again James TD Smith
2009-07-13  8:27 ` [misc-new-features 1/5] Add two new special properties, SINCE and SINCE_IA James TD Smith
2009-07-13  8:27   ` [misc-new-features 2/5] Bugfixes, documentation and custom options for org-checklist James TD Smith
2009-07-13  8:28     ` [misc-new-features 3/5] Add an option to sort tags automatically James TD Smith
2009-07-13  8:28       ` [misc-new-features 4/5] Allow org-insert-link to check the X clipboard and the Emacs kill-ring for links, as well as the stored links. This makes getting URLs into org from a browser much easier, as you don't have to paste the URL into the minibuffer to insert a link James TD Smith
2009-07-13  8:28         ` [misc-new-features 5/5] Fix a problem I was having with plots using a script. Org-plot was deleting the data file before gnuplot read it in. I've moved the deletion of the temporary data file to an idle timer, which has fixed the problem James TD Smith
2009-07-13 11:56           ` Bernt Hansen
2009-07-14 11:57           ` Bastien
2009-07-17 17:03           ` Bastien
2009-07-13 11:55         ` [misc-new-features 4/5] Allow org-insert-link to check the X clipboard and the Emacs kill-ring for links, as well as the stored links. This makes getting URLs into org from a browser much easier, as you don't have to paste the URL into the minibuffer to insert a link Bernt Hansen
2009-07-13 12:13           ` [misc-new-features 4/5] extra long subject lines James TD Smith
2009-07-13 15:35             ` Bernt Hansen
2009-07-14 12:07         ` [misc-new-features 4/5] Allow org-insert-link to check the X clipboard and the Emacs kill-ring for links, as well as the stored links. This makes getting URLs into org from a browser much easier, as you don't have to paste the URL into the minibuffer to insert a link Bastien
2009-07-17 17:20         ` Bastien
2009-07-14 11:59       ` [misc-new-features 3/5] Add an option to sort tags automatically Bastien
2009-07-14 16:01         ` James TD Smith
2009-07-17 17:04           ` Bastien
2009-07-17 16:38       ` Bastien
2009-07-14 12:09     ` [misc-new-features 2/5] Bugfixes, documentation and custom options for org-checklist Bastien
2009-07-14  8:52       ` James TD Smith
2009-08-03 14:47     ` Carsten Dominik
2009-08-03 21:17       ` James TD Smith
2009-07-14 11:48   ` [misc-new-features 1/5] Add two new special properties, SINCE and SINCE_IA Bastien
2009-07-14 17:44     ` James TD Smith
2009-07-17 16:55   ` Bastien
2009-07-17 18:22     ` James TD Smith
2009-07-18  9:35       ` Bastien
2009-08-27 15:50         ` Manish
2009-08-28 17:59           ` 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).