Commit Graph

552 Commits

Author SHA1 Message Date
Nicolas Goaziou b5d9f4be4d org-table: Allow accentuated characters in remote table names
* lisp/org-table.el (org-table-eval-formula): Allow a larger set of
  characters in remote name.

Reported-by: flav <flav.justflav@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/75690>
2015-02-01 01:03:45 +01:00
Nicolas Goaziou 53592f4e25 org-table: Fix typo
* lisp/org-table.el (org-table-show-reference): Fix typo.
2015-01-23 00:16:58 +01:00
Aaron Ecay 9f75cea40d Obsolete ‘org-at-regexp-p’.
* lisp/org.el (org-at-regexp-p): Remove, adding an obsolete function
alias.
(org-in-regexp): Tidy docstring.
(org-open-at-point):
(org-between-regexps-p):
* lisp/org-table.el (org-table-fedit-shift-reference):
(org-table-show-reference): Call ‘org-in-regexp’ instead.
2015-01-22 01:52:49 -05:00
Nicolas Goaziou ef523b0bca org-table: Fix `orgtbl-to-unicode'
* lisp/org-table.el (orgtbl-to-unicode): Remove dummy property.
2015-01-07 00:30:34 +01:00
Nicolas Goaziou 70f965535b org-table: Ignore filters and hooks in radio tables
* lisp/org-table.el (orgtbl-to-generic): Ignore user-defined filters
  and hooks.

* testing/lisp/test-org-table.el (test-org-table/to-generic): Add
  tests.

Suggested-by: Aaron Ecay <aaronecay@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/93795>
2015-01-05 12:39:26 +01:00
Nicolas Goaziou 44744bba2c org-table: Fix freeze with invalid hline reference
* lisp/org-table.el (org-table-find-row-type): Don't end up on the
  last hline, which doesn't exist, per
  e793158bc8.

Reported-by: Artis Rozentāls <artis.rozentals@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/93654>
2014-12-30 22:37:44 +01:00
Nicolas Goaziou 7dc8a1b362 Move `org-do-sort' into "org-table.el"
* lisp/org.el (org-do-sort): Remove function.

* lisp/org-table.el (org-table--do-sort): New function.
(org-table-sort-lines): Use new function.

`org-do-sort' is really a helper function for `org-table-sort-lines',
which applies exclusively on tables.
2014-12-21 22:23:11 +01:00
Jon Snader 71b098702c org.el: Implement user-defined table sorting
* lisp/org.el (org-do-sort): Implement the ?f and ?F sorting options
  to allow user-defined table sorting.  Update the DOC string.

* lisp/org-table (org-table-sort-lines): Add the GETKEY-FUNC and
  COMPARE-FUNC optional parameters and pass them to the call to
  `org-do-sort'.  Update the DOC string.

* doc/org.texi (org-table-sort-lines): Update documentation to reflect
  the addition of the ?f and ?F options.

This patch implements user-defined extraction and comparison functions
for table sorting.  Thanks to Nicolas Goaziou for helpful suggestions.

This patch was discussed on the Org Mode mailing list:
http://article.gmane.org/gmane.emacs.orgmode/93334
2014-12-20 20:36:57 +01:00
Nathaniel Flath 90c047d2ff org-table.el: org-table-recalculate is quieter
* lisp/org-table.el (org-table-recalculate): Removed message for start of
processing.  When ALL is t, messages are printed at most once per second.

TINYCHANGE
2014-12-14 22:06:25 +01:00
Nathaniel Flath 2945c1e8c5 org-table.el: org-table-recalculate early returns
* lisp/org-table.el (org-table-recalculate): Add early return.

TINYCHANGE
2014-12-14 22:06:20 +01:00
Aaron Ecay b8d790a076 org-table: introduce an upper bound on `org-table-convert-region-max-lines'.
* lisp/org-table.el (org-table-convert-region-max-lines): New
defcustom.
(org-table-convert-region): Use it.

