emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: TBLFM regexp doesn't account for possible white space after the pipe [8.2.2 (release_8.2.2-188-gc57372 @ /home/wvxvw/Projects/org-mode/lisp/)]
@ 2015-05-07 21:35 Oleg Sivokon
  2015-05-08  8:52 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Oleg Sivokon @ 2015-05-07 21:35 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 839 bytes --]


Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

     http://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org-mode mailing list.
------------------------------------------------------------------------

When evaluating a formula, the regular expression used to locate the
formula will miss, if there is a white space after the rightmost pipe in
the last row, i.e.

|1|*
#+tblfm: vsum($1)

asterisk is where the extra space character appears.  Attached is my
attempt at patching it.

Best,

Oleg


Emacs  : GNU Emacs 25.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.12)
 of 2015-05-03 on wvxvvw-laptop
Package: Org-mode version 8.2.2 (release_8.2.2-188-gc57372 @ /home/wvxvw/Projects/org-mode/lisp/)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Account for space after last column in tblfm regex --]
[-- Type: text/x-patch, Size: 893 bytes --]

From b91aeaf01f8f4a11f55cc60bbfd9c75e64d73554 Mon Sep 17 00:00:00 2001
From: wvxvw <olegsivokon@gmail.com>
Date: Fri, 8 May 2015 00:09:21 +0300
Subject: [PATCH] TBLFM regex account for white space after last column.

---
 lisp/org-table.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org-table.el b/lisp/org-table.el
index a644008..3ca0e76 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -56,7 +56,7 @@ This can be used to add additional functionality after the table is sent
 to the receiver position, otherwise, if table is not sent, the functions
 are not run.")
 
-(defvar org-table-TBLFM-begin-regexp "|\n[ \t]*#\\+TBLFM: ")
+(defvar org-table-TBLFM-begin-regexp "|\s-*\n[ \t]*#\\+TBLFM: ")
 
 (defcustom orgtbl-optimized (eq org-enable-table-editor 'optimized)
   "Non-nil means use the optimized table editor version for `orgtbl-mode'.
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: Bug: TBLFM regexp doesn't account for possible white space after the pipe [8.2.2 (release_8.2.2-188-gc57372 @ /home/wvxvw/Projects/org-mode/lisp/)]
  2015-05-07 21:35 Bug: TBLFM regexp doesn't account for possible white space after the pipe [8.2.2 (release_8.2.2-188-gc57372 @ /home/wvxvw/Projects/org-mode/lisp/)] Oleg Sivokon
@ 2015-05-08  8:52 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2015-05-08  8:52 UTC (permalink / raw)
  To: Oleg Sivokon; +Cc: emacs-orgmode

Hello,

Oleg Sivokon <olegsivokon@gmail.com> writes:

> When evaluating a formula, the regular expression used to locate the
> formula will miss, if there is a white space after the rightmost pipe in
> the last row, i.e.
>
> |1|*
> #+tblfm: vsum($1)
>
> asterisk is where the extra space character appears.

Good catch.

> Attached is my attempt at patching it.

Thank you.

However, I applied a different patch as table lines are not required to
end on a vertical bar either.

Anyway, it should be fixed in 6ac8db9dbabd83152612c65a9cd505390a1915d1.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-05-08  8:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-07 21:35 Bug: TBLFM regexp doesn't account for possible white space after the pipe [8.2.2 (release_8.2.2-188-gc57372 @ /home/wvxvw/Projects/org-mode/lisp/)] Oleg Sivokon
2015-05-08  8:52 ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).