From cec8711a44a9a1ac6552546c05ec0623a2bf9e45 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Fri, 20 May 2011 13:30:45 -0700 Subject: [PATCH 01/12] Avoid race condition in ob-R code responsible for writing result to disk Slight modification of patch by Christophe Rhodes * lisp/ob-R.el (org-babel-R-write-object-command): Ensure that all data is written to the results file before Emacs notices that the file exists. --- lisp/ob-R.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/ob-R.el b/lisp/ob-R.el index 713d59f53..d0efcbbe6 100644 --- a/lisp/ob-R.el +++ b/lisp/ob-R.el @@ -227,7 +227,7 @@ current code buffer." (defvar org-babel-R-eoe-indicator "'org_babel_R_eoe'") (defvar org-babel-R-eoe-output "[1] \"org_babel_R_eoe\"") -(defvar org-babel-R-write-object-command "{function(object, transfer.file) {object;invisible(if(inherits(try(write.table(object, file=transfer.file, sep=\"\\t\", na=\"nil\",row.names=%s, col.names=%s, quote=FALSE), silent=TRUE),\"try-error\")) {if(!file.exists(transfer.file)) file.create(transfer.file)})}}(object=%s, transfer.file=\"%s\")") +(defvar org-babel-R-write-object-command "{function(object,transfer.file){object;invisible(if(inherits(try({tfile<-tempfile();write.table(object,file=tfile,sep=\"\\t\",na=\"nil\",row.names=%s,col.names=%s,quote=FALSE);file.rename(tfile,transfer.file)},silent=TRUE),\"try-error\")){if(!file.exists(transfer.file))file.create(transfer.file)})}}(object=%s,transfer.file=\"%s\")") (defun org-babel-R-evaluate (session body result-type column-names-p row-names-p) From cf0c163ea61fbfe9ac8e2937ae34bbdd1bbc770d Mon Sep 17 00:00:00 2001 From: Michael Brand Date: Fri, 20 May 2011 02:12:56 +0000 Subject: [PATCH 02/12] Small documentation fix TINYCHANGE --- doc/org.texi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/org.texi b/doc/org.texi index aa34cd341..163bc5e23 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -14376,12 +14376,12 @@ other block) with @code{org-narrow-to-block}. @vindex org-agenda-skip-function @vindex org-agenda-skip-function-global Org provides a special hook that can be used to narrow down the selection -made by these agenda views: @code{todo}, @code{alltodo}, @code{tags}, -@code{tags-todo}, @code{tags-tree}. You may specify a function that is used -at each match to verify if the match should indeed be part of the agenda -view, and if not, how much should be skipped. You can specify a global -condition that will be applied to all agenda views, this condition would be -stored in the variable @code{org-agenda-skip-function-global}. More +made by these agenda views: @code{agenda}, @code{todo}, @code{alltodo}, +@code{tags}, @code{tags-todo}, @code{tags-tree}. You may specify a function +that is used at each match to verify if the match should indeed be part of +the agenda view, and if not, how much should be skipped. You can specify a +global condition that will be applied to all agenda views, this condition +would be stored in the variable @code{org-agenda-skip-function-global}. More commonly, such a definition is applied only to specific custom searches, using @code{org-agenda-skip-function}. From b29a9def65cfb8b9da53d3814254fb8dee699d29 Mon Sep 17 00:00:00 2001 From: Michael Markert Date: Fri, 6 May 2011 13:43:28 +0000 Subject: [PATCH 03/12] Add docstring for `wl-get-from-header-content'. TINYCHANGE --- contrib/lisp/org-contacts.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index 3f4d97cf5..f0cf13162 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -404,6 +404,9 @@ This adds `org-contacts-gnus-check-mail-address' and (add-hook 'gnus-article-prepare-hook 'org-contacts-gnus-store-last-mail)) (defun wl-get-from-header-content () + "Retrieve the content of the `From' header of an email. +Works from wl-summary-mode and mime-view-mode - that is while viewing email. +Depends on Wanderlust been loaded." (save-excursion (set-buffer (org-capture-get :original-buffer)) (cond From 202d8f7bf2895c402daae4dc6a8cf33aeb05892e Mon Sep 17 00:00:00 2001 From: Eric S Fraga Date: Mon, 16 May 2011 16:21:49 +0000 Subject: [PATCH 04/12] Use format string for message TINYCHANGE --- lisp/ob-ledger.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/ob-ledger.el b/lisp/ob-ledger.el index e2709a71e..e678137cc 100644 --- a/lisp/ob-ledger.el +++ b/lisp/ob-ledger.el @@ -52,7 +52,7 @@ called by `org-babel-execute-src-block'." (in-file (org-babel-temp-file "ledger-")) (out-file (org-babel-temp-file "ledger-output-"))) (with-temp-file in-file (insert body)) - (message (concat "ledger" + (message "%s" (concat "ledger" " -f " (org-babel-process-file-name in-file) " " cmdline)) (with-output-to-string From 3e4477249caeb4ec58dc10b5feac849d5d173b09 Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Thu, 19 May 2011 17:30:24 +0000 Subject: [PATCH 05/12] Add "References" header in org-exp-bibtex * contrib/lisp/org-exp-bibtex.el (org-export-bibtex-preprocess): include hard-coded "

References

" in #+BEGIN_HTML block I might be missing something, but while in LaTeX export org-exp-bibtex produces a References header, in HTML export there's nothing -- which looks a bit odd, particularly in documents with footnotes. Attached is a patch which simply includes an appropriate header. Cheers, Christophe TINYCHANGE --- contrib/lisp/org-exp-bibtex.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/lisp/org-exp-bibtex.el b/contrib/lisp/org-exp-bibtex.el index 63f71ef5d..d48f0ee7b 100644 --- a/contrib/lisp/org-exp-bibtex.el +++ b/contrib/lisp/org-exp-bibtex.el @@ -107,7 +107,7 @@ (goto-char (point-min)) (while (re-search-forward "
" nil t) (replace-match "
" t t)) - (concat "\n#+BEGIN_HTML\n
\n" (buffer-string) "\n
\n#+END_HTML\n")))) + (concat "\n#+BEGIN_HTML\n
\n

References

\n" (buffer-string) "\n
\n#+END_HTML\n")))) ((eq org-export-current-backend 'latex) ;; Latex export (concat "\n#+LATEX: \\bibliographystyle{" style "}" "\n#+LATEX: \\bibliography{" file "}\n"))) t t))) From b91cbd95e79909e5f0eee92f3e54f814573ab35a Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Tue, 24 May 2011 12:49:52 +0200 Subject: [PATCH 06/12] Fix wanderlust interface for org-contact.el Patches by Michael Markert. --- contrib/lisp/org-contacts.el | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index f0cf13162..6bb7abfd9 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -403,7 +403,7 @@ This adds `org-contacts-gnus-check-mail-address' and (add-hook 'gnus-article-prepare-hook 'org-contacts-gnus-check-mail-address) (add-hook 'gnus-article-prepare-hook 'org-contacts-gnus-store-last-mail)) -(defun wl-get-from-header-content () +(defun org-contacts-wl-get-from-header-content () "Retrieve the content of the `From' header of an email. Works from wl-summary-mode and mime-view-mode - that is while viewing email. Depends on Wanderlust been loaded." @@ -420,17 +420,27 @@ Depends on Wanderlust been loaded." (std11-fetch-field "From") (widen)))))) +(defun org-contacts-wl-get-name-email () + "Get name and email address from wanderlust email. +See `org-contacts-wl-get-from-header-content' for limitations." + (let ((from (org-contacts-wl-get-from-header-content))) + (when from + (list (wl-address-header-extract-realname from) + (wl-address-header-extract-address from))))) + (defun org-contacts-template-wl-name (&optional return-value) - (let ((from (wl-get-from-header-content))) - (or (and from (wl-address-header-extract-realname from)) - return-value - "%^{Name}"))) + "Try to return the contact name for a template from wl. +If not found return RETURN-VALUE or something that would ask the user." + (or (car (org-contacts-wl-get-name-email)) + return-value + "%^{Name}")) (defun org-contacts-template-wl-email (&optional return-value) - (let ((from (wl-get-from-header-content))) - (or (and from (wl-address-header-extract-address from)) - return-value - (concat "%^{" org-contacts-email-property "}p")))) + "Try to return the contact email for a template from wl. +If not found return RETURN-VALUE or something that would ask the user." + (or (cadr (org-contacts-wl-get-name-email)) + return-value + (concat "%^{" org-contacts-email-property "}p"))) (defun org-contacts-view-send-email (&optional ask) "Send email to the contact at point. From 438536f6157794101ce0957e39cad6bf70580751 Mon Sep 17 00:00:00 2001 From: Nick Dokos Date: Thu, 19 May 2011 00:58:40 +0000 Subject: [PATCH 07/12] Change underscores to hyphens in section labels * lisp/org-exp.el (org-export-define-heading-targets): Use dash instead of underscore to make labels valid. Currently, the section number (a string of the form "X.Y.Z") is used to manufacture a section label of the form sec-X_Y_Z. Underscores are overloaded however, both in org and in LaTeX, and cause conflicts with some packages. This patch changes underscores to hyphens in section labels. TINYCHANGE --- lisp/org-exp.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org-exp.el b/lisp/org-exp.el index e840b6c8a..e188d49a8 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -1298,7 +1298,7 @@ Also find all ID and CUSTOM_ID properties and store them." (org-outline-level)))) (setq target (org-solidify-link-text (format "sec-%s" (replace-regexp-in-string - "\\." "_" + "\\." "-" (org-section-number level))))) (setq last-section-target target) (push (cons target target) target-alist) From af7aefe94599ff3b27910f9861b6f423004813e7 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Tue, 24 May 2011 13:39:56 +0200 Subject: [PATCH 08/12] * lisp/org-capture.el (org-capture): Ignore errors when creating a link. Patch by Tassilo Horn. --- lisp/org-capture.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org-capture.el b/lisp/org-capture.el index 0af452950..ccfca75ce 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -415,7 +415,7 @@ bypassed." (annotation (if (and (boundp 'org-capture-link-is-already-stored) org-capture-link-is-already-stored) (plist-get org-store-link-plist :annotation) - (org-store-link nil))) + (ignore-errors (org-store-link nil)))) (initial (and (org-region-active-p) (buffer-substring (point) (mark)))) (entry (org-capture-select-template keys))) From 4f27391197e7d15ea7d1176c6246c1d0fe25bffe Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Tue, 24 May 2011 14:02:43 +0200 Subject: [PATCH 09/12] Turn of LaTeX preprocessing for table.el tables * lisp/org-latex.el (org-export-latex-special-chars): Do nothing in table.el tables. Table.el does its own protection of special characters. --- lisp/org-latex.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/org-latex.el b/lisp/org-latex.el index 516ee1261..764a48d79 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -1627,7 +1627,8 @@ See the `org-export-latex.el' code for a complete conversion table." (goto-char (point-min)) (while (re-search-forward c nil t) ;; Put the point where to check for org-protected - (unless (get-text-property (match-beginning 2) 'org-protected) + (unless (or (get-text-property (match-beginning 2) 'org-protected) + (org-at-table.el-p)) (cond ((member (match-string 2) '("\\$" "$")) (if (equal (match-string 2) "\\$") nil From fa12fe82e9fb16a93dc2be6b8026aa43cc4a0f95 Mon Sep 17 00:00:00 2001 From: Jambunathan K Date: Mon, 25 Apr 2011 03:42:23 +0000 Subject: [PATCH 10/12] org-html.el: Fix export of table.el tables. * lisp/org-html.el (org-export-as-html): Don't expand non-data lines of table.el tables. (org-html-expand): Removed the (buggy) test for non-data lines in table.el tables. The test is now done as part of org-export-as-html. (org-format-table-table-html-using-table-generate-source): Added test for spanning of cells in table.el tables using table.el's own library routine. Optionlly Suppress export of simple table.el tables. (org-format-table-html): Removed the (buggy) test for spanned table.el tables. The test is now done as part of org-format-table-table-html-using-table-generate-source. --- lisp/org-html.el | 72 +++++++++++++++++++++++++----------------------- 1 file changed, 37 insertions(+), 35 deletions(-) diff --git a/lisp/org-html.el b/lisp/org-html.el index 7a4564d85..29bb8252c 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -1543,6 +1543,7 @@ lang=\"%s\" xml:lang=\"%s\"> ;; handle @<..> HTML tags (replace "@>..<" by "<..>") ;; Also handle sub_superscripts and checkboxes (or (string-match org-table-hline-regexp line) + (string-match "^[ \t]*\\([+]-\\||[ ]\\)[-+ |]*[+|][ \t]*$" line) (setq line (org-html-expand line))) ;; Format the links @@ -1888,24 +1889,13 @@ NO-CSS is passed to the exporter." (if (string-match "^[ \t]*|" (car lines)) ;; A normal org table (org-format-org-table-html lines nil no-css) - ;; Table made by table.el - test for spanning - (let* ((hlines (delq nil (mapcar - (lambda (x) - (if (string-match "^[ \t]*\\+-" x) x - nil)) - lines))) - (first (car hlines)) - (ll (and (string-match "\\S-+" first) - (match-string 0 first))) - (re (concat "^[ \t]*" (regexp-quote ll))) - (spanning (delq nil (mapcar (lambda (x) (not (string-match re x))) - hlines)))) - (if (and (not spanning) - (not org-export-prefer-native-exporter-for-tables)) - ;; We can use my own converter with HTML conversions - (org-format-table-table-html lines) - ;; Need to use the code generator in table.el, with the original text. - (org-format-table-table-html-using-table-generate-source olines))))) + ;; Table made by table.el + (or (org-format-table-table-html-using-table-generate-source + olines (not org-export-prefer-native-exporter-for-tables)) + ;; We are here only when table.el table has NO col or row + ;; spanning and the user prefers using org's own converter for + ;; exporting of such simple table.el tables. + (org-format-table-table-html lines)))) (defvar org-table-number-fraction) ; defined in org-table.el (defun org-format-org-table-html (lines &optional splice no-css) @@ -2116,10 +2106,20 @@ But it has the disadvantage, that no cell- or row-spanning is allowed." (setq html (concat html "\n")) html)) -(defun org-format-table-table-html-using-table-generate-source (lines) +(defun org-format-table-table-html-using-table-generate-source (lines + &optional + spanned-only) "Format a table into html, using `table-generate-source' from table.el. -This has the advantage that cell- or row-spanning is allowed. -But it has the disadvantage, that Org-mode's HTML conversions cannot be used." +Use SPANNED-ONLY to suppress exporting of simple table.el tables. + +When SPANNED-ONLY is nil, all table.el tables are exported. When +SPANNED-ONLY is non-nil, only tables with either row or column +spans are exported. + +This routine returns the generated source or nil as appropriate. + +Refer docstring of `org-export-prefer-native-exporter-for-tables' +for further information." (require 'table) (with-current-buffer (get-buffer-create " org-tmp1 ") (erase-buffer) @@ -2128,10 +2128,14 @@ But it has the disadvantage, that Org-mode's HTML conversions cannot be used." (if (not (re-search-forward "|[^+]" nil t)) (error "Error processing table")) (table-recognize-table) - (with-current-buffer (get-buffer-create " org-tmp2 ") (erase-buffer)) - (table-generate-source 'html " org-tmp2 ") - (set-buffer " org-tmp2 ") - (buffer-substring (point-min) (point-max)))) + (when (or (not spanned-only) + (let* ((dim (table-query-dimension)) + (c (nth 4 dim)) (r (nth 5 dim)) (cells (nth 6 dim))) + (not (= (* c r) cells)))) + (with-current-buffer (get-buffer-create " org-tmp2 ") (erase-buffer)) + (table-generate-source 'html " org-tmp2 ") + (set-buffer " org-tmp2 ") + (buffer-substring (point-min) (point-max))))) (defun org-export-splice-style (style extra) "Splice EXTRA into STYLE, just before \"\"." @@ -2234,16 +2238,14 @@ If there are links in the string, don't modify these." (let* ((re (concat org-bracket-link-regexp "\\|" (org-re "[ \t]+\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$"))) m s l res) - (if (string-match "^[ \t]*\\+-[-+]*\\+[ \t]*$" string) - string - (while (setq m (string-match re string)) - (setq s (substring string 0 m) - l (match-string 0 string) - string (substring string (match-end 0))) - (push (org-html-do-expand s) res) - (push l res)) - (push (org-html-do-expand string) res) - (apply 'concat (nreverse res))))) + (while (setq m (string-match re string)) + (setq s (substring string 0 m) + l (match-string 0 string) + string (substring string (match-end 0))) + (push (org-html-do-expand s) res) + (push l res)) + (push (org-html-do-expand string) res) + (apply 'concat (nreverse res)))) (defun org-html-do-expand (s) "Apply all active conversions to translate special ASCII to HTML." From 7c4360823a132107d4af04aca673dcd6c3cfd453 Mon Sep 17 00:00:00 2001 From: Marcel van der Boom Date: Mon, 28 Mar 2011 22:21:49 +0000 Subject: [PATCH 11/12] Allow inactive timestamps in org-expiry * contrib/lisp/org-expiry.el (org-expiry-inactive-timestamps): New option. (org-expiry-insert-created): (org-expiry-insert-expiry): Honor `org-expiry-inactive-timestamps'. Attached is a patch to org-expiry.el in contrib/lisp to allow a customization of the timestamps inserted by org-expiry for 'CREATED' and 'EXPIRED' properties. This patch is what is attached to the message displayed at [1]. I have been using this patch for a while and it works fine. From searching it looks like this patch was 'forgotten', but I may have overlooked something. If the patch was rejected, you can ignore me. If it was forgotten I'd like to request to include it. Thx, marcel --- contrib/lisp/org-expiry.el | 40 +++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/contrib/lisp/org-expiry.el b/contrib/lisp/org-expiry.el index 4a4939941..930b92128 100644 --- a/contrib/lisp/org-expiry.el +++ b/contrib/lisp/org-expiry.el @@ -81,6 +81,11 @@ :tag "Org Expiry" :group 'org) +(defcustom org-expiry-inactive-timestamps nil + "Insert inactive timestamps for the created and expired time properties" + :type 'boolean + :group 'org-expiry) + (defcustom org-expiry-created-property-name "CREATED" "The name of the property for setting the creation date." :type 'string @@ -283,21 +288,25 @@ to today's date. With two `C-u' prefixes, prompt the user for to update the date." (interactive "P") (let* ((d (org-entry-get (point) org-expiry-created-property-name)) - d-time d-hour) + d-time d-hour timestr) (when (or (null d) arg) ;; update if no date or non-nil prefix argument ;; FIXME Use `org-time-string-to-time' - (setq d-time (if d (apply 'encode-time (org-parse-time-string d)) + (setq d-time (if d (org-time-string-to-time d) (current-time))) (setq d-hour (format-time-string "%H:%M" d-time)) + (setq timestr + ;; two C-u prefixes will call org-read-date + (if (equal arg '(16)) + (concat "<" (org-read-date + nil nil nil nil d-time d-hour) ">") + (format-time-string (cdr org-time-stamp-formats)))) + ;; maybe transform to inactive timestamp + (if org-expiry-inactive-timestamps + (setq timestr (concat "[" (substring timestr 1 -1) "]"))) (save-excursion (org-entry-put - (point) org-expiry-created-property-name - ;; two C-u prefixes will call org-read-date - (if (equal arg '(16)) - (concat "<" (org-read-date - nil nil nil nil d-time d-hour) ">") - (format-time-string (cdr org-time-stamp-formats)))))))) + (point) org-expiry-created-property-name timestr))))) (defun org-expiry-insert-expiry (&optional today) "Insert a property with the expiry date. @@ -306,15 +315,20 @@ and insert today's date." (interactive "P") (let* ((d (org-entry-get (point) org-expiry-expiry-property-name)) d-time d-hour) - (setq d-time (if d (apply 'encode-time (org-parse-time-string d)) + (setq d-time (if d (org-time-string-to-time d) (current-time))) (setq d-hour (format-time-string "%H:%M" d-time)) + (setq timestr (if today + (format-time-string (cdr org-time-stamp-formats)) + (concat "<" (org-read-date + nil nil nil nil d-time d-hour) ">"))) + ;; maybe transform to inactive timestamp + (if org-expiry-inactive-timestamps + (setq timestr (concat "[" (substring timestr 1 -1) "]"))) + (save-excursion (org-entry-put - (point) org-expiry-expiry-property-name - (if today (format-time-string (cdr org-time-stamp-formats)) - (concat "<" (org-read-date - nil nil nil nil d-time d-hour) ">")))))) + (point) org-expiry-expiry-property-name timestr)))) ;;; Functions to process expired entries: From b6384bbcbe49c662c6aee56c30b20ebf23a9e65c Mon Sep 17 00:00:00 2001 From: David Maus Date: Tue, 24 May 2011 20:55:35 +0200 Subject: [PATCH 12/12] Prevent adding of extra space to value if property already exists * org.el (org-entry-put): Prevent adding of extra space to value if property already exists. Fixes a regression reported by Wujun Zhou. --- lisp/org.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 9f8fa9225..cdf48c16b 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -13900,13 +13900,13 @@ and the new value.") (if (re-search-forward (org-re-property property) (cdr range) t) (progn - (delete-region (match-beginning 1) (match-end 1)) - (goto-char (match-beginning 1))) + (delete-region (match-beginning 0) (match-end 0)) + (goto-char (match-beginning 0))) (goto-char (cdr range)) (insert "\n") (backward-char 1) - (org-indent-line-function) - (insert ":" property ":")) + (org-indent-line-function)) + (insert ":" property ":") (and value (insert " " value)) (org-indent-line-function))))) (run-hook-with-args 'org-property-changed-functions property value)))