From e31e89430aa9f1b5de545c3bfd1503acc848d527 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Tue, 1 Nov 2011 11:40:11 +0100 Subject: [PATCH 1/4] Globalize some variables to make them available in buffers not in Org mode * lisp/org.el (org-heading-regexp, org-heading-keyword-regexp-format, org-heading-keyword-maybe-regexp-format): Globalize variables so they are accessible even in buffers not in Org mode. --- lisp/org.el | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 318ccfdd2..c3c7bdff9 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -4246,10 +4246,6 @@ collapsed state." ;;; Variables for pre-computed regular expressions, all buffer local -(defvar org-heading-regexp nil - "Matches an headline. -Stars are put in group 1 and the trimmed body in group 2.") -(make-variable-buffer-local 'org-heading-regexp) (defvar org-drawer-regexp nil "Matches first line of a hidden block.") (make-variable-buffer-local 'org-drawer-regexp) @@ -4273,18 +4269,6 @@ group 3: Priority cookie group 4: True headline group 5: Tags") (make-variable-buffer-local 'org-complex-heading-regexp) -(defvar org-heading-keyword-regexp-format nil - "Printf format to make regexp to match an headline with some keyword. -This regexp will match the headline of any node which has the -exact keyword that is put into the format. The keyword isn't in -any group by default, but the stars and the body are.") -(make-variable-buffer-local 'org-heading-keyword-regexp-format) -(defvar org-heading-keyword-maybe-regexp-format nil - "Printf format to make regexp to match an headline with some keyword. -This regexp can match any headline with the specified keyword, or -a without a keyword. The keyword isn't in any group by default, -but the stars and the body are.") -(make-variable-buffer-local 'org-heading-keyword-maybe-regexp-format) (defvar org-complex-heading-regexp-format nil "Printf format to make regexp to match an exact headline. This regexp will match the headline of any node which has the @@ -4661,12 +4645,6 @@ means to push this value onto the list in the variable.") (concat "\\(" (mapconcat 'regexp-quote org-not-done-keywords "\\|") "\\)") - org-heading-regexp - "^\\(\\*+\\)\\(?: +\\(.*?\\)\\)?[ \t]*$" - org-heading-keyword-regexp-format - "^\\(\\*+\\)\\(?: +%s\\)\\(?: +\\(.*?\\)\\)?[ \t]*$" - org-heading-keyword-maybe-regexp-format - "^\\(\\*+\\)\\(?: +%s\\)?\\(?: +\\(.*?\\)\\)?[ \t]*$" org-not-done-heading-regexp (format org-heading-keyword-regexp-format org-not-done-regexp) org-todo-line-regexp @@ -4854,6 +4832,22 @@ This variable is set by `org-before-change-function'. This is similar to `org-outline-regexp' but additionally makes sure that we are at the beginning of the line.") +(defconst org-heading-regexp "^\\(\\*+\\)\\(?: +\\(.*?\\)\\)?[ \t]*$" + "Matches an headline, putting stars and text into groups. +Stars are put in group 1 and the trimmed body in group 2.") +(defconst org-heading-keyword-regexp-format + "^\\(\\*+\\)\\(?: +%s\\)\\(?: +\\(.*?\\)\\)?[ \t]*$" + "Printf format for a regexp matching an headline with some keyword. +This regexp will match the headline of any node which has the +exact keyword that is put into the format. The keyword isn't in +any group by default, but the stars and the body are.") +(defconst org-heading-keyword-maybe-regexp-format + "^\\(\\*+\\)\\(?: +%s\\)?\\(?: +\\(.*?\\)\\)?[ \t]*$" + "Printf format for a regexp matching an headline, possibly with some keyword. +This regexp can match any headline with the specified keyword, or +without a keyword. The keyword isn't in any group by default, +but the stars and the body are.") + ;;;###autoload (define-derived-mode org-mode outline-mode "Org" "Outline-based notes management and organizer, alias From a081581693e9b463d2b9442ba58c9cd719639e87 Mon Sep 17 00:00:00 2001 From: Suvayu Ali Date: Wed, 2 Nov 2011 00:26:07 +0100 Subject: [PATCH 2/4] Respect export options for subtree export title * org-exp.el (org-solidify-link-text): Respect org-export-with-tags when forming the export title during subtree export. TINY CHANGE --- lisp/org-exp.el | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lisp/org-exp.el b/lisp/org-exp.el index fa54242cf..e8ad0b9d0 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -2160,15 +2160,21 @@ can work correctly." (defun org-export-get-title-from-subtree () "Return subtree title and exclude it from export." (let ((rbeg (region-beginning)) (rend (region-end)) - (inhibit-read-only t) title) + (inhibit-read-only t) + (tags (plist-get (org-infile-export-plist) :tags)) + title) (save-excursion (goto-char rbeg) (when (and (org-at-heading-p) (>= (org-end-of-subtree t t) rend)) + (when (plist-member org-export-opt-plist :tags) + (setq tags (or (plist-get org-export-opt-plist :tags) tags))) ;; This is a subtree, we take the title from the first heading (goto-char rbeg) - (looking-at org-todo-line-regexp) - (setq title (match-string 3)) + (looking-at org-todo-line-tags-regexp) + (setq title (if (eq tags t) + (format "%s\t%s" (match-string 3) (match-string 4)) + (match-string 3))) (org-unmodified (add-text-properties (point) (1+ (point-at-eol)) (list :org-license-to-kill t))) From e856d1cfe7d50f0954ad134996291aea29036371 Mon Sep 17 00:00:00 2001 From: Jambunathan K Date: Wed, 2 Nov 2011 23:32:49 +0530 Subject: [PATCH 3/4] org-odt.el: Protect label references against downstream expansion * contrib/lisp/org-odt.el (org-export-odt-preprocess-label-references): Mark label as protected text and protect it from being expanded downstream. Fixes bug reported by Myles English here: http://lists.gnu.org/archive/html/emacs-orgmode/2011-11/msg00069.html --- contrib/lisp/org-odt.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/lisp/org-odt.el b/contrib/lisp/org-odt.el index 10c7fe3ca..f96372e54 100644 --- a/contrib/lisp/org-odt.el +++ b/contrib/lisp/org-odt.el @@ -2209,7 +2209,8 @@ using `org-open-file'." ;; time we would have seen and collected all the label ;; definitions in `org-odt-entity-labels-alist'. (org-odt-format-tags - "" "" label)) t t))))) + "" "" + (org-add-props label '(org-protected t)))) t t))))) ;; process latex fragments as part of ;; `org-export-preprocess-after-blockquote-hook'. Note that this hook From 00cb82c2660cdabbb9f4bc862551e2d179541988 Mon Sep 17 00:00:00 2001 From: Jambunathan K Date: Tue, 1 Nov 2011 00:49:06 +0530 Subject: [PATCH 4/4] org-odt.el: Minor modifications to reflect change in package layout * contrib/lisp/org-odt.el (org-odt-data-dir): Modified to reflect change in ELPA package layout. --- contrib/lisp/org-odt.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/lisp/org-odt.el b/contrib/lisp/org-odt.el index f96372e54..45dacfd8e 100644 --- a/contrib/lisp/org-odt.el +++ b/contrib/lisp/org-odt.el @@ -75,7 +75,7 @@ (defconst org-odt-lib-dir (file-name-directory load-file-name)) (defconst org-odt-data-dir (let ((dir1 (expand-file-name "../odt" org-odt-lib-dir)) ; git - (dir2 (expand-file-name "./contrib/odt" org-odt-lib-dir))) ; elpa + (dir2 (expand-file-name "./" org-odt-lib-dir))) ; elpa (cond ((file-directory-p dir1) dir1) ((file-directory-p dir2) dir2)