This is useful primarily for babel results.  If a large table-like
object is returned by a code block, this function will become bogged
down in trying to read it, and hang emacs (necessitating a C-g).  This
situation most commonly arises when a :results none header has been
omitted.  With the patch, the user will not experience a hang, but
rather an error message.
2014-12-11 23:51:57 -05:00
Aaron Ecay f12e3d4589 org-table: various small fixes
* lisp/org-table.el (org-table-rewrite-old-row-references): Rename function.
(org-table-eval-formula): Update caller.
(org-table--to-generic-cell): Fix typo in string constant.
(orgtbl-to-orgtbl): Properly respect params argument.
2014-12-10 17:03:38 -05:00
Nicolas Goaziou 61a241f0dc Rewrite setup keywords initialization
* lisp/org-table.el (org-table-set-constants): Remove function.
* lisp/org.el (org-set-regexps-and-options): Rewrite function.  Merge
  it with `org-set-regexps-and-options-for-tags'.
(org-set-regexps-and-options-for-tags): Remove function
(org--setup-collect-keywords, org--setup-process-tags): New functions.
(org-mode): Remove `org-set-regexps-and-options-for-tags' call.
(org-agenda-prepare-buffers): Use optimized setup for tags in all
cases.  Improve docstring.
(org-make-options-regexp): Make returned regexp more efficient.
2014-10-28 14:23:52 +01:00
Nicolas Goaziou 0b74864bfb org-table: Do not look after CONSTANTS in Orgtbl mode
* lisp/org-table.el (orgtbl-ctrl-c-ctrl-c): Do not set constants.

Orgtbl provides limited support for Org tables in an arbitrary major
mode.  Any Org syntax outside tables, including keywords, cannot be
supported in this environment.  Therefore there is no point to look
for CONSTANTS keywords.  Moreover, constants can be defined within the
table.

This change allows to move `org-table-set-constants' feature to
`org-set-regexps-and-options' and treat CONSTANTS keyword like any
other keyword (e.g., defining it in a SETUPFILE).
2014-10-28 14:23:52 +01:00
Nicolas Goaziou 7f97406542 Bump Emacs version
* lisp/ob-core.el (org-babel-examplize-region):
* lisp/ob-exp.el (org-babel-exp-inline-code-template):
* lisp/org-table.el (org-table-copy-increment):
(org-table-formula-create-columns):
* lisp/org.el (org-agenda-ignore-drawer-properties):
(org-agenda-ignore-properties):
* lisp/ox-ascii.el (org-ascii-list-margin):
* lisp/ox-html.el (org-html-format-headline-function):
(org-html-format-inlinetask-function):
* lisp/ox-latex.el (org-latex-hyperref-template):
(org-latex-custom-id-as-label):
(org-latex-format-inlinetask-function):
(org-latex-known-warnings):
* lisp/ox-odt.el (org-odt-format-headline-function):
(org-odt-format-inlinetask-function):
* lisp/ox-texinfo.el (org-texinfo-format-headline-function): Bump
  Emacs version.
