[Accepted] [Orgmode] Latex: exporting a tree
Patch 493 (http://patchwork.newartisans.com/patch/493/) is now Accepted. Maintainer comment: none This relates to the following submission: http://mid.gmane.org/%3C87sjxuty6w.wl%25n.goaziou%40gmail.com%3E Here is the original message containing the patch: Content-Type: text/plain; charset=utf-8 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [Orgmode] Latex: exporting a tree Date: Sun, 19 Dec 2010 05:15:35 - From: Nicolas Goaziou n.goaz...@gmail.com X-Patchwork-Id: 493 Message-Id: 87sjxuty6w.wl%n.goaz...@gmail.com To: Carsten Dominik carsten.domi...@gmail.com Cc: Org Mode emacs-orgmode@gnu.org Hello, Carsten Dominik writes: Though, shouldn't I replace all those calls to `org-get-limited-outline-regexp' with `org-with-limited-levels' macro? I have not looked closely at your new code - but yes, this is what the macro is for! The following patch does that, 3 times. I replaced one condition-case with ignore-errors in the process. As `org-store-link' is also modified, I did not apply it myself. Regards, -- Nicolas From 2764d0a0fadec4fd6a2b3eab0ff98ca2e77d32d5 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou n.goaz...@gmail.com Date: Sun, 19 Dec 2010 00:39:13 +0100 Subject: [PATCH] Small refactoring with org-with-limited-levels macro --- lisp/org.el | 365 +-- 1 files changed, 181 insertions(+), 184 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 53039e4..75fb221 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -7022,12 +7022,10 @@ in the region. Return the level of the current entry, or nil if before the first headline. The level is the number of stars at the beginning of the headline. (save-excursion -(let ((outline-regexp (org-get-limited-outline-regexp))) - (condition-case nil - (progn - (org-back-to-heading t) - (funcall outline-level)) - (error nil) +(org-with-limited-levels + (ignore-errors + (org-back-to-heading t) + (funcall outline-level) (defun org-get-previous-line-level () Return the outline depth of the last headline before the current line. @@ -8275,183 +8273,183 @@ For file links, arg negates `org-context-in-file-links'. (interactive P) (org-load-modules-maybe) (setq org-store-link-plist nil) ; reset - (let ((outline-regexp (org-get-limited-outline-regexp)) - link cpltxt desc description search txt custom-id agenda-link) -(cond - - ((run-hook-with-args-until-success 'org-store-link-functions) - (setq link (plist-get org-store-link-plist :link) - desc (or (plist-get org-store-link-plist :description) link))) - - ((equal (buffer-name) *Org Edit Src Example*) - (let (label gc) - (while (or (not label) -(save-excursion - (save-restriction -(widen) -(goto-char (point-min)) -(re-search-forward - (regexp-quote (format org-coderef-label-format label)) - nil t - (when label (message Label exists already) (sit-for 2)) - (setq label (read-string Code line label: label))) - (end-of-line 1) - (setq link (format org-coderef-label-format label)) - (setq gc (- 79 (length link))) - (if ( (current-column) gc) (org-move-to-column gc t) (insert )) - (insert link) - (setq link (concat ( label )) desc nil))) - - ((equal (org-bound-and-true-p org-agenda-buffer-name) (buffer-name)) - ;; We are in the agenda, link to referenced location - (let ((m (or (get-text-property (point) 'org-hd-marker) -(get-text-property (point) 'org-marker - (when m - (org-with-point-at m - (setq agenda-link - (if (interactive-p) - (call-interactively 'org-store-link) - (org-store-link nil))) - - ((eq major-mode 'calendar-mode) - (let ((cd (calendar-cursor-to-date))) - (setq link - (format-time-string -(car org-time-stamp-formats) -(apply 'encode-time - (list 0 0 0 (nth 1 cd) (nth 0 cd) (nth 2 cd) - nil nil nil - (org-store-link-props :type calendar :date cd))) - - ((eq major-mode 'w3-mode) - (setq cpltxt (if (and (buffer-name) - (not (string-match Untitled (buffer-name -(buffer-name) - (url-view-url t)) - link (org-make-link (url-view-url t))) - (org-store-link-props :type w3 :url (url-view-url t))) - - ((eq major-mode 'w3m-mode) - (setq cpltxt (or w3m-current-title w3m-current-url) - link (org-make-link w3m-current-url)) - (org-store-link-props :type w3m :url (url-view-url t))) - - ((setq search (run-hook-with-args
Re: [Orgmode] Latex: exporting a tree
Hello, Carsten Dominik writes: Though, shouldn't I replace all those calls to `org-get-limited-outline-regexp' with `org-with-limited-levels' macro? I have not looked closely at your new code - but yes, this is what the macro is for! The following patch does that, 3 times. I replaced one condition-case with ignore-errors in the process. As `org-store-link' is also modified, I did not apply it myself. Regards, -- Nicolas From 2764d0a0fadec4fd6a2b3eab0ff98ca2e77d32d5 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou n.goaz...@gmail.com Date: Sun, 19 Dec 2010 00:39:13 +0100 Subject: [PATCH] Small refactoring with org-with-limited-levels macro --- lisp/org.el | 365 +-- 1 files changed, 181 insertions(+), 184 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 53039e4..75fb221 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -7022,12 +7022,10 @@ in the region. Return the level of the current entry, or nil if before the first headline. The level is the number of stars at the beginning of the headline. (save-excursion -(let ((outline-regexp (org-get-limited-outline-regexp))) - (condition-case nil - (progn - (org-back-to-heading t) - (funcall outline-level)) - (error nil) +(org-with-limited-levels + (ignore-errors + (org-back-to-heading t) + (funcall outline-level) (defun org-get-previous-line-level () Return the outline depth of the last headline before the current line. @@ -8275,183 +8273,183 @@ For file links, arg negates `org-context-in-file-links'. (interactive P) (org-load-modules-maybe) (setq org-store-link-plist nil) ; reset - (let ((outline-regexp (org-get-limited-outline-regexp)) - link cpltxt desc description search txt custom-id agenda-link) -(cond - - ((run-hook-with-args-until-success 'org-store-link-functions) - (setq link (plist-get org-store-link-plist :link) - desc (or (plist-get org-store-link-plist :description) link))) - - ((equal (buffer-name) *Org Edit Src Example*) - (let (label gc) - (while (or (not label) - (save-excursion -(save-restriction - (widen) - (goto-char (point-min)) - (re-search-forward - (regexp-quote (format org-coderef-label-format label)) - nil t - (when label (message Label exists already) (sit-for 2)) - (setq label (read-string Code line label: label))) - (end-of-line 1) - (setq link (format org-coderef-label-format label)) - (setq gc (- 79 (length link))) - (if ( (current-column) gc) (org-move-to-column gc t) (insert )) - (insert link) - (setq link (concat ( label )) desc nil))) - - ((equal (org-bound-and-true-p org-agenda-buffer-name) (buffer-name)) - ;; We are in the agenda, link to referenced location - (let ((m (or (get-text-property (point) 'org-hd-marker) - (get-text-property (point) 'org-marker - (when m - (org-with-point-at m - (setq agenda-link - (if (interactive-p) - (call-interactively 'org-store-link) - (org-store-link nil))) - - ((eq major-mode 'calendar-mode) - (let ((cd (calendar-cursor-to-date))) - (setq link - (format-time-string - (car org-time-stamp-formats) - (apply 'encode-time - (list 0 0 0 (nth 1 cd) (nth 0 cd) (nth 2 cd) - nil nil nil - (org-store-link-props :type calendar :date cd))) - - ((eq major-mode 'w3-mode) - (setq cpltxt (if (and (buffer-name) - (not (string-match Untitled (buffer-name - (buffer-name) -(url-view-url t)) - link (org-make-link (url-view-url t))) - (org-store-link-props :type w3 :url (url-view-url t))) - - ((eq major-mode 'w3m-mode) - (setq cpltxt (or w3m-current-title w3m-current-url) - link (org-make-link w3m-current-url)) - (org-store-link-props :type w3m :url (url-view-url t))) - - ((setq search (run-hook-with-args-until-success - 'org-create-file-search-functions)) - (setq link (concat file: (abbreviate-file-name buffer-file-name) -:: search)) - (setq cpltxt (or description link))) - - ((eq major-mode 'image-mode) - (setq cpltxt (concat file: - (abbreviate-file-name buffer-file-name)) - link (org-make-link cpltxt)) - (org-store-link-props :type image :file buffer-file-name)) - - ((eq major-mode 'dired-mode) - ;; link to the file in the current line - (let ((file (dired-get-filename nil t))) - (setq file (if file -
Re: [Orgmode] Latex: exporting a tree
Third attempt to get your attention: - If you export the (new) minimal example below to latex (C-cC-e l), it works. - If you only export a tree (Subtree in the example; C-cC-e 1 l), the first table ends at the horizontal line and everything between it and the next node (Subsubtree) is eliminated. The second (identical) table is exported correctly. - If you remove the asterisk(s) in the first table, it works. This problem crept in in the last days or weeks before 7.4. It may not be a problem for most of you, but I happen to have a number of files where columns are automatically displayed as tables preceding the first subnode (#+BEGIN: columnview ...). An alternative would be to display %ITEM in column-view without the asterisks. Emacs 23.2.1 on OS X 10.6.5 Org-mode version 7.4 (release_7.4.24.g48b11.dirty) Thanks, Jörg ---New minimal example * Subtree | One| Two | Three | |+--+---| | * Test | text | text | | ** One | text | text | Some text ** Subsubtree | One| Two | Three | |+--+---| | * Test | text | text | | ** One | text | text | End of new minimal example- On 12/10/10 3:49 PM, Jörg Hagmann wrote: I checked the problem below with the latest (7.4 alias 7.3) version and it is still there. Could somebody look into that? Emacs 23.2 on OS X 10.6.5 Thanks, Jörg With today's pull, exporting a subtree to latex (C-cC-e 1 l) truncates a table at the horizontal line and eliminates the text between the table and the next heading. It works when exporting the whole file (C-cC-e l). ---Minimal example-- * Test :PROPERTIES: :COLUMNS: %15ITEM(Lecture) %number %Date %hours{+} %status{X/} :status_ALL: [ ] [X] :END: #+BEGIN: columnview :hlines 1 :id local :maxlevel 2 | Lecture | number | Date | hours | status | |-+--+--+---+| | * Test | | | 2 | [0/1] | | ** One | 16.1.7.1 | [2010-12-13 Mon 10:15-12:00] | 2 | [ ]| #+END: Some text ** One :PROPERTIES: :Date: [2010-12-13 Mon 10:15-12:00] :hours: 2 :number: 16.1.7.1 :status: [ ] :END: -End of minimal example--- ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] Latex: exporting a tree
Hi Jörg, On Dec 15, 2010, at 11:04 AM, Jörg Hagmann wrote: Third attempt to get your attention: why the impatience? Your first attempt was December 9, now it is December 15... No-one is being payed here for fixing problems. - If you export the (new) minimal example below to latex (C-cC-e l), it works. - If you only export a tree (Subtree in the example; C-cC-e 1 l), the first table ends at the horizontal line and everything between it and the next node (Subsubtree) is eliminated. The second (identical) table is exported correctly. - If you remove the asterisk(s) in the first table, it works. Thank you for your report, this issue is fixed now. Nicolas, I believe this was one of your patches - the limited outline regexp needs to be anchored in the way you use it in org-latex.el. Greetings - Carsten This problem crept in in the last days or weeks before 7.4. It may not be a problem for most of you, but I happen to have a number of files where columns are automatically displayed as tables preceding the first subnode (#+BEGIN: columnview ...). An alternative would be to display %ITEM in column-view without the asterisks. Emacs 23.2.1 on OS X 10.6.5 Org-mode version 7.4 (release_7.4.24.g48b11.dirty) Thanks, Jörg ---New minimal example * Subtree | One| Two | Three | |+--+---| | * Test | text | text | | ** One | text | text | Some text ** Subsubtree | One| Two | Three | |+--+---| | * Test | text | text | | ** One | text | text | End of new minimal example- On 12/10/10 3:49 PM, Jörg Hagmann wrote: I checked the problem below with the latest (7.4 alias 7.3) version and it is still there. Could somebody look into that? Emacs 23.2 on OS X 10.6.5 Thanks, Jörg With today's pull, exporting a subtree to latex (C-cC-e 1 l) truncates a table at the horizontal line and eliminates the text between the table and the next heading. It works when exporting the whole file (C-cC-e l). ---Minimal example-- * Test :PROPERTIES: :COLUMNS: %15ITEM(Lecture) %number %Date %hours{+} %status{X/} :status_ALL: [ ] [X] :END: #+BEGIN: columnview :hlines 1 :id local :maxlevel 2 | Lecture | number | Date | hours | status | |-+--+--+--- +| | * Test | | | 2 | [0/1] | | ** One | 16.1.7.1 | [2010-12-13 Mon 10:15-12:00] | 2 | [ ]| #+END: Some text ** One :PROPERTIES: :Date: [2010-12-13 Mon 10:15-12:00] :hours: 2 :number: 16.1.7.1 :status: [ ] :END: -End of minimal example--- ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] Latex: exporting a tree
Hello, Carsten Dominik writes: Nicolas, I believe this was one of your patches - the limited outline regexp needs to be anchored in the way you use it in org-latex.el. Ok. Today, I will check others limited outline regexp in use. Regards, -- Nicolas ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] Latex: exporting a tree
On Dec 15, 2010, at 1:13 PM, Nicolas Goaziou wrote: Hello, Carsten Dominik writes: Nicolas, I believe this was one of your patches - the limited outline regexp needs to be anchored in the way you use it in org-latex.el. Ok. Today, I will check others limited outline regexp in use. Yes, thank you. It is a bit confusing that outline-regexp itself is not anchored, so all places who use it to search for a headline need the anchor added at re-search-forward time. I think this is some history issue, and it may have to do with the fact that in the old days, outline forling was done by converting \n to \r and back, which makes and anchored regexp no longer match after \r I fell over this issue *a lot* a couple of years ago :) - Carsten ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] Latex: exporting a tree
Hello, Others uses of org-get-limited-outline-regexp are corrects. Though, shouldn't I replace all those calls to `org-get-limited-outline-regexp' with `org-with-limited-levels' macro? Regards, -- Nicolas ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] Latex: exporting a tree
On Dec 15, 2010, at 7:15 PM, Nicolas Goaziou wrote: Hello, Others uses of org-get-limited-outline-regexp are corrects. Though, shouldn't I replace all those calls to `org-get-limited-outline-regexp' with `org-with-limited-levels' macro? I have not looked closely at your new code - but yes, this is what the macro is for! Cheers - Carsten Regards, -- Nicolas ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] Latex: exporting a tree
I checked the problem below with the latest (7.4 alias 7.3) version and it is still there. Could somebody look into that? Emacs 23.2 on OS X 10.6.5 Thanks, Jörg With today's pull, exporting a subtree to latex (C-cC-e 1 l) truncates a table at the horizontal line and eliminates the text between the table and the next heading. It works when exporting the whole file (C-cC-e l). ---Minimal example-- * Test :PROPERTIES: :COLUMNS: %15ITEM(Lecture) %number %Date %hours{+} %status{X/} :status_ALL: [ ] [X] :END: #+BEGIN: columnview :hlines 1 :id local :maxlevel 2 | Lecture | number | Date | hours | status | |-+--+--+---+| | * Test | | | 2 | [0/1] | | ** One | 16.1.7.1 | [2010-12-13 Mon 10:15-12:00] | 2 | [ ]| #+END: Some text ** One :PROPERTIES: :Date: [2010-12-13 Mon 10:15-12:00] :hours: 2 :number: 16.1.7.1 :status: [ ] :END: -End of minimal example--- ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode