From fab27888640a2d6af71fc3e42ffc0b195eb7c4d8 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Wed, 23 Mar 2011 10:14:03 +0100 Subject: [PATCH 01/14] org-protocol.el: minor documentation and formatting clean up. --- lisp/org-protocol.el | 60 ++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 33 deletions(-) diff --git a/lisp/org-protocol.el b/lisp/org-protocol.el index cf7bf270a..61fe837f1 100644 --- a/lisp/org-protocol.el +++ b/lisp/org-protocol.el @@ -164,7 +164,6 @@ for `org-protocol-the-protocol' and sub-procols defined in "Default protocols to use. See `org-protocol-protocol-alist' for a description of this variable.") - (defconst org-protocol-the-protocol "org-protocol" "This is the protocol to detect if org-protocol.el is loaded. `org-protocol-protocol-alist-default' and `org-protocol-protocol-alist' hold @@ -172,11 +171,10 @@ the sub-protocols that trigger the required action. You will have to define just one protocol handler OS-wide (MS-Windows) or per application (Linux). That protocol handler should call emacsclient.") - ;;; User variables: (defcustom org-protocol-reverse-list-of-files t - "* Non-nil means re-reverse the list of filenames passed on the command line. + "Non-nil means re-reverse the list of filenames passed on the command line. The filenames passed on the command line are passed to the emacs-server in reverse order. Set to t (default) to re-reverse the list, i.e. use the sequence on the command line. If nil, the sequence of the filenames is @@ -184,9 +182,8 @@ unchanged." :group 'org-protocol :type 'boolean) - (defcustom org-protocol-project-alist nil - "* Map URLs to local filenames for `org-protocol-open-source' (open-source). + "Map URLs to local filenames for `org-protocol-open-source' (open-source). Each element of this list must be of the form: @@ -229,7 +226,6 @@ Consider using the interactive functions `org-protocol-create' and :group 'org-protocol :type 'alist) - (defcustom org-protocol-protocol-alist nil "* Register custom handlers for org-protocol. @@ -287,14 +283,13 @@ Slashes are sanitized to double slashes here." (setq uri (concat (car splitparts) "//" (mapconcat 'identity (cdr splitparts) "/"))))) uri) - -(defun org-protocol-split-data(data &optional unhexify separator) - "Split, what an org-protocol handler function gets as only argument. -DATA is that one argument. DATA is split at each occurrence of -SEPARATOR (regexp). If no SEPARATOR is specified or SEPARATOR is +(defun org-protocol-split-data (data &optional unhexify separator) + "Split what an org-protocol handler function gets as only argument. +DATA is that one argument. DATA is split at each occurrence of +SEPARATOR (regexp). If no SEPARATOR is specified or SEPARATOR is nil, assume \"/+\". The results of that splitting are returned -as a list. If UNHEXIFY is non-nil, hex-decode each split part. If -UNHEXIFY is a function, use that function to decode each split +as a list. If UNHEXIFY is non-nil, hex-decode each split part. +If UNHEXIFY is a function, use that function to decode each split part." (let* ((sep (or separator "/+")) (split-parts (split-string data sep))) @@ -348,7 +343,6 @@ returned list." ret) l))) - (defun org-protocol-flatten (l) "Greedy handlers might receive a list like this from emacsclient: '( (\"/dir/org-protocol:/greedy:/~/path1\" (23 . 12)) (\"/dir/param\") @@ -359,6 +353,7 @@ This function transforms it into a flat list." (append (org-protocol-flatten (car l)) (org-protocol-flatten (cdr l))) (list l)))) + ;;; Standard protocol handlers: (defun org-protocol-store-link (fname) @@ -390,7 +385,7 @@ The sub-protocol used to reach this function is set in uri)) nil) -(defun org-protocol-remember (info) +(defun org-protocol-remember (info) "Process an org-protocol://remember:// style url. The location for a browser's bookmark has to look like this: @@ -408,7 +403,7 @@ See the docs for `org-protocol-capture' for more information." (message "Org-mode not loaded.")) nil) -(defun org-protocol-capture (info) +(defun org-protocol-capture (info) "Process an org-protocol://capture:// style url. The sub-protocol used to reach this function is set in @@ -444,7 +439,7 @@ CAPTURE-FUNC is either the symbol `org-remember' or `org-capture'." (url (org-protocol-sanitize-uri (car parts))) (type (if (string-match "^\\([a-z]+\\):" url) (match-string 1 url))) - (title(or (cadr parts) "")) + (title (or (cadr parts) "")) (region (or (caddr parts) "")) (orglink (org-make-link-string url (if (string-match "[^[:space:]]" title) title url))) @@ -461,7 +456,6 @@ CAPTURE-FUNC is either the symbol `org-remember' or `org-capture'." (raise-frame) (funcall capture-func nil template))) - (defun org-protocol-open-source (fname) "Process an org-protocol://open-source:// style url. @@ -472,7 +466,6 @@ The location for a browser's bookmark should look like this: javascript:location.href='org-protocol://open-source://'+ \\ encodeURIComponent(location.href)" - ;; As we enter this function for a match on our protocol, the return value ;; defaults to nil. (let ((result nil) @@ -541,12 +534,14 @@ function returns nil, the filename is removed from the list of filenames passed from emacsclient to the server. If the function returns a non nil value, that value is passed to the server as filename." - (let ((sub-protocols (append org-protocol-protocol-alist org-protocol-protocol-alist-default))) + (let ((sub-protocols (append org-protocol-protocol-alist + org-protocol-protocol-alist-default))) (catch 'fname (let ((the-protocol (concat (regexp-quote org-protocol-the-protocol) ":/+"))) (when (string-match the-protocol fname) (dolist (prolist sub-protocols) - (let ((proto (concat the-protocol (regexp-quote (plist-get (cdr prolist) :protocol)) ":/+"))) + (let ((proto (concat the-protocol + (regexp-quote (plist-get (cdr prolist) :protocol)) ":/+"))) (when (string-match proto fname) (let* ((func (plist-get (cdr prolist) :function)) (greedy (plist-get (cdr prolist) :greedy)) @@ -563,7 +558,6 @@ as filename." ;; (message "fname: %s" fname) fname))) - (defadvice server-visit-files (before org-protocol-detect-protocol-server activate) "Advice server-visit-flist to call `org-protocol-modify-filename-for-protocol'." (let ((flist (if org-protocol-reverse-list-of-files @@ -572,16 +566,17 @@ as filename." (client (ad-get-arg 1))) (catch 'greedy (dolist (var flist) - (let ((fname (expand-file-name (car var)))) ;; `\' to `/' on windows. FIXME: could this be done any better? - (setq fname (org-protocol-check-filename-for-protocol fname (member var flist) client)) + ;; `\' to `/' on windows. FIXME: could this be done any better? + (let ((fname (expand-file-name (car var)))) + (setq fname (org-protocol-check-filename-for-protocol + fname (member var flist) client)) (if (eq fname t) ;; greedy? We need the `t' return value. (progn (ad-set-arg 0 nil) (throw 'greedy t)) (if (stringp fname) ;; probably filename (setcar var fname) - (ad-set-arg 0 (delq var (ad-get-arg 0)))))) - )))) + (ad-set-arg 0 (delq var (ad-get-arg 0)))))))))) ;;; Org specific functions: @@ -597,8 +592,7 @@ most of the work." (message "Not in an org-project. Did mean %s?" (substitute-command-keys"\\[org-protocol-create]"))))) - -(defun org-protocol-create(&optional project-plist) +(defun org-protocol-create (&optional project-plist) "Create a new org-protocol project interactively. An org-protocol project is an entry in `org-protocol-project-alist' which is used by `org-protocol-open-source'. @@ -606,15 +600,15 @@ Optionally use project-plist to initialize the defaults for this project. If project-plist is the CDR of an element in `org-publish-project-alist', reuse :base-directory, :html-extension and :base-extension." (interactive) - (let ((working-dir (expand-file-name(or (plist-get project-plist :base-directory) default-directory))) + (let ((working-dir (expand-file-name + (or (plist-get project-plist :base-directory) + default-directory))) (base-url "http://orgmode.org/worg/") (strip-suffix (or (plist-get project-plist :html-extension) ".html")) (working-suffix (if (plist-get project-plist :base-extension) (concat "." (plist-get project-plist :base-extension)) ".org")) - (worglet-buffer nil) - (insert-default-directory t) (minibuffer-allow-text-properties nil)) @@ -630,12 +624,12 @@ project-plist is the CDR of an element in `org-publish-project-alist', reuse (setq strip-suffix (read-string - (concat "Extension to strip from published URLs ("strip-suffix"): ") + (concat "Extension to strip from published URLs (" strip-suffix "): ") strip-suffix nil strip-suffix t)) (setq working-suffix (read-string - (concat "Extension of editable files ("working-suffix"): ") + (concat "Extension of editable files (" working-suffix "): ") working-suffix nil working-suffix t)) (when (yes-or-no-p "Save the new org-protocol-project to your init file? ") From ac6e4c28b8081fd16e3de7b459d1a8e21f2c4ea7 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Wed, 23 Mar 2011 10:25:38 +0100 Subject: [PATCH 02/14] Allow org-protocol templates to be set to two characters. * org-protocol.el (org-protocol-do-capture): allow template keys of two characters. (org-protocol-default-template-key): Update the docstring to reflect the change in `org-protocol-do-capture'. --- lisp/org-protocol.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lisp/org-protocol.el b/lisp/org-protocol.el index 61fe837f1..0bbef035f 100644 --- a/lisp/org-protocol.el +++ b/lisp/org-protocol.el @@ -269,7 +269,9 @@ Here is an example: :type '(alist)) (defcustom org-protocol-default-template-key nil - "The default org-remember-templates key to use." + "The default template key to use. +This is usually a single character string but can also be a +string with two characters." :group 'org-protocol :type 'string) @@ -301,9 +303,9 @@ part." (defun org-protocol-flatten-greedy (param-list &optional strip-path replacement) "Greedy handlers might receive a list like this from emacsclient: - '( (\"/dir/org-protocol:/greedy:/~/path1\" (23 . 12)) (\"/dir/param\") + '((\"/dir/org-protocol:/greedy:/~/path1\" (23 . 12)) (\"/dir/param\") where \"/dir/\" is the absolute path to emacsclients working directory. This -function transforms it into a flat list utilizing `org-protocol-flatten' and +function transforms it into a flat list using `org-protocol-flatten' and transforms the elements of that list as follows: If strip-path is non-nil, remove the \"/dir/\" prefix from all members of @@ -434,7 +436,7 @@ Now template ?b will be used." "Support `org-capture' and `org-remember' alike. CAPTURE-FUNC is either the symbol `org-remember' or `org-capture'." (let* ((parts (org-protocol-split-data info t)) - (template (or (and (= 1 (length (car parts))) (pop parts)) + (template (or (and (>= 2 (length (car parts))) (pop parts)) org-protocol-default-template-key)) (url (org-protocol-sanitize-uri (car parts))) (type (if (string-match "^\\([a-z]+\\):" url) From 087d94b4882f8118a6e48436b0abc0ba4e79900f Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Tue, 22 Mar 2011 19:26:14 +0000 Subject: [PATCH 03/14] Allow mixed export of numbered and unnumbered sections in LaTeX * lisp/org-latex.el (org-export-latex-subcontent): Deal specially with the case that NUM is an integer. We would sometimes like to have numbered \sections in LaTeX export but unnumbered \subsections and so forth. That is, use the starred equivalents for all sectioning commands below a certain level. Previously, the num: option specification could only specify whether sections should be numbered or unnumbered at all levels. We now treat an integer value specially, if num:N is supplied then the highest N levels are numbered, and lower levels are exported without numbering. --- lisp/org-latex.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/org-latex.el b/lisp/org-latex.el index fbdeb5ee7..7a3c629cd 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -1151,7 +1151,9 @@ and its content." (defun org-export-latex-subcontent (subcontent num) "Export each cell of SUBCONTENT to LaTeX. -If NUM, export sections as numerical sections." +If NUM is non-nil export numbered sections, otherwise use unnumbered +sections. If NUM is an integer, export the highest NUM levels as +numbered sections and lower levels as unnumbered sections." (let* ((heading (cdr (assoc 'heading subcontent))) (level (- (cdr (assoc 'level subcontent)) org-export-latex-add-level)) @@ -1187,6 +1189,9 @@ If NUM, export sections as numerical sections." ;; Normal conversion ((<= level depth) (let* ((sec (nth (1- level) sectioning)) + (num (if (integerp num) + (>= num level) + num)) start end) (if (consp (cdr sec)) (setq start (nth (if num 0 2) sec) From 9f57b8e85d185fbf3f9788fd4099709d512dedd1 Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Wed, 23 Mar 2011 14:38:18 +0000 Subject: [PATCH 04/14] Allow mixed export of numbered and unnumbered sections in HTML * lisp/org-html.el (org-export-as-html): Get local value of org-export-with-section-numbers from the buffer's plist. Deal specially with the case the resulting value is an integer. (org-html-level-start): New optional argument of the option plist used instead of `org-export-with-section-numbers'. Also deal specially with the case that the value is an integer. When `org-export-with-section-numbers' (or the buffer-local :section-numbers option) is an integer, we now export the first NUM levels of headings with numbers and lower-level headings without. --- lisp/org-html.el | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/lisp/org-html.el b/lisp/org-html.el index b13fb93a9..06305f642 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -1150,6 +1150,7 @@ PUB-DIR is set, use this as the publishing directory." (language (plist-get opt-plist :language)) (keywords (plist-get opt-plist :keywords)) (description (plist-get opt-plist :description)) + (num (plist-get opt-plist :section-numbers)) (lang-words nil) (head-count 0) cnt (start 0) @@ -1355,7 +1356,7 @@ lang=\"%s\" xml:lang=\"%s\"> (if (string-match quote-re0 txt) (setq txt (replace-match "" t t txt))) (setq snumber (org-section-number level)) - (if org-export-with-section-numbers + (if (and num (integerp num) (>= num level)) (setq txt (concat snumber " " txt))) (if (<= level (max umax umax-toc)) (setq head-count (+ head-count 1))) @@ -1591,7 +1592,7 @@ lang=\"%s\" xml:lang=\"%s\"> (setq first-heading-pos (or first-heading-pos (point))) (org-html-level-start level txt umax (and org-export-with-toc (<= level umax)) - head-count) + head-count opt-plist) ;; QUOTES (when (string-match quote-re line) @@ -1684,7 +1685,7 @@ lang=\"%s\" xml:lang=\"%s\"> (org-html-level-start 1 nil umax (and org-export-with-toc (<= level umax)) - head-count) + head-count opt-plist) ;; the to close the last text-... div. (when (and (> umax 0) first-heading-pos) (insert "\n")) @@ -2330,7 +2331,7 @@ If there are links in the string, don't modify these." (insert (if (equal type "d") "\n" "\n"))) (defvar body-only) ; dynamically scoped into this. -(defun org-html-level-start (level title umax with-toc head-count) +(defun org-html-level-start (level title umax with-toc head-count &optional opt-plist) "Insert a new level in HTML export. When TITLE is nil, just close all open levels." (org-close-par-maybe) @@ -2341,6 +2342,7 @@ When TITLE is nil, just close all open levels." (preferred (and target (cdr (assoc target org-export-preferred-target-alist)))) (l org-level-max) + (num (plist-get opt-plist :section-numbers)) snumber snu href suffix) (setq extra-targets (remove (or preferred target) extra-targets)) (setq extra-targets @@ -2395,10 +2397,20 @@ When TITLE is nil, just close all open levels." (setq snumber (org-section-number level) snu (replace-regexp-in-string "\\." "_" snumber)) (setq level (+ level org-export-html-toplevel-hlevel -1)) - (if (and org-export-with-section-numbers (not body-only)) + (if (and num (not body-only)) (setq title (concat (format "%s" - level snumber) + level + (if (and (integerp num) + ;; fix up num to take into + ;; account the top-level + ;; heading value + (>= (+ num + org-export-html-toplevel-hlevel + -1) + level)) + snumber + "")) " " title))) (unless (= head-count 1) (insert "\n\n")) (setq href (cdr (assoc (concat "sec-" snu) org-export-preferred-target-alist))) From c10933415212abad1b8adcb87c93b4b254cd86d0 Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Wed, 23 Mar 2011 15:28:04 +0000 Subject: [PATCH 05/14] Protect starred commands in LaTeX export correctly * lisp/org-latex.el (org-export-latex-preprocess): Correctly match starred command names. Many LaTeX commands exist in both normal and starred forms. Adjust the regexp in `org-export-latex-preprocess' to match the starred form as well. --- lisp/org-latex.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org-latex.el b/lisp/org-latex.el index 7a3c629cd..9be842b51 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -2345,7 +2345,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." ;; Protect LaTeX commands like \command[...]{...} or \command{...} (goto-char (point-min)) (let ((re (concat - "\\\\\\([a-zA-Z]+\\)" + "\\\\\\([a-zA-Z]+\\*?\\)" "\\(?:<[^<>\n]*>\\)*" "\\(?:\\[[^][\n]*?\\]\\)*" "\\(?:<[^<>\n]*>\\)*" From a201b11286d74407614b62b61a5e04446d5d6eea Mon Sep 17 00:00:00 2001 From: Puneeth Chaganti Date: Fri, 18 Mar 2011 16:52:05 +0000 Subject: [PATCH 06/14] Fix HTML export of footnotes with lists, tables, quotes, etc. * org-html.el (org-export-as-html): Fix export of footnotes containing lists, tables, quotes, etc. --- lisp/org-html.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lisp/org-html.el b/lisp/org-html.el index 06305f642..7fd207928 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -1691,9 +1691,12 @@ lang=\"%s\" xml:lang=\"%s\"> (save-excursion (goto-char (point-min)) - (while (re-search-forward "