2014-10-24 11:56:09 +02:00
Thierry Banel 0e07eb5665 Ascii and Gnuplot key-bindings
* org.el (org-mode-map): change key-binding from C-c p to C-c " a add
C-c " g key-binding for Gnuplot
(org-tbl-menu): add sub-menu for plotting featuring Gnuplot and ascii
plot
* org-table.el (orgtbl-setup): add sub-menu for plotting featuring
Gnuplot and ascii plot
2014-10-12 11:25:51 +02:00
Dima Kogan 1c1f91811d org-table: Field formulas can now create columns as needed
* org-table.el (org-table-formula-create-columns): New variable.
(org-table-recalculate): Use the new org-table-formula-make-new-cols
customization to control whether org creates new columns when
a formula explicitly targets them.
2014-10-12 11:11:57 +02:00
Nicolas Goaziou 39eb7796e8 org-table: Fix :raw parameter in radio tables
* lisp/org-table.el (org-table--to-generic-cell): Use
  `org-element-interpret' data when parameter :raw is non-nil so
  pseudo elements and objects are not ignored.

* testing/lisp/test-org-table.el (test-org-table/to-latex): Add test.

Thanks to Giuseppe Lipari for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/91559
2014-10-11 17:10:05 +02:00
Aaron Ecay 5bb58daa22 org-table: fix docstring
* lisp/org-table.el (org-table-get): Fix docstring.
2014-09-19 14:38:23 -04:00
Achim Gratz 1483df8c99 org-table: for compatibility, use org-file-equal-p
* lisp/org-table.el: Predicate function `file-equal-p' is not
  available in older Emacsen, use compatibility function
  `org-file-equal-p' instead.
2014-09-19 10:05:15 +02:00
Michael Brand 739136e17f Table formula: Fix for Lisp return value nil
* lisp/org-table.el (org-table-eval-formula): Substitute `listp' with
`consp'.

* testing/lisp/test-org-table.el (test-org-table/lisp-return-value):
Fix test.
2014-09-14 10:44:28 +02:00
Nicolas Goaziou 9209aa3c9d org-table: Use "ox.el" internally for radio tables
* lisp/org-table.el (org-table-clean-before-export, orgtbl-get-fmt,
  orgtbl-apply-fmt, orgtbl-eval-str, orgtbl-format-line,
  orgtbl-format-section): Remove functions.
(org-table-clean-did-remove-column, *orgtbl-table*, *orgtbl-rtn*,
  *orgtbl-hline*, *orgtbl-sep*, *orgtbl-default-fmt*, *orgtbl-fmt*,
  *orgtbl-efmt*, *orgtbl-lfmt*, *orgtbl-llfmt*, *orgtbl-lstart*,
  *orgtbl-llstart*, *orgtbl-lend*, *orgtbl-llend*): Remove variables.

(org-table-export, orgtbl-send-table): Apply function removal.  Do not
set `org-table-last-alignment' and `org-table-last-column-widths'
anymore.
(org-table-to-lisp, orgtbl-send-replace-tbl): Small refactoring.

(org-table--to-generic-table, org-table--to-generic-row,
org-table--to-generic-cell): New functions.
(orgtbl-to-generic): Rewrite function.  Handle :skip and :skipcols
parameters.
(orgtbl-to-latex, orgtbl-to-html, orgtbl-to-texinfo, orgtbl-to-orgtbl,
orgtbl-to-unicode): Use new `orgtbl-to-generic' features.

* testing/lisp/test-org-table.el (test-org-table/to-generic,
  test-org-table/to-latex, test-org-table/to-texinfo,
  test-org-table/to-html, test-org-table/to-unicode,
  test-org-table/send-region): New tests.

* doc/org.texi (Radio tables, A @LaTeX{} example, Translator
  functions): Update documentation.

* etc/ORG-NEWS (argument): Document new features.
2014-09-13 15:10:26 +02:00
Thierry Banel 851b779d1a org-table: Add ascii plotting in tables
* org-table.el (orgtbl-ascii-plot): Top-level function.
(orgtbl-ascii-draw), (orgtbl-uc-draw-grid), (orgtbl-uc-draw-cont):
Functions which go in table formulas for drawing bars.
* org.el: key binding and menu binding

Thanks to Michael Brand and Nicolas Goaziou for feedback and
enhancements.
2014-08-29 10:00:35 +02:00
Konubinix 7a5f3fb5a5 Make the regexp matching the beginning of a table more explicit
* org-table.el (org-table-get-remote-range): Enhance regexp.

TINYCHANGE
2014-08-22 15:44:20 +02:00
Nick Dokos f15a83ab9f Merge branch 'maint'
Revert commit 79873390ed.
The fix was wrong and gave rise to a different problem - see

    http://thread.gmane.org/gmane.emacs.orgmode/89945
2014-08-20 22:18:07 -04:00
Nick Dokos 50da53de51 Revert "org-clean-before-export matches non-special columns spuriously"
This reverts commit 79873390ed.
The fix was wrong and gave rise to a different problem  - see

   http://thread.gmane.org/gmane.emacs.orgmode/89945

Revert it for now, since there is a workaround for the original
problem and plan on a correct fix in the near future.
2014-08-20 22:14:53 -04:00
York Zhao 12d5d5f775 org-table.el (org-table-eval-formula): Fix variable name typo 2014-07-29 19:27:57 +02:00
Bastien Guerry d4799ebfc1 org-table.el (org-table-eval-formula): Better error throwing
* org-table.el (org-table-eval-formula): Throw an error when
trying to replace a wrong formula specifier.

Thanks to Alejandro Suarez for reporting this.
2014-07-27 15:05:48 +02:00
Nick Dokos db0130468b Merge branch 'maint' 2014-07-23 23:58:13 -04:00
Nick Dokos c9613c0cad When editing a table formula, point is not necessarily on its referent.
* org-table.el (org-table-show-reference): Call `set-window-start'
  with the calculated values `min' and `max', not with
  (point-min) and (point-max).

