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.
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.
* 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.
* 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.
* 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.
* 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.
* lisp/org-table.el (org-table-remote-reference-indirection): Change
the local variable START to a value that will be still valid after
`replace-match'.
* lisp/org-table.el (org-table-remote-reference-indirection): Use the
optional arg START of `string-match' to improve performance and to
avoid endless loop on user error.
* doc/org.texi (References): Add description for indirection of
NAME-OR-ID.
* lisp/org-table.el (org-table-eval-formula): Make use of
`org-table-remote-reference-indirection'.
(org-table-remote-reference-indirection): New function.
* testing/lisp/test-org-table.el
(test-org-table/remote-reference-indirect): Change to use remote
reference indirection.
* org-macs.el (org-autoload): Delete.
* org-docview.el ("docview"): Fix declarations and require
doc-view directly.
* org-id.el (org-id-copy)
(org-id-get-with-outline-path-completion)
(org-id-get-with-outline-drilling, org-id-new):
* org-colview.el:
(org-colview-initial-truncate-line-value)
(org-columns-open-link, org-string-to-number):
* org-clock.el:
(org-clock-put-overlay, org-count-quarter, org-clock-loaded):
* org-archive.el (org-get-local-archive-location):
* org-agenda.el (org-agenda-todo-custom-ignore-p):
Autoload.
Those functions were autoloaded from within calls to `org-autoload'
in org.el, we now autoload them from where they live.
* lisp/org-table.el (org-table-convert-region): Interpret string SEPARATOR
as regular expression. Triple `C-u' prefix arg will read a regexp
from the user.
* doc/org.texi: Document that `C-c |' can take a regexp as a separator.
Patch modified from a proposal by Francois.
* org-table.el (org-table-sum): Fix rounding error when
summing times.
Thanks to Paul Stansell for reporting this and to Nick Dokos for
providing the fix.
See http://mid.gmane.org/87ppv2atvf.fsf%40gmail.com for the
discussion of this bug.
* lisp/ob-core.el (org-babel-get-rownames),
lisp/org-table.el (org-table-transpose-table-at-point): Replace the
inadvertent use of mapcar* (from cl) by plain mapcar and direct cons
manipulation.
The error was not caught at compilation time since both source files
require cl during compilation for using cl macros. These were the
only uses of mapcar* in Org, but I didn't check for other cl
_functions_ (as opposed to macros, which would need to be checked if
their implementation uses cl functions).
* lisp/org.el (org-table-clean-did-remove-column),
lisp/org-table.el (org-table-clean-did-remove-column): Move defvar,
this dynamic variable is only used in org-table.
* lisp/org-table.el (org-table-colgroup-info): Remove unused defvar
for `org-table-colgroup-info'.
(org-table-clean-before-export): Let-bind regular expression strings
and remove unused matching group. Use
`org-table-clean-did-remove-column' in cond statement rather than
branching via if to avoid code duplication. Remove the code
associated with the removed `org-table-colgroup-info'.
(orgtbl-export): Remove unused internal function.
* 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.
* org-table.el (org-table-copy-down): Don't move cursor when
getting the field.
This prevents the point from moving when inadvertently calling
S-RET outside of a table.
(org-table-make-reference): A range with only empty fields should lead
to length 0.
* testing/lisp/test-org-table.el: Adapt expected for several
ert-deftest.
The range len bugs may lead to wrong calculations for range references
with empty fields when the range len is relevant. Affects typically
Calc vmean on simple range and without format specifier EN. Also
Lisp with e. g. `length' on simple range or with L.
It is worth a small compatibility change: For a range with only empty
fields it is now possible and necessary to choose different behaviors
of vmean by adding the format specifiers E and/or N.
This is a follow-up of commit
764315b3fc.
* org-table.el (org-calc-current-TBLFM): Ensure to remove the
currently inserted TBLFM line, when calling `org-table-recalculate'
returns an error and the processing stops.
* testing/lisp/test-org-table.el: Add test.
When you hit =C-c C-c= at the line of "#+TBLFM: $2=$1*2::$2=$1**2" in
| 1 | |
| 2 | |
#+TBLFM: $2=$1*1
#+TBLFM: $2=$1*2::$2=$1**2
you got:
| 1 | |
| 2 | |
#+TBLFM: $2=$1*2::$2=$1**2
#+TBLFM: $2=$1*1
#+TBLFM: $2=$1*2::$2=$1**2
with the error message of:
user-error: Double definition `$2=' in TBLFM line, please fix by hand
In this case, you expected:
| 1 | |
| 2 | |
#+TBLFM: $2=$1*1
#+TBLFM: $2=$1*2::$2=$1**2
* org-table.el (org-calc-current-TBLFM): New function to
re-calculate the table by applying the #+TBLFM in the line
where the point is.
* org.el (org-ctrl-c-ctrl-c): Call `org-calc-current-TBLFM' when
point is in the #+TBLFM line.
* testing/lisp/test-org-table.el: Add test.
* lisp/org-table.el (org-table-eval-formula): Work-around for
calc-eval regression.
Calc-eval can no longer be called without initializing the
*Calculator* buffer first.
* org-table.el (orgtbl-to-generic): New parameter `backend' to
export cells content using a specific backend.
(orgtbl-to-latex, orgtbl-to-texinfo): Export cells to LaTeX
and Texinfo before sending the table.
Thanks to Luca Sabbatini for reporting a problem that led to this change.
* org.el (org-set-regexps-and-options): Use
`org-table-set-constants'.
* org-table.el (org-table-set-constants): New function.
(orgtbl-ctrl-c-ctrl-c): Use it.
Thanks to Oliver Večerník for reporting problems here.
* lisp/org-table.el (org-table-eval-formula): The condition-case to
check for must be "error", not "user-error".
This fixes these test failures:
4 unexpected results:
FAILED test-org-table/references/format-specifier-E
FAILED test-org-table/references/format-specifier-EL
FAILED test-org-table/references/format-specifier-L
FAILED test-org-table/references/format-specifier-none
Reported in:
http://permalink.gmane.org/gmane.emacs.orgmode/67450http://permalink.gmane.org/gmane.emacs.orgmode/67503
* org.el (org-move-subtree-down, org-forward-element)
(org-backward-element):
* org-table.el (org-table-previous-field)
(org-table-move-column, org-table-move-row):
* org-list.el (org-move-item-down, org-move-item-up)
(org-cycle-item-indentation): Use `user-error' when moving or
modifying the element at point is not possible.
* org-table.el (org-table-align): Only set the window start
when table alignment is performed in the selected window.
Thanks to Michael Brand for reporting this.
When opening an .org file from another .org file, org-mode
is initialized in the second one while the window is not yet
selected. So, functions run during org-mode's initialization
need to check if the org-mode window is the selected one before
manipulating the "current window".
* contrib/lisp/org-mime.el (org-mime-htmlize, org-mime-compose): Use
new exporter.
* lisp/ob-haskell.el (org-babel-haskell-export-to-lhs): Use new
exporter.
* lisp/ob-latex.el (org-babel-execute:latex): Use new exporter.
* lisp/ob-org.el (org-babel-execute:org): Use new exporter.
* lisp/org-agenda.el (org-agenda-menu, org-agenda-write): Use new
iCalendar export back-end.
* lisp/org-table.el (org-table-export, orgtbl-export): Remove
dependency on `org-exp' library.
(org-table-clean-before-export): New function.
(org-table-colgroup-info): New variable.
(orgtbl-to-html): Use to new HTML export back-end.
* lisp/org.el (org-modules): Remove modules relative to obsolete
export framework and add those relative to the new one.
(org-create-formula-image-with-dvipng, org-format-latex
org-create-formula-image-with-imagemagick): Use new exporter.
(org-indent-line): INCLUDE keywords are indented like regular
keywords.
(org-mode-map): Bind C-c C-e to new export dispatcher.
(org-menu): Install new exporter in menu.
* doc/org.texi (Formula syntax for Calc): Add explanation and example
for empty field.
* lisp/org-table.el (org-table-eval-formula): Use `keep-empty' in more
places.
(org-table-make-reference): Use nan (not a number) for empty fields in
Calc formulas.
* testing/lisp/test-org-table.el: Adapt expected for several
ert-deftest.
(test-org-table/empty-field): New examples dealing with empty fields.
(test-org-table/copy-field): New ert-deftest with examples dealing with
empty fields.
This makes it possible to write spreadsheet Calc formulas that check
for empty fields: To sum the first two columns unless one or both
empty:
$3 = if("$1" = "nan" || "$2" = "nan", string(""), $1 + $2); E
* lisp/org-table.el (org-table-eval-formula): Keep empty fields during
preprocessing.
(org-table-make-reference): A range with only empty fields should not
always return 0 but also empty string, consistent with field reference
of an empty field. Use future design for nan but replicate current
behavior.
* testing/lisp/test-org-table.el: Adapt expected for several
ert-deftest.
The range len bugs may lead to wrong calculations for range references
with empty fields when the range len is relevant. Affects typically
Calc vmean on simple range and without format specifier EN. Also
Lisp with e. g. `length' on simple range or with L.
* org-table.el (org-table-fedit-lisp-indent)
(orgtbl-self-insert-command): Use `org-delete-backward-char'
instead of `backward-delete-char'.
* org.el (org-delete-backward-char, org-delete-char): Save
match data.
* org.el (org-delete-backward-char, org-delete-char): Save
match data (`delete-backward-char' and `delete-char' don't.)
(org-enable-table-editor, org-insert-heading)
(org-remove-timestamp-with-keyword, org-self-insert-command):
Use `delete-backward-char' instead of `backward-delete-char'.
* org-table.el (org-table-fedit-lisp-indent)
(orgtbl-self-insert-command): Ditto.
* org-latex.el (org-export-latex-subcontent): Ditto.
* org-clock.el (org-clocktable-write-default): Ditto.
* org-ascii.el (org-export-ascii-preprocess): Ditto.
Thanks to Vegard Vesterheim for raising this issue and proposing a patch,
and to Carsten for pointing at the root of the problem.
* org-table.el (org-table-eval-formula): Handle localized
time-stamps by internally converting them to english during
formulas evaluation.
Thanks to Viktor Rosenfeld for suggesting this.
* lisp/org-table.el: added macro org-define-lookup-function and the
calls to this macro that generate the lookup functions
org-lookup-first, org-lookup-last and org-lookup-all
* doc/org.texi: documented lookup functions
* org-table.el (org-table-eval-formula): Convert time-stamps
to inactive time-stamp so that Calc can handle them correctly.
Thanks to Daniel E. Doherty for reporting this.
* org-table.el (org-table-number-regexp): Allow the user to
set it to a new regexp, which allows commas as decimal mark.
The default is to not use this setting, but the one before
commit 7ff8c1, which has ben reverted.
See the discussion here:
http://thread.gmane.org/gmane.emacs.orgmode/59389
* org-table.el (org-table-convert-refs-to-rc): Fix bug when
converting remote table references.
Thanks to Jose E. Marchesi who provided a preliminary patch for this.
* org-table.el (orgtbl-radio-table-templates): Add a template
for org-mode.
(orgtbl-to-orgtbl): Complete and align the table created with
orgtbl-to-orgtbl, in case the user use the function for radio
tables.
(orgtbl-to-table.el): New function to export a table to
another one using the table.el format.
(orgtbl-to-unicode): New function to export a table using
unicode characters.
* org-table.el (org-table-time-string-to-seconds): Return the
empty string if provided.
(org-table-eval-formula): When assigning a duration string,
handle it correctly -- i.e. don't make any computation on it,
except the one to insert it using the correct duration format.
Thanks to Sébastien Vauban for spotting this.
* org-table.el (org-table-store-formulas): Fix typo.
(org-table-maybe-eval-formula): Fix the regexp to only match
formulas, which never end with the `=' character. If the
field only contain this character, don't eval either.
Thanks to Thomas S. Dye for reporting this.
* org-table.el (org-tbl-calc-modes): Rename from
`org-table-modes'.
(org-set-calc-mode, org-table-eval-formula): Use it.
Thanks to Mikkel Kristiansen for reporting this and
to Nick Dokos for tracking down the bug and proposing
a fix.
* org-table.el (orgtbl-to-generic): Add check for :skipheadrule.
When present, the :hline following the head will be skipped. This is
necessary to avoid doubling of horizontal rules in LaTeX longtable
environments and consequent width problems.
* org-latex.el (org-export-latex-tables-tstart)
(org-export-latex-tables-hline)
(org-export-latex-tables-tend): New options.
(org-export-latex-tables): Use the new options.
* org-table.el (orgtbl-send-table): Escape special characters.
Introduce a new parameter :no-escape to prevent escaping.
* org.texi (Radio tables): Document the :no-escape parameter.
Thanks to Alexander Willand for raising this issue.
* org-table.el (org-table-get-range): Fix bug: make sure
references to $0 are correctly handled.
Thanks to Nick Dokos for the suggestion.
This fixes the computation of values in this table:
| Record | Slope | ConfLower | ConfUpper |
|----------+--------------+--------------+--------------|
| GISTEMP | 0.0173837600 | 0.0133209130 | 0.0214466060 |
| HadCrut3 | 0.0158602890 | 0.0118664610 | 0.0198541180 |
See this message/thread:
http://article.gmane.org/gmane.emacs.orgmode/54341
* org-table.el (org-table-recalculate-buffer-tables)
(org-table-iterate-buffer-tables): Add autoload cookie.
Thanks to Sébastien Vauban who suggested adding an autoload
cookie for `org-table-iterate-buffer-tables'.
* org-table.el (orgtbl-self-insert-command): Use
`backward-delete-char' instead of `delete-backward-char' as
this last command gets caught by the compiler which says to
not use it in programs. `backward-delete-char' is just an
alias for `delete-backward-char' which is internally remapped
to `org-delete-backward-char' for optimization purpose.
* org.el (org-self-insert-command): Ditto.
I started from the 78ec8e commit then cherry-picked and squashed
commits that have been done in master since then, except the bad
commits that overwrote the tree (in master) with the tree in maint.
This commit also bumps the version number to 7.8.06.
The only "fix" that was made between 78ec8e and the previous commit
is e0072f which has been reported to break stuff.
This fixes a wrong merge that should not have happened:
commit 7e903a merges the master branch into the maint branch,
while we really want to keep the maint branch a bugfix-only
branch.
This commit reverts back the maint branch to its state before
merging the master branch. From there, we will fix remaining
problems with the maint branch (e.g. copyright issues) then
release this maint branch as Org-mode 7.8.05.
Format for fields which contain the result of a formula.
For example, using \"~%s~\" will display the result within tilde
characters. Beware that modifying the display can prevent the
field from being used in another formula.
Based on an idea of Dov Grobgeld.
* lisp/org-table.el (org-table-formula-handle-first/last-rc): Do not
expand pointers to first/last row/column that are inside a call
to `remote'.
(org-table-get-remote-range): Expand pointers to first/last
row/column.
Wu Feng writes:
> Hello,
>
> First, please check below simple example, I defined two tables (T1 and
> T2). In table-2, I remotely refer to the @>$1 (last row, column 1) and
> $LR2 (last row, column 2) of T1.
>
> #+TBLNAME: T1
> | 11 | 12 |
> | 21 | 22 |
> | 31 | 32 |
>
> #+TBLNAME: T2
> | xxx | xxx | xxx | xxx |
> | # | 21 | 32 | |
> #+TBLFM: @>$3=remote(T1,$LR2)::@>$2=remote(T1,@>$1)
>
> Obviously, the expected results are:
>
> - remote(T1,@>$1) is replaced by 31
> - remote(T1,$LR2) is replaced by 32
>
> But I got 21 for remote(T1,@>$1). The $LR version works perfectly
> (though the manual says $LR is out-dated)
>
> Below are debug info when evaluating remote(T1,@>$1). Looks like @> in
> the remote reference is mapped to the last row of the current table, not
> of the remote table.
>
> Substitution history of formula
> Orig: remote(T1,@2$1)
> $xyz-> remote(T1,@2$1)
> @r$c-> (21)
> $1-> (21)
> Result: 21
> Format: NONE
> Final: 21
>
> Emacs : GNU Emacs 23.3.1 (i686-pc-linux-gnu, GTK+ Version 2.24.6)
> of 2011-09-13 on shirley
> Package: Org-mode version 7.7
Additionally, replace one
(or (org-mode-p) (derived-mode-p 'org-mode))
with
(derived-mode-p 'org-mode)
cause that is reflexive anyway (returns true, if the current mode is
org-mode).
Delete one check testing for org-mode or org derived mode
* lisp/org-table.el (org-table-fix-formulas): Throw error when changing
formula leads to an invalid formula.
This fix catches at least one case, the one described by Nicolas:
> | 1 | 2 | 3 |
> | 1 | 2 | 3 |
> #+TBLFM: @2$1..@2$3=@1
> If I remove the second column (M-S-Left), the formula is correctly
> updated. But when I remove the last column, the formula gets partly
> deleted and becomes:
>
> #+TBLFM: @2$1..
>
* org-table.el (org-table-get-specials): Allow the use of the
underscore character in column names.
(org-table-get-specials): Allow the use of the underscore
character in field names.
Thanks to András Major for bringing this up and to Nick Dokos
for a suggested fix.
Also remove blank lines before the ";;; org*el ends here" declarations.
Having a "Version" header forced us to update every file when releasing a
new version of Org; it also forced us to update every file when merging Org
with Emacs trunk, thus cluttering the diffs between the previously merged
version and the new one with useless information.
Glenn Morris suggested this in emacs-devel:
http://lists.gnu.org/archive/html/emacs-devel/2011-08/msg00322.html
* org-table.el (org-table-eval-formula): Fix missing variable
in let construct.
(org-table-time-string-to-seconds): Fix missing variable in
let construct.
Thanks to John Wiegley for pointing at this.
This allows to display the output of duration computations
as a fraction of days, hours, minutes or seconds.
Thanks to Daniel E. Doherty for bringing up this need.
* org-table.el (org-table-duration-custom-format): New
defcustom to select output format of durations computations.
(org-table-time-seconds-to-string): Use the new variable.
(org-table-eval-formula): Allow `t' as a flag, on top of `T'.
`t' will use the custom output format defined in
`org-table-duration-custom-format.
* org-table.el (org-table-eval-formula): Fix bug when a
formula "range" is just one cell.
(org-table-time-string-to-seconds): don't check whether
we manipulate a string.
* org-table.el (org-table-time-string-to-seconds): match
either HH:MM:SS or HH:MM (instead of MM:SS).
Thanks to Gustav Wikström for suggesting this change.
* org-table.el (org-table-eval-formula): Throw an error when
trying to replace complex range with invalid references.
Thanks to Ken Williams for pointing this out.
* install/git/org-mode/lisp/org-table.el
(org-table-time-seconds-to-string): use `org-format-seconds'
instead of `format-seconds'.
* install/git/org-mode/lisp/org-macs.el (org-format-seconds):
handle case where `format-seconds' does not exist.
* install/git/org-mode/lisp/org-table.el
(org-table-time-string-to-seconds)
(org-table-time-seconds-to-string): New functions.
(org-table-eval-formula): Implement the "T" (time) flag for
computing durations.
* lisp/ob.el (org-babel-sha1-hash): Adding optional argument KIND to
all org-called-interactively-p function invocations.
* lisp/org-agenda.el (org-agenda-redo): Adding optional argument KIND to
all org-called-interactively-p function invocations.
(org-agenda-show-1): Adding optional argument KIND to all
org-called-interactively-p function invocations.
(org-agenda-set-tags): Adding optional argument KIND to all
org-called-interactively-p function invocations.
* lisp/org-ascii.el (org-export-as-latin1): Adding optional argument
KIND to all org-called-interactively-p function invocations.
(org-export-as-latin1-to-buffer): Adding optional argument KIND to
all org-called-interactively-p function invocations.
(org-export-as-utf8-to-buffer): Adding optional argument KIND to all
org-called-interactively-p function invocations.
(org-export-region-as-ascii): Adding optional argument KIND to all
org-called-interactively-p function invocations.
* lisp/org-docbook.el (org-export-region-as-docbook): Adding optional
argument KIND to all org-called-interactively-p function
invocations.
* lisp/org-html.el (org-export-region-as-html): Adding optional
argument KIND to all org-called-interactively-p function
invocations.
* lisp/org-latex.el (org-export-region-as-latex): Adding optional
argument KIND to all org-called-interactively-p function
invocations.
* lisp/org-table.el (org-table-blank-field): Adding optional argument
KIND to all org-called-interactively-p function invocations.
(org-table-current-column): Adding optional argument KIND to all
org-called-interactively-p function invocations.
(org-table-current-dline): Adding optional argument KIND to all
org-called-interactively-p function invocations.
(org-table-sort-lines): Adding optional argument KIND to all
org-called-interactively-p function invocations.
(org-table-sum): Adding optional argument KIND to all
org-called-interactively-p function invocations.
(org-table-rotate-recalc-marks): Adding optional argument KIND to
all org-called-interactively-p function invocations.
(org-table-eval-formula): Adding optional argument KIND to all
org-called-interactively-p function invocations.
(orgtbl-send-table): Adding optional argument KIND to all
org-called-interactively-p function invocations.
* lisp/org.el (org-mode): Adding optional argument KIND to all
org-called-interactively-p function invocations.
(org-copy-subtree): Adding optional argument KIND to all
org-called-interactively-p function invocations.
(org-paste-subtree): Adding optional argument KIND to all
org-called-interactively-p function invocations.
(org-store-link): Adding optional argument KIND to all
org-called-interactively-p function invocations.
(org-todo): Adding optional argument KIND to all
org-called-interactively-p function invocations.
(org-occur): Adding optional argument KIND to all
org-called-interactively-p function invocations.
Interactive-p is an obsolete function as of Emacs 23.2.
`org-called-interactively-p' takes care of the current (x)Emacs
version and use either `interactive-p' (for XEmacs and Emacs<23.2)
or `called-interactively-p'.
* lisp/org-agenda.el (org-agenda-redo): Replacing call to now-defunct
function `interactive-p'.
(org-agenda-show-1): Replacing call to now-defunct function
`interactive-p'.
(org-agenda-set-tags): Replacing call to now-defunct function `interactive-p'.
* lisp/org-ascii.el: Replacing call to now-defunct function
`interactive-p'.
(org-export-as-latin1): Replacing call to now-defunct function
`interactive-p'.
(org-export-as-latin1-to-buffer): Replacing call to now-defunct
function `interactive-p'.
(org-export-as-utf8): Replacing call to now-defunct function
`interactive-p'.
(org-export-as-utf8-to-buffer): Replacing call to now-defunct function
`interactive-p'.
(org-export-region-as-ascii): Replacing call to now-defunct function
`interactive-p'.Replacing call to now-defunct function `interactive-p'.
* lisp/org-docbook.el: Replacing call to now-defunct function
`interactive-p'.
(org-export-region-as-docbook): Replacing call to now-defunct function
`interactive-p'.Replacing call to now-defunct function `interactive-p'.
* lisp/org-html.el: Replacing call to now-defunct function
`interactive-p'.
(org-export-region-as-html): Replacing call to now-defunct function
`interactive-p'.Replacing call to now-defunct function `interactive-p'.
* lisp/org-latex.el: Replacing call to now-defunct function
`interactive-p'.
(org-export-region-as-latex): Replacing call to now-defunct function
`interactive-p'.Replacing call to now-defunct function `interactive-p'.
* lisp/org-macs.el: Replacing call to now-defunct function
`interactive-p'.
(org-called-interactively-p): Replacing call to now-defunct function
`interactive-p'.Replacing call to now-defunct function `interactive-p'.
* lisp/org-table.el: Replacing call to now-defunct function
`interactive-p'.
(org-table-blank-field): Replacing call to now-defunct function
`interactive-p'.
(org-table-current-column): Replacing call to now-defunct function
`interactive-p'.Replacing call to now-defunct function
`interactive-p'.
(org-table-current-dline): Replacing call to now-defunct function
`interactive-p'.Replacing call to now-defunct function
`interactive-p'.
(org-table-sort-lines): Replacing call to now-defunct function
`interactive-p'.
(org-table-sum): Replacing call to now-defunct function
`interactive-p'.
(org-table-rotate-recalc-marks): Replacing call to now-defunct
function `interactive-p'.
(org-table-eval-formula): Replacing call to now-defunct function
`interactive-p'.
(orgtbl-send-table): Replacing call to now-defunct function `interactive-p'.
* lisp/org.el: Replacing call to now-defunct function `interactive-p'.
(org-mode): Replacing call to now-defunct function `interactive-p'.
(org-copy-subtree): Replacing call to now-defunct function
`interactive-p'.
(org-paste-subtree): Replacing call to now-defunct function
`interactive-p'.
(org-store-link): Replacing call to now-defunct function
`interactive-p'.
(org-todo): Replacing call to now-defunct function `interactive-p'.
(org-occur): Replacing call to now-defunct function `interactive-p'.
* org.el (org-self-insert-command): Use `delete-char' instead of
`delete-backward-char'.
* org-table.el (orgtbl-self-insert-command): Dto.
According to the doc string `delete-backward-char' "is meant for
interactive use only; from Lisp, better use `delete-char' with a
negated argument."
* doc/org.texi (Built-in table editor): Document the table field follow mode.
* lisp/org-table.el (org-table-exit-follow-field-mode-when-leaving-table):
New option.
(org-table-check-inside-data-field): New optional argument `noerror'.
When set, the function will only return nil instead of throwing an
error.
(org-table-edit-field): Interpret double prefix argument, and improve
the properties of the editing window.
(org-table-follow-field-mode): New minor mode.
(org-table-follow-fields-with-editor): New function.
The main purpose of this functionality is to make working with table
with long fields simpler, by always showing the full content of the
current field. This functionality is based on the following
mailing list thread
http://thread.gmane.org/gmane.emacs.orgmode/41584
and contains ideas by Jonny, Juan Pechiar, and Michael Brand.
* lisp/org-table.el (org-table-cleanup-narrow-column-properties): Use
point-min rather than 1 when moving in the buffer.
Signed-off-by: Julien Danjou <julien@danjou.info>
* org-table.el (org-table-fix-formulas-confirm): new custom
variable.
(org-table-insert-column, org-table-delete-column)
(org-table-move-column, org-table-move-row)
(org-table-insert-row, org-table-kill-row): Use it.
* lisp/org-table.el (org-table-eval-formula): Treat relative column refs.
I cannot believe this did not work and nobody complained about this.
$-1 is supposed to refer to the value in the column to the left. Now
this does work.
* lisp/org-table.el (org-table-fedit-finish): Read more general LHS of formulas.
(org-table-formula-handle-@L): New function to hanle @L references.
(org-table-current-ncol): New variable.
(org-table-line-to-dline): New function.
(org-table-get-stored-formulas): Accept range formulas as matches.
(org-table-get-specials): Compute and store the number of columns.
(org-table-get-range): New optional argument CORNERS-ONLY, to retrieve
only the region marked by the range, not the content.
(org-table-recalculate): Call `org-table-expand-lhs-ranges' to expand
range targets. Also check for duplicate access to fields.
(org-table-expand-lhs-ranges): New funktion.
(org-table-get-remote-range): Bind `org-table-current-ncol' to protect
the caller's value.
(org-table-edit-formulas): Support highlighting of range targets.
(org-table-field-info): Handle renge formulas.
* doc/org.texi (Field and range formulas): Renamed from "Field formulas".
Document the use of range operators as targets.
(References): Document the new @L reference.
* lisp/org-table.el (orgtbl-after-send-table-hook): New hook.
(orgtbl-ctrl-c-ctrl-c): Run `orgtbl-after-send-table-hook' when a
table was sent.
(orgtbl-send-table): Return the number of sent tables, or nil if no
sending has happened.
Patch by Seweryn Kokot. TINYCHANGE
* doc/org.texi: Document the <c> cookie.
* lisp/org-exp.el (org-store-forced-table-alignment):
(org-export-remove-special-table-lines): Allow the "c" cookie for
table alignment.
* lisp/org-html.el (org-export-table-header-tags):
(org-export-table-data-tags): Add another %s format for the alignment.
(org-export-html-table-align-individual-fields): New option.
(org-format-org-table-html): Implement field-by-field alignment and
support centering.
(org-format-table-table-html): Make sure the new table tag formats
don't break this function.
* lisp/org-table.el (org-table-cookie-line-p):
(org-table-align): Allow for the <c> cookie.
* lisp/org.el (org-set-font-lock-defaults): Allow for the <c> cookie.
* lisp/org-table.el (org-table-convert-region): don't continue csv
importation which the point catches the end, this fixes an infinite
loop which was caused by the (point) never catching up with the
"end" marker
Hi,
I've just noticed that I get an infinite loop when importing csv tables
into Org-mode tables. For example calling
(org-table-convert-region (point-min) (point-max) '(4))
from inside of a simple text file containing the following
--8<---------------cut here---------------start------------->8---
1,2,3
1
2
3
5
--8<---------------cut here---------------end--------------->8---
results in an infinite loop. The attached patch fixes this issue [1],
however it seems weird that this would just surface now, given that the
code in question has been in the repo since last fall
,----
| commit 59c9c4cdd4
| Author: Carsten Dominik <carsten.dominik@gmail.com>
| Date: Mon Oct 26 12:31:16 2009 +0100
|
| Correctly interpret CVS tables with quoted fields
|
| The csv parser was very primitive, ignoring quoted fields. This is
| now fixed.
`----
Has anyone else noticed this problem? Should I go ahead and apply this
patch?
Best -- Eric
Footnotes:
[1]
>From 3c3f4ca9a34dca23051ca2f4e4518b416338d4f4 Mon Sep 17 00:00:00 2001
From: Eric Schulte <schulte.eric@gmail.com>
Date: Mon, 19 Jul 2010 13:45:25 -0700
Subject: [PATCH] org-table: fix infinite loop in table importation
* lisp/org-table.el (org-table-convert-region): don't continue csv
importation which the point catches the end, this fixes an infinite
loop which was caused by the (point) never catching up with the
"end" marker
This is the fifth patch in a series that makes some straightforward
corrections to a number of docstrings. Each change is normally to:
- correct a typo, or
- fix up hyperlinks to function or variable names, or
- ensure slightly better conformance with the documentation guidelines
and tips given in the Elisp manual
No attempt is made to provide missing docstrings or document arguments.
Cheers,
Phil
This patch changes the functionality of orgtbl-to-orgtbl so that it will
remove newline characters from the text of table cells and replace them
with "\n". This protects the final table from such newlines.
This patch will probably only have any noticeable effect for tables
imported form external files, or from the results of code blocks.
Best -- Eric
>From 34aacc9aa037e8f17c8d32ed61a25f0a350713a0 Mon Sep 17 00:00:00 2001
From: Eric Schulte <schulte.eric@gmail.com>
Date: Fri, 18 Jun 2010 12:38:26 -0700
Subject: [PATCH] org-table: will now strip newlines from the text of table cells
* lisp/org-table.el (orgtbl-to-generic): added the :remove-newlines
option which will strip newline characters from the text of table
cells and replace then with "\n"
(orgtbl-to-orgtbl): now using the new :remove-newlines option to
orgtbl-to-generic
* lisp/org.el (org-edit-special): Make sure source code editing goes
before table formula editing.
* lisp/org-table.el (org-table-fedit-map): "C-c '" will now also exit
the formula editor.
* lisp/org-compat.el (org-string-match-p):
(org-looking-at-p): New functions.
* lisp/org-table.el (org-table-align): Handle raised text with
invisible characters.
* lisp/org.el (org-script-display): Add raise properties for tables.
(org-raise-scripts): Handle raising differently inside tables.
Pretty display of subscripts and superscripts no longer messes up
table alignment. This is achieved by two things:
1. Inside tables, the raised characters are not made smaller, they
remains at the same size. Instead they are raise/lowered more, by
a full half character height to still be clearly readable as
subscript or superscript.
2. The invisible characters are taken into account when computing the
field width.
Karl Eichwalder writes:
> Consider the following two files:
>
> * 2009
> #+TBLNAME: 2009
> :PROPERTIES:
> :ID: ea32e5b5-31ba-468e-8e31-3e0d09696bb0
> :END:
> |-----+-------|
> | mm | km |
> |-----+-------|
> | all | 946.8 |
> |-----+-------|
>
> * 2010
> #+TBLNAME: 2010
> :PROPERTIES:
> :ID: e0df84c4-8abc-458f-a1ee-eb53eb71b4f0
> :END:
> |-----+-------+-------+-------|
> | mm | km | B km | G km |
> |-----+-------+-------+-------|
> | all | 249.4 | 429.2 | 678.6 |
> |-----+-------+-------+-------|
>
> * all
> :PROPERTIES:
> :ID: 44751a7f-73a4-4c07-b3c2-e3edb9042acd
> :END:
> #+TBLNAME: all
> |------+--------|
> | yyyy | km |
> |------+--------|
> | 2009 | |
> | 2010 | 678.6 |
> |------+--------|
> | all | 1625.4 |
> |------+--------|
> #+TBLFM: @2$2=remote(ea32e5b5-31ba-468e-8e31-3e0d09696bb0,$LR2);%.1f::@3$2=remote(2010,$LR4);%.1f::$LR2=vsum(@2$2..@-1);%.1f
>
> Then, in the 2010 file, eval the formula of the "all" table by pressing
> C-c C-c.
> ==>
>
> It takes the km value from the 2009 file, but also puts the cursor
> (point) into the 2009 file in front of the ID:
>
> * 2009
> #+TBLNAME: 2009
> :PROPERTIES:
> :ID: -!-ea32e5b5-31ba-468e-8e31-3e0d09696bb0
> :END:
> |-----+-------|
> | mm | km |
> |-----+-------|
> | all | 946.8 |
> |-----+-------|
>
> -=-=-=-=-=-=-=-=-=-=-=-=-=- cut here -=-=-=-=-=-=-=-=-=-=-=-=-=-
>
> I'd prefer if the point would stay in the 2010 file.
Willian Henney writes:
> The following is using today's git trunk of org-mode with emacs
> 23.1.94.1 (aquamacs 2.0preview5)
>
> Consider the following table
>
> | -8 |
> | |
> | |
> | |
> #+TBLFM: $1=@-1 - 1::@1$1=-8
>
> Evaluate formulas once (C-u C-c *):
>
> | -8 |
> | -9 |
> |----|
> | -1 |
>
> Evaluate formulas again (C-u C-c *):
>
> | -8 |
> | -9 |
> |----|
> |----|
>
> What I expected:
>
> | -8 |
> | -9 |
> | -10 |
> | -11 |
>
> The problem always seems to start at -10. When I turn on table
> debugging, it first calculates the -10 value correctly, but then fails
> to recognise the -10 cell as a number when calculating the next row,
> using 0 instead, which results in -1. This is because during the
> intermediate formatting of the cell the minus sign in -10 abuts the
> column separator: "|-10 |", and the "|-" part is then interpreted as
> the beginning of an hline.
William Henney writes:
> Anyone have a clue what is going on here?
>
> Cheers
>
> Will
>
> * Arctan2 bug
> Activate the formula editor for the following table with =C-c '=, then
> exit without changing anything. Note what happens to the arctan2
> formula. For me, "arctan2" changes to "@2$20173232".
> | x | y | arctan | arctan2 |
> |---+---+--------+---------|
> | 1 | 1 | 45 | 45. |
> #+TBLFM: $3=arctan($1/$2)::$4=arctan2($1,$2)
>
> ** Versions
> Org 6.34trans, Aquamacs 2.0preview4, Emacs 23.1.92.1
Dan Davison writes:
> If a file contains "-1" followed by a newline and nothing else,
> org-table-import on that file fails. The first commit with this
> property is a commit (below) to do with CVS tables made a few
> days ago. I have given up trying to work out a good solution to
> this :) In case it is useful, the failure occurs when
> org-table-align is called at the end of
> org-table-convert-region. I think it is long-standing behaviour
> that hitting tab inside of
>
> |-1|
>
> doesn't make a table containing "-1", so presumably there is
> something different about the context in which org-table-align is
> now being called.
Francesco Pizzolante writes:
> I'm using orgmode 6.30c and I still have this problem: if
> the #+TBLNAME: tag is not located in column 0, the remote
> reference does not work.
>
> Here's my little test:
>
> #+TBLNAME: A
> | | T |
> |---+-------|
> | | 2.00 |
> | | 5.00 |
> |---+-------|
> | # | 9.00 |
> | ^ | total |
> #+TBLFM: $2=vsum(@-I..@-II);%.2f
>
> #+TBLNAME: price
> | T | PU | Total |
> |------+-------+-------|
> | 9.00 | 10.25 | 92.25 |
> |------+-------+-------|
> #+TBLFM: @2$1=remote(A,$total);%.2f::@2$3=$1*$2;%.2f
>
>
> Just add a few spaces at the first line and when you recompute
> the second table you get a "Can't find remote table A" message.
>
> Moreover, in a LaTeX environment, using the orgtbl minor mode,
> the highlighting (font locking) does not work on the #+TBLNAME:
> line, even if located in column 0.
Michael Brand writes:
> First, when I open a file with the content
>
> -*- eval: (org-mode) -*-
> #+STARTUP: align
> | <l8> |
> | 3.14 |
> | 3.1415926535897932384626433832795 |
>
> and answer yes, I get
>
> -*- eval: (org-mode) -*-
> #+STARTUP: align
> | <l8>| <l8> |
> | 3.14 |
> | 3.1415=> |
>
> but would expect
>
> -*- eval: (org-mode) -*-
> #+STARTUP: align
> | <l8> |
> | 3.14 |
> | 3.1415=> |
>
> Second, when I delete the last line and save the file, the file content
> will be
>
> -*- eval: (org-mode) -*-
> #+STARTUP: align
> | <l8>| <l8> |
> | 3.14 |
>
> as I can see e. g. with emacs itself when I close the file and open it
> again declining org-mode with answering no. But the file content should
> be
>
> -*- eval: (org-mode) -*-
> #+STARTUP: align
> | <l8> |
> | 3.14 |
>
> Can someone please confirm with a more stable and recent emacs version?
Karl Stump writes:
> Table Editing Cycle With Multiple Windows On One Buffer Does Not
> Return to Start State
>
> When I have two windows open on two buffers, one to a table in a
> file that I'm editing, the other to some other file of interest,
> the editing cycle of C-` ... C-c C-c works great, meaning that
> when the cycle is finished, the windows are restored to the start
> state.
>
> But when I have two windows open on the same buffer, one window
> on the table, and the other window somewhere else, the editing
> cycle does not restore to the beginning state.
Gregory Grubbs writes:
I like to make org-mode tables in arbitrary buffers, then
save them as CVS files. The export fails when done from a
buffer with no associated file.
Here's a little patch that allows exporting a table from
any buffer (org-mode version 6.28trans):
A relative row reference like @-1 in a table may now reach across a
horizontal separator line. I hope this will not break any important
tables out there, but I think it is the right thing to do.
The original reason for not-crossing was to implement running
averages of one column in the next. This can now be done using field
formulas near the beginning and end of the column, and a column
formula for the central part.
See the variable `org-table-relative-ref-may-cross-hline' for more
details.
Michael Brand writes:
> 2) One could like to have configurable left/right alignment, even
> combinable with column width, e. g.
>
> | <l10> | <r> |
> | 3.14 | 0x10 |
> | 3.141592=> | 0x32 0x10 |
Good idea, I would say.
When yasnippet is active, it is the official binding of TAB. That
means, the org-mode self-insert command must know that it may blank
table fields if the last command was yas/expand.
Rares Vernica writes:
> I think the standard references do not work correctly in the
> "remote" function. Moreover, the "edit all formulas" (C-c ')
> window replaces the internal references with standard
> references. Even if I toggle the references back to internal
> ones, the references in the "remote" function do not get
> updated.
>
> Here is an example:
>
> #+TBLNAME: TableA
> | 101 |
> #+TBLFM: @1$1=remote(TableC,@1$1)
>
> #+TBLNAME: TableB
> | A1 |
> #+TBLFM: @1$1=remote(TableC,A1)
>
> #+TBLNAME: TableC
> | 101 |
>
> If I do C-c * in TableA, it works correctly. In TableB it
> doesn't. If I do C-c ' in TableA and then (with or without
> C-c C-r) C-c C-c and C-c *, then the contents of TableA will
> be equivalent to the ones of TableB and the reference will
> be broken.
Standard references like A1 are now allowed in call to
remote().
Rares Vernica writes:
> I think I found another bug related to remote
> references. When I insert/remove a row/column using the
> table commands, the remote references to other tables are
> also updated. I think org treats "remote" as a regular
> function and updates the references inside it.
>
> Here is an example:
>
> #+TBLNAME: TableA
> | 101 |
> #+TBLFM: @1$1=remote(TableB,@1$1)
>
> #+TBLNAME: TableB
> | 101 |
>
> If I go in the cell of TableA and do M-S-down arrow, I get
> the following:
>
> #+TBLNAME: TableA
> | |
> | 101 |
> #+TBLFM: @2$1=remote(TableB,@2$1)
> ^^^^
>
> As you can see the remote reference has been updated. I
> similar update happens when I remove a row or insert/remove
> a column.
This commit makes sure that references inside calls to
remote() are not touched.
Undo will now remove up to 20 characters typed consecutively, just
like Emacs normally does. We need a special implementation for this
because Org has its own self-insert command.
The code for doing this is a patch by Martin Pohlack.
Formulas can now refer to fields and regions in other tables, be it in
the same file or even in different files.
This also opens the door for more interesting R support, because
arbitrary tables in a file can now be accessed with appropriate
commands.
Finally, this commit also introduces a convenience for creating
references in tables. For the purpose of references, it will always
be *assumed* that there is another hline at the end if each table. So
for example in a table that has only a single hline, to separate
header from data, you can now access all of column two with
"@I$2..@II$2".
In a recent patch we have introduced names for all fields in the last
row. This has lead to a bug, that Org thinks there might be a field
formula associated with those fields. Now we check if there really is
one, and only in this case ask to overwrite it with a column formula.
Report by Henry Atting.
After the failed implementation of `@0' as a reference for the last
line, this is a second attempt to provide such references. I would
have liked to allow `@last' as the reference, that would have been
beautiful. However, too many regular expressions directly search for
`@' followed by a number, so this is too hard to implement.
Therefore, I am now turning the last row into a row of implicitly
named fields. From now on, $LR1, $LR2,... can be used to refer to
fields in the last row. These names may also appear on the left hand
side of formulas.
Exporting tables to LaTeX suffered from the problem that Org tables
are often long, but that the tabular environment in LaTeX cannot
handle long tables. This patch fixes this issue.
LaTeX export can now deal with very long tables, by setting an option
in the "ATTR_LaTeX:" line. Also, you can specify the alignment by
hand. Here is an example:
Also, table export now correctly deals with tables that start with a
hline. In such a case, also the LaTeX version will have this extra
hline before the first line.
The last data line in a table is often a line with important data, for
example sums of a column. In tables with varying length, the row
number of this line is constantly changing, which makes it hard to
write programs creating tables and then installing formulas.
This patch introduces @0 as a special reference to the last row, so
that @0$3 would be the field in the last row, 3rd column.
Tassilo Horn asked for this, because he finds the default behavior of
silently choosing a different row too confusing. I actually do agree.
The main use of this feature was running averages, if you need this
feature, you can customize the variable
`org-table-error-on-row-ref-crossing-hline'.
This key needs special treatment, because it needs to work *outside*
tables. The patch introduces a special command to call the
creation/conversion function if there is no conflicting binding to
`C-c |' outside of orgtbl-mode.
S-SPC did lead to an error in orgtbl-mode, because there is no binding
to this key. Now orgtbl-self-insert-command falls back on calling
self-insert-command for such cases.
RET did fail in orgtbl-mode, if the cursor was at the beginning of the
buffer. Now it opens a new line whenever the cursor is at the
beginning of a line, and that includes the beginning of the buffer.....
These are changes that where made in the Emacs CVS.
The change in org-publish is not final, it is still being
discussed - however, the current change should make it possible
to compile and run the code with the latest CVS version of Emacs.
So far, Org used either `fit-window-to-buffer' or
`shrink-window-if-larger-than-buffer' without any further checks when
displaying one of its many help and selection buffers. This can cause
problems if the user has set up Emacs to split windows horizontally
rather than vertically, because the window being shrunken then may be
side-by-side with another window, and shrinking the height of one will
also change the other.
With this patch, shrinking a window always goes through the new
function `org-fit-window-to-buffer' which only acts if the current
window spans the whole width of the frame.
Furthermore, this function also helps with compatibility, because it
falls back to `shrink-window-if-larger-than-buffer' if
`fit-window-to-buffer' does not exist, as is the case on older version
of Emacs and XEmacs.