* [BUG] org-fill-paragraph on #+TBLNAME @ 2013-04-25 12:36 Michael Brand 2013-04-26 12:31 ` Nicolas Goaziou 0 siblings, 1 reply; 8+ messages in thread From: Michael Brand @ 2013-04-25 12:36 UTC (permalink / raw) To: Org Mode Hi all There is a minor bug, relevant in my first and simple trial to apply org-fill-paragraph on all parts of an Org buffer: M-q (fill-paragraph/org-fill-paragraph) on the first column of the line #+TBLNAME here #+TBLNAME: table | field | results in an error. The type "table" and the buffer range returned by org-element-at-point that determines to use org-table-align seems ok to me. More like the problem seems that the variable "lines" of org-table-align that should contain the table rows becomes nil. I am not sure how to resolve it in a robust way, preferrably with org-element. This is release_8.0.1-35-ge87dc9. Michael ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [BUG] org-fill-paragraph on #+TBLNAME 2013-04-25 12:36 [BUG] org-fill-paragraph on #+TBLNAME Michael Brand @ 2013-04-26 12:31 ` Nicolas Goaziou 2013-04-26 12:58 ` Michael Brand 0 siblings, 1 reply; 8+ messages in thread From: Nicolas Goaziou @ 2013-04-26 12:31 UTC (permalink / raw) To: Michael Brand; +Cc: Org Mode Hello, Michael Brand <michael.ch.brand@gmail.com> writes: > There is a minor bug, relevant in my first and simple trial to apply > org-fill-paragraph on all parts of an Org buffer: M-q > (fill-paragraph/org-fill-paragraph) on the first column of the > line #+TBLNAME here > > #+TBLNAME: table > | field | > > results in an error. The error should be fixed. Thanks for reporting this. Regards, -- Nicolas Goaziou ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [BUG] org-fill-paragraph on #+TBLNAME 2013-04-26 12:31 ` Nicolas Goaziou @ 2013-04-26 12:58 ` Michael Brand 2013-04-26 13:03 ` Nicolas Goaziou 0 siblings, 1 reply; 8+ messages in thread From: Michael Brand @ 2013-04-26 12:58 UTC (permalink / raw) To: Nicolas Goaziou; +Cc: Org Mode Hi Nicolas On Fri, Apr 26, 2013 at 2:31 PM, Nicolas Goaziou <n.goaziou@gmail.com> wrote: > The error should be fixed. Fix confirmed, thank you. The ERT you added for this makes me wonder again: What is the status of #+NAME for tables? Initiated by a discussion on the list some time ago I thought I could and would better migrate all my #+TBLNAME to #+NAME but since it still does not work for remote references like this #+TBLNAME: table | 42 | | 42 | #+TBLFM: $1 = remote(table, @1$1) I thought I did not understand the development of #+NAME. Are remote references supposed to work also with #+NAME for tables? Michael ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [BUG] org-fill-paragraph on #+TBLNAME 2013-04-26 12:58 ` Michael Brand @ 2013-04-26 13:03 ` Nicolas Goaziou 2013-04-26 13:31 ` Michael Brand 0 siblings, 1 reply; 8+ messages in thread From: Nicolas Goaziou @ 2013-04-26 13:03 UTC (permalink / raw) To: Michael Brand; +Cc: Org Mode Michael Brand <michael.ch.brand@gmail.com> writes: > The ERT you added for this makes me wonder again: What is the status > of #+NAME for tables? Initiated by a discussion on the list some time > ago I thought I could and would better migrate all my #+TBLNAME > to #+NAME but since it still does not work for remote references like > this > > #+TBLNAME: table > | 42 | > > | 42 | > #+TBLFM: $1 = remote(table, @1$1) > > I thought I did not understand the development of #+NAME. Are remote > references supposed to work also with #+NAME for tables? NAME should be a drop-in replacement for TBLNAME[fn:1]. If it doesn't work for remote references in tables, then "org-table.el" must be updated. I'll have a look at it later, unless Someone beats me to it. Regards, [fn:1] In fact, it should also be a replacement for DATA, LABEL, RESNAME, SOURCE, and SRCNAME. -- Nicolas Goaziou ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [BUG] org-fill-paragraph on #+TBLNAME 2013-04-26 13:03 ` Nicolas Goaziou @ 2013-04-26 13:31 ` Michael Brand 2013-04-26 14:00 ` Nicolas Goaziou 0 siblings, 1 reply; 8+ messages in thread From: Michael Brand @ 2013-04-26 13:31 UTC (permalink / raw) To: Nicolas Goaziou; +Cc: Org Mode [-- Attachment #1: Type: text/plain, Size: 347 bytes --] Hi Nicolas On Fri, Apr 26, 2013 at 3:03 PM, Nicolas Goaziou <n.goaziou@gmail.com> wrote: > NAME should be a drop-in replacement for TBLNAME[fn:1]. Thanks for confirming my understanding. > If it doesn't work for remote references in tables, then "org-table.el" > must be updated. It did not yet for remote references, patch attached. Michael [-- Attachment #2: 0001-Allow-also-NAME-table-for-remote-references.patch.txt --] [-- Type: text/plain, Size: 1001 bytes --] From 68a96411e468a211453ce83c3a139cc2952c6e72 Mon Sep 17 00:00:00 2001 From: Michael Brand <michael.ch.brand@gmail.com> Date: Fri, 26 Apr 2013 15:28:51 +0200 Subject: [PATCH] Allow also "#+NAME: table" for remote references * lisp/org-table.el (org-table-get-remote-range): Extend regexp to match "#+NAME: table" additionally to "#+TBLNAME: table". --- lisp/org-table.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/org-table.el b/lisp/org-table.el index 93c33b2..8e461c8 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -4996,7 +4996,8 @@ list of the fields in the rectangle." (save-excursion (goto-char (point-min)) (if (re-search-forward - (concat "^[ \t]*#\\+tblname:[ \t]*" (regexp-quote name-or-id) "[ \t]*$") + (concat "^[ \t]*#\\+\\(tbl\\)?name:[ \t]*" + (regexp-quote name-or-id) "[ \t]*$") nil t) (setq buffer (current-buffer) loc (match-beginning 0)) (setq id-loc (org-id-find name-or-id 'marker)) -- 1.8.1.2 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [BUG] org-fill-paragraph on #+TBLNAME 2013-04-26 13:31 ` Michael Brand @ 2013-04-26 14:00 ` Nicolas Goaziou 2013-04-26 15:10 ` Michael Brand 0 siblings, 1 reply; 8+ messages in thread From: Nicolas Goaziou @ 2013-04-26 14:00 UTC (permalink / raw) To: Michael Brand; +Cc: Org Mode Hello, Michael Brand <michael.ch.brand@gmail.com> writes: > It did not yet for remote references, patch attached. Thanks for your patch. While you're at it, would you mind providing a test for it? Regards, -- Nicolas Goaziou ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [BUG] org-fill-paragraph on #+TBLNAME 2013-04-26 14:00 ` Nicolas Goaziou @ 2013-04-26 15:10 ` Michael Brand 2013-04-26 21:21 ` Nicolas Goaziou 0 siblings, 1 reply; 8+ messages in thread From: Michael Brand @ 2013-04-26 15:10 UTC (permalink / raw) To: Nicolas Goaziou; +Cc: Org Mode [-- Attachment #1: Type: text/plain, Size: 236 bytes --] Hi Nicolas On Fri, Apr 26, 2013 at 4:00 PM, Nicolas Goaziou <n.goaziou@gmail.com> wrote: > Thanks for your patch. While you're at it, would you mind providing > a test for it? Ok, the attached patch replaces my previous one. Michael [-- Attachment #2: 0001-Allow-also-NAME-table-for-remote-references.patch.txt --] [-- Type: text/plain, Size: 4084 bytes --] From 44b14cac0276888d46c89336f6b8cf0793c05105 Mon Sep 17 00:00:00 2001 From: Michael Brand <michael.ch.brand@gmail.com> Date: Fri, 26 Apr 2013 17:07:55 +0200 Subject: [PATCH] Allow also "#+NAME: table" for remote references * lisp/org-table.el (org-table-get-remote-range): Extend regexp to match "#+NAME: table" additionally to "#+TBLNAME: table". * testing/lisp/test-org-table.el: Add test. * testing/org-test.el (org-test-table-target-expect): Allow several tables to support testing remote references in the last table. --- lisp/org-table.el | 3 ++- testing/lisp/test-org-table.el | 18 ++++++++++++++++++ testing/org-test.el | 23 ++++++++++++----------- 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/lisp/org-table.el b/lisp/org-table.el index 93c33b2..8e461c8 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -4996,7 +4996,8 @@ list of the fields in the rectangle." (save-excursion (goto-char (point-min)) (if (re-search-forward - (concat "^[ \t]*#\\+tblname:[ \t]*" (regexp-quote name-or-id) "[ \t]*$") + (concat "^[ \t]*#\\+\\(tbl\\)?name:[ \t]*" + (regexp-quote name-or-id) "[ \t]*$") nil t) (setq buffer (current-buffer) loc (match-beginning 0)) (setq id-loc (org-id-find name-or-id 'marker)) diff --git a/testing/lisp/test-org-table.el b/testing/lisp/test-org-table.el index 732ddb3..52cdc74 100644 --- a/testing/lisp/test-org-table.el +++ b/testing/lisp/test-org-table.el @@ -770,6 +770,24 @@ reference (with row). Mode string N." ;; "Remote reference." ;; (should ;; (string= "$3 = remote(FOO, @@#$2)" (org-table-convert-refs-to-rc "C& = remote(FOO, @@#B&)")))) + +(ert-deftest test-org-table/remote-reference-access () + "Access to remote reference." + (org-test-table-target-expect + " +#+NAME: table +| | 42 | + +| replace | | +" + " +#+NAME: table +| | 42 | + +| 42 | | +" + 1 "#+TBLFM: $1 = remote(table, @1$2)")) + (ert-deftest test-org-table/org-at-TBLFM-p () (org-test-with-temp-text-in-file " diff --git a/testing/org-test.el b/testing/org-test.el index 0c9ca58..8c81115 100644 --- a/testing/org-test.el +++ b/testing/org-test.el @@ -239,15 +239,14 @@ get the table stable. Anyhow, if LAPS is 'iterate then iterate, but this will run one recalculation longer. When EXPECT is nil it will be set to TARGET. -If running a test interactively in ERT is not enough and you need -to examine the target table with e. g. the Org formula debugger -or an Emacs Lisp debugger (e. g. with point in a data field and -calling the instrumented `org-table-eval-formula') then copy and -paste the table with formula from the ERT results buffer or -temporarily substitute the `org-test-with-temp-text' of this -function with `org-test-with-temp-text-in-file'. - -Consider setting `pp-escape-newlines' to nil manually." +When running a test interactively in ERT is not enough and you +need to examine the target table with e. g. the Org formula +debugger or an Emacs Lisp debugger (e. g. with point in a data +field and calling the instrumented `org-table-eval-formula') then +copy and paste the table with formula from the ERT results buffer +or temporarily substitute the `org-test-with-temp-text' of this +function with `org-test-with-temp-text-in-file'. Also consider +setting `pp-escape-newlines' to nil manually." (require 'pp) (let ((back pp-escape-newlines) (current-tblfm)) (unless tblfm @@ -256,9 +255,11 @@ Consider setting `pp-escape-newlines' to nil manually." (unless expect (setq expect target)) (while (setq current-tblfm (pop tblfm)) (org-test-with-temp-text (concat target current-tblfm) - ;; Search table, stop ERT at end of buffer if not found. + ;; Search the last of possibly several tables, let the ERT + ;; test fail if not found. + (goto-char (point-max)) (while (not (org-at-table-p)) - (should (eq 0 (forward-line)))) + (should (eq 0 (forward-line -1)))) (when laps (if (and (symbolp laps) (eq laps 'iterate)) (should (org-table-recalculate 'iterate t)) -- 1.8.1.2 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [BUG] org-fill-paragraph on #+TBLNAME 2013-04-26 15:10 ` Michael Brand @ 2013-04-26 21:21 ` Nicolas Goaziou 0 siblings, 0 replies; 8+ messages in thread From: Nicolas Goaziou @ 2013-04-26 21:21 UTC (permalink / raw) To: Michael Brand; +Cc: Org Mode Michael Brand <michael.ch.brand@gmail.com> writes: > On Fri, Apr 26, 2013 at 4:00 PM, Nicolas Goaziou <n.goaziou@gmail.com> wrote: >> Thanks for your patch. While you're at it, would you mind providing >> a test for it? > > Ok, the attached patch replaces my previous one. Applied. Thank you! Regards, -- Nicolas Goaziou ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-04-26 21:21 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-04-25 12:36 [BUG] org-fill-paragraph on #+TBLNAME Michael Brand 2013-04-26 12:31 ` Nicolas Goaziou 2013-04-26 12:58 ` Michael Brand 2013-04-26 13:03 ` Nicolas Goaziou 2013-04-26 13:31 ` Michael Brand 2013-04-26 14:00 ` Nicolas Goaziou 2013-04-26 15:10 ` Michael Brand 2013-04-26 21:21 ` Nicolas Goaziou
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.