Reported by Luke Crook (http://article.gmane.org/gmane.emacs.orgmode/88610)
	    Thorsten Grothe (http://thread.gmane.org/gmane.emacs.orgmode/88698)
	    and Robert Klein in the latter thread.

Robert Klein bisected it down to 30220ffcdc.
2014-07-23 23:57:06 -04:00
Nick Dokos 335e97f5ab Merge branch 'maint'
Merge bug fix for org-table.el:org-table-clean-before-export.
2014-07-18 23:47:03 -04:00
Nick Dokos 79873390ed org-clean-before-export matches non-special columns spuriously
* org-table.el (org-table-clean-before-export): The regexes match
  spaces in addition to the special characters that might be used in
  the first column as special marking characters.  Remove the space
  from the character class.

  In addition, the `special' variable included a backslash which
  afaict does nothing: delete it.

  The function itself takes an optional parameter which is not used by
  any of the callers: get rid of it.  Getting rid of it allows a small
  simplification of the code.

The bug was found by Thorsten Grothe:

    http://thread.gmane.org/gmane.emacs.orgmode/88634
2014-07-18 23:44:46 -04:00
Bastien Guerry 4014947f31 Merge branch 'maint' 2014-06-12 12:05:00 +02:00
Bastien Guerry 30220ffcdc Prefer `set-window-start' over `recenter' in some places.
* org-agenda.el (org-agenda-show-1):
* org-table.el (org-table-show-reference):
* org.el (org-fix-ellipsis-at-bol)
(org-first-headline-recenter): Use `set-window-start' instead
of `recenter'.

* org-agenda.el (org-recenter-heading): Delete.
2014-06-12 12:04:24 +02:00
Bastien Guerry 66db8836b5 org-table.el (org-table-copy-down): Fix bug
* org-table.el (org-table-copy-down): When the text above does
not contain a number, fall back on incrementing by one.
2014-05-31 10:47:55 +02:00
Eric Abrahamsen 62950827ec Improve table column narrowing with variable-width strings
org-table.el (org-table-align): Use `org-string-width'.

This aims at better guessing how wide a narrowed table column should
actually be.  This won't work perfectly with variable-width scripts,
as it still only narrows in full-column increments, but it's better
than before.
2014-05-25 07:18:12 +02:00
Eric Abrahamsen 4af31090b4 Use string width in table field justification
org-table.el (org-table-justify-field-maybe): Use
`org-string-width' instead of `length' to calculate the visual
width of table cells.

This is useful for e.g. double-width charsets.
2014-05-25 07:18:06 +02:00
Bastien Guerry dd179e81f3 Minor reformatting 2014-05-24 11:52:36 +02:00
Bastien Guerry d6ac42b6aa Fix previous commit 2014-05-21 18:37:53 +02:00
Bastien Guerry 9c47412981 org-table.el (org-table-copy-down): Fix copying from a blank field
* org-table.el (org-table-copy-down): Fix copying from a blank
field.

Thanks to Michael Brand for reporting this.
2014-05-21 17:48:29 +02:00
Bastien Guerry 74168eea55 Merge branch 'maint' 2014-05-20 22:22:14 +02:00
Bastien Guerry b06dcf05a8 org-table.el (org-table-eval-formula): Fix conversion of inactive timestamps
* org-table.el (org-table-eval-formula): Fix conversion of
inactive timestamps to active ones.

Thanks to Gang Chen for reporting this.
2014-05-20 22:03:30 +02:00
Bastien Guerry d8fdaf89ae Continue enhancing 7ac468
Thanks to Michael Brand for his feedback.
2014-05-20 21:44:37 +02:00
Bastien Guerry b09ba2d4f1 Fix code typo in 7ac468
Thanks to Michael for reporting it.
2014-05-20 18:59:29 +02:00
Bastien Guerry 7ac468ff55 org-table.el (org-table-copy-increment): Change increment behavior
* org-table.el (org-table-copy-increment): Use a number as a
way to force a fixed increment value.
(org-table-copy-down): Increment by the difference between the
current field and the field in the row above.  This is the
default behavior.  To go back to the previous behavior (to
always increment by 1 unit), set `org-table-copy-increment'
to 1.

Thanks to Michael Brand for suggesting this.
2014-05-20 16:07:01 +02:00
Bastien Guerry 132da2db35 Let sort-by-time handle [H]H:MM strings and add a :sort parameter for clocktables
* org-clock.el (org-clocktable-write-default): New parameter
":sort" to sort a column by a sorting type.  E.g., a value of
:sort (1 . ?a) will sort the first column alphabetically.  The
sorting line is the third one, table-wise, which is usually
the first line that contains user data.

* org.texi (The clock table): Document the new :sort
parameter.

* org.el (org-do-sort): Recognize [H]H:MM strings as time
values and allow sort-by-time to process them.

* org-table.el (org-table-sort-lines): Mention that sorting by
time also recognize [H]H:MM time values.
2014-04-16 18:23:47 +02:00
Bastien Guerry 613333d665 Merge branch 'maint' 2014-03-20 15:07:11 +01:00
Bastien Guerry a3ec854cab Fix bugs wrt invisibility handline.
* org-compat.el (org-move-to-column): Always ignore invisible
text in agenda buffer, and when there is both a bracket link
and '(org-link) as a member of `buffer-invisibility-spec'.
Add a docstring.

* org.el (org-align-tags-here): Add docstring and remove
useless arguments when calling `org-move-to-column'.

* org-table.el (org-table-copy-down)
(org-table-find-dataline, org-table-move-row)
(org-table-insert-hline, org-table-kill-row):
* org-agenda.el (org-agenda-next-item)
(org-agenda-previous-item, org-agenda-todo)
(org-agenda-priority, org-agenda-show-new-time)
(org-agenda-clock-in, org-agenda-clock-out): Remove useless
arguments when calling `org-move-to-column'.

This fixes the issue about S-RET not placing the cursor in the right
table field when M-x org-toggle-link-display RET removed '(org-link)
from `buffer-invisibility-spec' and some other discrepancies (like
S-M-<up> not restoring point correctly when there is a bracket link
before point, or M-x org-clock-display RET not aligning overlays
correctly, etc.

Thanks to Matt Lundin and Michael Brand for tracking issues
about this.
2014-03-20 15:04:49 +01:00
Bastien Guerry 0db6b24164 Merge branch 'maint' 2014-02-06 09:58:30 +01:00
Bastien Guerry 323c7b3de2 org-table.el: Fix bugs about cursor repositioning
* org-table.el (org-table-copy-down)
(org-table-find-dataline, org-table-move-row)
(org-table-insert-hline, org-table-kill-row): Use
`org-move-to-column' with the IGNORE-INVISIBLE arg set to `t',
so that abbreviated rows don't interfer with setting the
cursor back at the correct position.

Thanks to Jason Lewis for reporting one of these bugs.
2014-02-06 09:58:17 +01:00