[^\000]*?\\(

\\|\\'\\)" nil t) - (push (match-string 0) footnotes) - (replace-match "" t t))) + (while (re-search-forward + "\\(\\(

\\)[^\000]*?\\)\\(\\(\\2\\)\\|\\'\\)" + nil t) + (push (match-string 1) footnotes) + (replace-match "\\4" t nil) + (goto-char (match-beginning 0)))) (when footnotes (insert (format org-export-html-footnotes-section (nth 4 lang-words) From c4dbff58bee7966a3ff8748a05ac0528e017f908 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Wed, 23 Mar 2011 15:08:49 +0100 Subject: [PATCH 07/14] Whitespaces clean up. --- lisp/org-html.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/org-html.el b/lisp/org-html.el index 7fd207928..62fce1b6b 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -1691,8 +1691,8 @@ lang=\"%s\" xml:lang=\"%s\"> (save-excursion (goto-char (point-min)) - (while (re-search-forward - "\\(\\(

\\)[^\000]*?\\)\\(\\(\\2\\)\\|\\'\\)" + (while (re-search-forward + "\\(\\(

\\)[^\000]*?\\)\\(\\(\\2\\)\\|\\'\\)" nil t) (push (match-string 1) footnotes) (replace-match "\\4" t nil) From 8d0c034047c618042b4dd61d7df2c572f38b9b0b Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Thu, 17 Mar 2011 15:52:23 +0000 Subject: [PATCH 08/14] `org-clock-report': use :scope sutree when inserting from within a subtree. * org-clock.el (org-clock-report): change the scope of the inserted clock report depending on whether the point is within a subtree (:scope subtree) or not (:scope file). --- lisp/org-clock.el | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index c567a263c..87b175cde 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -1652,7 +1652,10 @@ fontified, and then returned." (defun org-clock-report (&optional arg) "Create a table containing a report about clocked time. If the cursor is inside an existing clocktable block, then the table -will be updated. If not, a new clocktable will be inserted. +will be updated. If not, a new clocktable will be inserted. The scope +of the new clock will be subtree when called from within a subtree, and +file elsewhere. + When called with a prefix argument, move to the first clock table in the buffer and update it." (interactive "P") @@ -1662,8 +1665,12 @@ buffer and update it." (org-show-entry)) (if (org-in-clocktable-p) (goto-char (org-in-clocktable-p)) - (org-create-dblock (append (list :name "clocktable") - org-clock-clocktable-default-properties))) + (let ((props (if (ignore-errors + (save-excursion (org-back-to-heading))) + (list :name "clocktable" :scope 'subtree) + (list :name "clocktable")))) + (org-create-dblock + (org-combine-plists org-clock-clocktable-default-properties props)))) (org-update-dblock)) (defun org-in-clocktable-p () From 06ca884162b5d6cc4c2e3623b3583758707a320b Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Wed, 23 Mar 2011 14:47:33 +0100 Subject: [PATCH 09/14] org-list: fix bug with org-toggle-checkbox * lisp/org-list.el (org-list-checkbox): when called from an headline, function would normally skip drawers, but not if a SCHEDULED or DEADLINE keyword is standing before the drawer. Also avoid problems if function is called in buffers not is Org mode. --- lisp/org-list.el | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lisp/org-list.el b/lisp/org-list.el index 535633064..4cc2d5332 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -2073,6 +2073,10 @@ in subtree, ignoring drawers." block-item lim-up lim-down + (drawer-re (concat "^[ \t]*:\\(" + (mapconcat 'regexp-quote org-drawers "\\|") + "\\):[ \t]*$")) + (keyword-re (concat "^[ \t]*" org-keyword-time-regexp)) (orderedp (org-entry-get nil "ORDERED")) (bounds ;; In a region, start at first item in region @@ -2085,11 +2089,14 @@ in subtree, ignoring drawers." (error "No item in region")) (setq lim-down (copy-marker limit)))) ((org-on-heading-p) - ;; On an heading, start at first item after drawers + ;; On an heading, start at first item after drawers and + ;; time-stamps (scheduled, etc.) (let ((limit (save-excursion (outline-next-heading) (point)))) (forward-line 1) - (when (looking-at org-drawer-regexp) - (re-search-forward "^[ \t]*:END:" limit nil)) + (while (or (looking-at drawer-re) (looking-at keyword-re)) + (if (looking-at keyword-re) + (forward-line 1) + (re-search-forward "^[ \t]*:END:" limit nil))) (if (org-list-search-forward (org-item-beginning-re) limit t) (setq lim-up (point-at-bol)) (error "No item in subtree")) From 1c0d592463632293aa4e5685abdcb5732b3c7fe9 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 23 Mar 2011 18:26:32 +0100 Subject: [PATCH 10/14] org-latex: change default date format * lisp/org-latex.el (org-export-latex-date-format): Change default date format to \today. This has the same result but respects the language set in the document by default. Signed-off-by: Julien Danjou --- lisp/org-latex.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org-latex.el b/lisp/org-latex.el index 9be842b51..605795ca8 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -258,7 +258,7 @@ For example \orgTITLE for #+TITLE." :type 'boolean) (defcustom org-export-latex-date-format - "%d %B %Y" + "\\today" "Format string for \\date{...}." :group 'org-export-latex :type 'string) From abbee1635e18d88d82bbf9883c9e95e66540fdff Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Wed, 23 Mar 2011 11:26:53 -0600 Subject: [PATCH 11/14] ob-exp: use source block name when finding cached results. * lisp/ob-exp.el (org-babel-exp-results): Use code block name when finding cached results. --- lisp/ob-exp.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/ob-exp.el b/lisp/ob-exp.el index 5306ca687..20a7cdad3 100644 --- a/lisp/ob-exp.el +++ b/lisp/ob-exp.el @@ -250,7 +250,7 @@ inhibit insertion of results into the buffer." (when (and org-export-babel-evaluate (not (and hash (equal hash (org-babel-exp-in-export-file (nth 0 info) - (org-babel-result-hash)))))) + (org-babel-result-hash info)))))) (let ((lang (nth 0 info)) (body (nth 1 info))) ;; skip code blocks which we can't evaluate From 051b5b291cb3dbe6b7dba68fc8da5451e2546953 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Thu, 17 Mar 2011 13:01:06 +0100 Subject: [PATCH 12/14] org-list: fix infinite loop on erroneous block and drawer constructs * lisp/org-list.el (org-list-struct,org-in-item-p): don't assume end of blocks or drawers necessarily start somewhere. It it isn't the case, treat them as normal text. --- lisp/org-list.el | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lisp/org-list.el b/lisp/org-list.el index 4cc2d5332..7136e2b94 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -468,10 +468,10 @@ This checks `org-list-ending-method'." (looking-at org-list-end-re)) (throw 'exit nil)) ;; Skip blocks, drawers, inline-tasks, blank lines - ((looking-at "^[ \t]*#\\+end_") - (re-search-backward "^[ \t]*#\\+begin_" nil t)) - ((looking-at "^[ \t]*:END:") - (re-search-backward drawers-re nil t) + ((and (looking-at "^[ \t]*#\\+end_") + (re-search-backward "^[ \t]*#\\+begin_" lim-up t))) + ((and (looking-at "^[ \t]*:END:") + (re-search-backward drawers-re lim-up t)) (beginning-of-line)) ((and inlinetask-re (looking-at inlinetask-re)) (org-inlinetask-goto-beginning) @@ -689,10 +689,10 @@ Assume point is at an item." (memq (assq (car beg-cell) itm-lst) itm-lst)))) ;; Skip blocks, drawers, inline tasks, blank lines ;; along the way. - ((looking-at "^[ \t]*#\\+end_") - (re-search-backward "^[ \t]*#\\+begin_" nil t)) - ((looking-at "^[ \t]*:END:") - (re-search-backward drawers-re nil t) + ((and (looking-at "^[ \t]*#\\+end_") + (re-search-backward "^[ \t]*#\\+begin_" lim-up t))) + ((and (looking-at "^[ \t]*:END:") + (re-search-backward drawers-re lim-up t)) (beginning-of-line)) ((and inlinetask-re (looking-at inlinetask-re)) (org-inlinetask-goto-beginning) @@ -756,11 +756,11 @@ Assume point is at an item." (throw 'exit (push (cons 0 (point)) end-lst-2))) ;; Skip blocks, drawers, inline tasks and blank lines ;; along the way - ((looking-at "^[ \t]*#\\+begin_") - (re-search-forward "^[ \t]*#\\+end_") + ((and (looking-at "^[ \t]*#\\+begin_") + (re-search-forward "^[ \t]*#\\+end_" lim-down t)) (forward-line 1)) - ((looking-at drawers-re) - (re-search-forward "^[ \t]*:END:" nil t) + ((and (looking-at drawers-re) + (re-search-forward "^[ \t]*:END:" lim-down t)) (forward-line 1)) ((and inlinetask-re (looking-at inlinetask-re)) (org-inlinetask-goto-end)) From fb35e7017c55f906e622949c05e92a7c1689c953 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Sun, 27 Feb 2011 13:50:02 +0100 Subject: [PATCH 13/14] Set lisp-indent-function for org-with-remote-undo Signed-off-by: Julien Danjou --- lisp/org-macs.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/org-macs.el b/lisp/org-macs.el index 5c1c6d281..2c927f470 100644 --- a/lisp/org-macs.el +++ b/lisp/org-macs.el @@ -192,6 +192,7 @@ We use a macro so that the test can happen at compilation time." ;; remember which buffer to undo (push (list _cmd _cline _buf1 _c1 _buf2 _c2) org-agenda-undo-list))))) +(put 'org-with-remote-undo 'lisp-indent-function 1) (defmacro org-no-read-only (&rest body) "Inhibit read-only for BODY." From d9c5b384f881378e3ca75e81e8432ba918470150 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Wed, 23 Mar 2011 21:02:38 +0100 Subject: [PATCH 14/14] org-list: org-keyword-time-regexp might be nil in other major modes * lisp/org-list.el (org-toggle-checkbox): build value of org-keyword-time-regexp instead of using it directly, as it's buffer-local, and function might be called outside Org. --- lisp/org-list.el | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lisp/org-list.el b/lisp/org-list.el index 7136e2b94..7787706b5 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -81,14 +81,15 @@ (require 'org-macs) (require 'org-compat) -(defvar org-blank-before-new-entry) -(defvar org-complex-heading-regexp) -(defvar org-description-max-indent) -(defvar org-drawer-regexp) -(defvar org-drawers) (defvar org-M-RET-may-split-line) +(defvar org-blank-before-new-entry) +(defvar org-clock-string) +(defvar org-closed-string) +(defvar org-deadline-string) +(defvar org-description-max-indent) +(defvar org-drawers) (defvar org-odd-levels-only) -(defvar org-outline-regexp) +(defvar org-scheduled-string) (defvar org-ts-regexp) (defvar org-ts-regexp-both) @@ -2076,7 +2077,11 @@ in subtree, ignoring drawers." (drawer-re (concat "^[ \t]*:\\(" (mapconcat 'regexp-quote org-drawers "\\|") "\\):[ \t]*$")) - (keyword-re (concat "^[ \t]*" org-keyword-time-regexp)) + (keyword-re (concat "^[ \t]*\\<\\(" org-scheduled-string + "\\|" org-deadline-string + "\\|" org-closed-string + "\\|" org-clock-string "\\)" + " *[[<]\\([^]>]+\\)[]>]")) (orderedp (org-entry-get nil "ORDERED")) (bounds ;; In a region, start at first item in region