Commit Graph

23347 Commits

Author SHA1 Message Date
Bastien Guerry 416b97b5ca Merge branch 'maint' 2020-09-04 12:12:37 +02:00
Bastien Guerry 60a4e7b3bc lisp/ob-C.el: Don't trim results
This may lead to faulty output.

See <https://orgmode.org/list/CADt3fpPofOUXvrdUNDLJUPKsGTzP9xZ2K1MG9yEonikhbTG03Q@mail.gmail.com>.
2020-09-04 12:11:42 +02:00
Bastien Guerry 3ff8358139 Merge branch 'maint' 2020-09-04 11:35:39 +02:00
Nicholas Vollmer 50c4556977 capture: Document defualt template strings
* lisp/org-capture.el (org-capture-templates): Document default entry
type template strings.

TINYCHANGE
2020-09-04 11:35:32 +02:00
Bastien Guerry 90eb26facd Merge branch 'maint' 2020-09-04 10:08:14 +02:00
Bastien Guerry a3576543f5 org.el: Fix `org-display-outline-path'
* lisp/org.el (org-display-outline-path): Always remove faces when
setting the outline path to display.

See <https://orgmode.org/list/21ef0e94-e766-455c-a45c-fe30e316c121@Spark>
2020-09-04 10:03:48 +02:00
Bastien Guerry 8dc83ef303 Merge branch 'maint' 2020-09-04 09:18:45 +02:00
Joseph Novakovich 7d8247410d ob-J.el: Add ability to customize sit duration
* lisp/ob-J.el (org-babel-execute:J, org-babel-J-eval-string): Add
customizability.

(org-babel-execute:J): Lookup optional parameter `:sit' to allow one
to wait for a specified amount of time before grabbing the output of
the J subprocess.  Pass this specified value or the previous default
of .1 to `org-babel-J-eval-string'.
(org-babel-eval-string): Pass new argument `sit-time' to `sit-for'
before grabbing output.

The problem is that we read the contents of the output after 0.1
seconds, which, for expensive computations, results in the mangling of
output.  Output from expensive computations gets propagated down to
subsequent code-blocks' outputs, producing a horrible mess.

TINYCHANGE
2020-09-04 09:18:38 +02:00
Kyle Meyer 7bc18ebbed ob-core: Avoid table conversion warning for empty results
* lisp/ob-core.el (org-babel-import-elisp-from-file): Don't try to
convert empty file to a table.
* testing/lisp/test-ob.el (test-ob/import-elisp-from-file): Add tests.

If org-babel-import-elisp-from-file is called with an empty file
(which many ob- libraries do when there are no results), feeding that
to org-table-import leads to a beginning-of-buffer error.  Before
14878f3f9 (ob-core: Display warning on failure to read results,
2020-05-21), this error was hard to notice because, after catching it,
it was reported as a quickly buried message.  After that commit, it is
displayed as a warning, which is not appropriate for the common and
unproblematic case of empty results.

Avoid the warning by only doing the table conversion if the file has
content.  Another option would be to do the table conversion but add a
beginning-of-buffer arm to the surrounding condition-case.  However,
that risks swallowing other sources of that error.

Reported-by: Colin Baxter <m43cap@yandex.com>
<https://orgmode.org/list/878se3nhbj.fsf@yandex.com>
2020-09-01 00:02:49 -04:00
Eric S Fraga e8ebf5d6c9 Add other-tab option for org-agenda-window-setup
* org-agenda.el (org-agenda-prepare-window, org-agenda--quit): Handle
other-tab option for agenda view creation and exit.
2020-08-29 08:04:03 -04:00
Jack Kamm 632ceabb14 ob-python: Refactor session evaluation
* lisp/ob-python.el: Require python.el at top-level.
(org-babel-python-eoe-indicator): Remove unused variable.
(org-babel-python-initiate-session-by-key): Rename
python-buffer to avoid obsolete warning.
(org-babel-python-evaluate-external-process): Remove unnecessary
require.
(org-babel-python--exec-tmpfile): Simplify this template.
(org-babel-python--eval-ast): Add printing of results to this
template, requiring additional string escapes.
(org-babel-python-evaluate-session): Simplify to use adjusted
templates, and call out to functionality in python.el or
python-mode.el.
(org-babel-python-evaluate-session): Simplified to use adjusted templates.

This commit refactors and cleans up code related to session
evaluation. python.el is now required at the top-level. Python
templates for wrapping code are simplified. Instead of directly
pasting code to the REPL, functionality from python.el and
python-mode.el are used; this fixes issues with code being echoed to
the REPL, and should be generally more robust. Finally, in the
:results value case, special handling of exceptions is removed, and we
no longer print None when the last statement isn't an expression.
2020-08-28 22:07:56 -07:00
Jack Kamm 30a50d1c0f ob-python: Fix discrepancy of single/multi-line code blocks
* lisp/ob-python.el (org-babel-python-evaluate-session): Fix
discrepancy between how single-line and multiline code blocks return
output.

For example, before this commit, the 2 blocks behaved differently:

+begin_src python :session :results output
  pass
  "foo"
+end_src

+RESULTS:

+begin_src python :session :results output
  "foo"
+end_src

+RESULTS:
: 'foo'

But now, they both behave as the former.
2020-08-28 07:39:06 -07:00
Nicolas Goaziou 66537267eb org-num: Add tests
* testing/lisp/test-org-num.el (test-org-num/skip-numbering): Add
tests. This is a followup to 40474827ea.
2020-08-28 08:45:41 +02:00
Anders Johansson 40474827ea org-num: Fix bug in check for commented headlines
* lisp/org-num.el (org-num--skip-value): Handle empty headlines.

This happens when org-num-skip-commented is non-nil.  When creating
a new headline, often org-num--skip-value is invoked before any
headline text is created. This means that ‘title‘ is nil and the
string-match check breaks. Checking if title is non-nil fixes this.

TINYCHANGE
2020-08-27 11:29:12 +02:00
Kyle Meyer cdfc404bed Merge branch 'maint' into master 2020-08-23 22:39:44 -04:00
Ihor Radchenko 7b657c50e7 org-clock.el: Fix calculated clocking sum in inlinetasks
* lisp/org-clock.el (org-clock-sum-current-item): Do not include
clocked time from the parent when inside inlinetask.

Calling `org-narrow-to-subtree' from inside inlinetask would narrow to
the parent's subtree (correct behaviour).  However, it is not what we
want when calculating the clocking sum.  Inlinetask case should be
treated specially.
2020-08-23 22:38:45 -04:00
Allen Li 76da93aa86 org.el: Don't exclude local tags that are also inherited
This fixes a bug in set-tags-command excluding a tag that is both set
locally and inherited from the initial minibuffer input by modifying
org-get-tags to prefer keeping the locally set tag over the inherited
tag, as this behavior is more intuitive for org-get-tags anyway.

* lisp/org.el (org-get-tags): Keep local tags over inherited.
* testing/lisp/test-org.el (test-org/set-tags-command): Add test.
2020-08-23 22:38:20 -04:00
Christian Vanderwall 312a646fb8 ob-python.el: Fix issue with sessions on remote machines
* lisp/ob-python.el (org-babel-python-evaluate-session): Process
temporary file name with `org-babel-process-file-name' before
inserting it into code Python code snippets.

Before this change, the entire temporary filename was sent to the
Python session for execution, causing a 'No such file' error when the
filename had a Tramp format such as
/ssh:user@server:/tmp/python-ABCDEF.

TINYCHANGE
2020-08-20 18:34:00 -07:00
Kyle Meyer 220f2b0d93 agenda: Fix a docstring's position
* lisp/org-agenda.el (org-agenda-remove-filter): Move docstring to
correct position.
2020-08-17 23:20:05 -04:00
Kyle Meyer 616672c2f3 Merge branch 'maint' into master 2020-08-17 00:12:30 -04:00
Benson Chu bd97851c47 org-clock.el: Update org-clock-out-time from org-resolve-clocks
* lisp/org-clock.el (org-clock-out): If `at-time' was passed, set
org-clock-out-time to that value. Otherwise, set it to now.

TINYCHANGE
2020-08-17 00:11:07 -04:00
Nicolas Goaziou f4687993c5 ox-latex: Fix links to files with name matching an image type
* lisp/ox-latex.el (org-latex-inline-image-rules): Ensure
caracterization happens on extension only.
2020-08-16 12:01:20 +02:00
Nicolas Goaziou 567662d5b0 list: Fix item insertion when split point is near blanks
* lisp/org-list.el (org-list-insert-item): Ignore blanks around cut
position.
* testing/lisp/test-org-list.el (test-org-list/insert-item): Add test.

Reported-by: Samuel Wales <samologist@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2020-08/msg00065.html>
2020-08-16 11:42:53 +02:00
Kyle Meyer 3f04ad8d2c Merge branch 'maint' into master 2020-08-15 13:16:26 -04:00
Nicholas Vollmer 47f26b1e76 org-eldoc: (org-eldoc-documentation-function): set `eldoc-documentation-functions'
* contrib/lisp/org-eldoc.el (org-eldoc-documentation-function):
b2b587387 did not set eldoc-documentation-functions, resulting in
`eldoc--invoke-strategy' throwing a void-function error.

Modified-by: Kyle Meyer <kyle@kyleam.com>
  Added Emacs<25 branch.
2020-08-15 13:09:12 -04:00
Kyle Meyer 5417e384eb Merge branch 'maint' 2020-08-10 20:38:18 -04:00
Nicholas Vollmer ab9b14a80f org.el: (org-get-cursor-date): Fix regular expression
* lisp/org.el (org-get-cursor-date): Fix regular expression.

Previous regular expression assumed the time grid string will have two
digits in the hour portion of the time string.  However, the time grid
string does not always have two digits.  For example:

" 8:00......"
2020-08-10 20:35:36 -04:00
Kévin Le Gouguec 81e2948472 Fix org-fontify-whole-*-line by setting face extension (bug#42184)
* lisp/org-faces.el (org-block): Set background extension beyond
end-of-line.
* lisp/org-compat.el (org--set-faces-extend): New function to
temporarily (re)set :extend for Emacs≥27.
* lisp/org.el (org-mode): Call it to set the extend attribute of
relevant faces to the correct value.
2020-08-10 20:22:25 -04:00
John Herrlin ea946353aa ob-core: file-mode option in source code block arguments
* ob-core.el (org-babel-execute-src-block): Source code block header
argument `:file-mode' can set file permissions if `:file' argument is
provided.
(org-babel-common-header-args-w-values): Add `:file-mode' to common
header arguments.

TINYCHANGE
2020-08-02 22:59:25 -04:00
Kyle Meyer a103f3f3ee Merge branch 'maint' 2020-08-02 22:56:03 -04:00
Nicholas Vollmer 093b474e6a org-list: Operate on single line if no active region
* lisp/org-list.el (org-toggle-item): Operate on single line if no
active region.
2020-08-02 22:55:47 -04:00
Kyle Meyer df5a836375 ob-core: Call org-confirm-babel-evaluate with expanded noweb refs
* lisp/ob-core.el (org-babel-check-confirm-evaluate): Expand noweb
references in the body passed to org-confirm-babel-evaluate.
* testing/lisp/test-ob.el (test-ob/check-eval-noweb-expanded): New
test.

When noweb references are set to be expanded for evaluation,
org-confirm-babel-evaluate should receive the expanded body so that it
can make its decision based on what actually will be evaluated
(without resorting to calling org-babel-get-src-block-info itself).

Note that this results in up to three calls to
org-babel-expand-noweb-references.  Possible ways to avoid this are
discussed at the thread referenced below.

Reported-by: Tom Gillespie <tgbugs@gmail.com>
https://orgmode.org/list/CA+G3_PNi3uMvBiWgBdKuC3C6VJt1T1j-RKH43LRqYbr+4NS8ZA@mail.gmail.com/
2020-08-02 22:55:16 -04:00
Bassam Saeed b395f0abf6 ol.el: Fixed typo
* lisp/ol.el (org-link-parameters): Fixed typo 'ar' to 'are'

TINYCHANGE
2020-08-02 00:07:34 -04:00
Kyle Meyer a1e5bee5cb Merge branch 'maint' 2020-07-29 22:29:10 -04:00
Matt Huszagh 521d7f5fe4 org-manual.org: Modify file-desc header argument to match action
* doc/org-manual.org (Results of Evaluation): Correct description of
how file-desc behaves when no value is given.

TINYCHANGE
2020-07-29 22:24:04 -04:00
Kévin Le Gouguec 0fd9a6ad6c Fix recommendation in 9.4 release notes
Cf. <https://orgmode.org/list/87pn8huuq2.fsf@iki.fi/t/#m4f86f6baf790e88ab905007757487a1f481cc579>.

Reported-by: Jarmo Hurri <jarmo.hurri@iki.fi>

* etc/ORG-NEWS (=RET= and =C-j= now obey ~electric-indent-mode~):
Recommend disabling electric-indent-local-mode rather than
electric-indent-mode, as the latter impacts all buffers rather than
just the newly-created Org buffer.
2020-07-28 21:49:58 -04:00
Nicolas Goaziou 270aa438e2 Fix `org-show-children' error when called before first heading
* lisp/org.el (org-show-children): Fix `org-show-children' error when
called before first heading.
2020-07-27 19:22:46 +02:00
Kyle Meyer 82b496c0e9 Merge branch 'maint' 2020-07-22 23:33:07 -04:00
Leo Vivier c9abb4c29a org: Remove useless example in docstring
* lisp/org.el (org-find-olp): Remove useless example in docstring.

TINYCHANGE
2020-07-22 23:30:58 -04:00
Marco Wahl 7069dc3f32 org: New function to hide the body up to the first child
* lisp/org.el (org-hide-entry): New function. Counterpart to org-show-entry.
2020-07-21 12:14:10 +02:00
Kyle Meyer bb427f7bd6 Merge branch 'maint' 2020-07-18 20:15:32 -04:00
Kyle Meyer b2b587387e org-eldoc: Fix compatibility with Emacs 28
* contrib/lisp/org-eldoc.el (org-eldoc-documentation-function): Accept
and ignore additional arguments for compatibility with Emacs 28.
(org-eldoc-load): Use add-function to register
org-eldoc-documentation-function for Emacs versions 25 through 27, as
documented in eldoc-documentation-function.

See Emacs's fd020a2931 (eldoc: modify `eldoc-documentation-function'
using `add-function', 2014-12-05) and c0fcbd2c11 (Expose ElDoc
functions in a hook (Bug#28257), 2020-02-25) for more information on
the Emacs 25 and Emacs 28 changes, respectively.
2020-07-18 20:14:18 -04:00
Kyle Meyer 05fac0b765 org-macs.el: Silence byte-compiler under 'make single' 2020-07-15 23:37:21 -04:00
Kyle Meyer 454131d228 ob-screen: Quote session name before passing to string-match
* lisp/ob-screen.el (org-babel-screen-session-socketname): Quote
session name before giving it to string-match because the name may
have regexp characters.

While touching the line, make two cosmetic tweaks.
2020-07-15 23:28:00 -04:00
Kenneth D. Mankoff 0ab117bc57 ob-screen: Accept :screenrc header argument
* lisp/ob-screen.el (org-babel-default-header-args:screen): Add
default header argument `:screenrc' and value "/dev/null".
(org-babel-prep-session:screen): Use header argument in variable
`screenrc' and not hard-coded value.
2020-07-15 23:13:44 -04:00
Kenneth D. Mankoff 25bc790be5 ob-screen: Respect :session name. Don't prepend 'org-babel-session-'
* lisp/ob-screen.el (org-babel-prep-session:screen): Remove concat of
"org-babel-session-" string onto session name when creating session.
(org-babel-screen-session-socketname): Remove concat of
"org-babel-session-" string onto session name searching for existing
screen session.
2020-07-15 23:13:44 -04:00
Kenneth D. Mankoff 68b7415146 ob-screen: Execute last line in block (send newline)
* lisp/ob-screen.el (org-babel-screen-session-write-temp-file): Insert
newline after body.
2020-07-15 22:51:46 -04:00
Nicolas Goaziou ddfc469a1a id: Fix error about `agenda-archives'
* lisp/org-id.el (org-id-update-id-locations): Default extra files
also include a special symbol.  Be sure to remove it before calling
`file-truename'.
2020-07-14 19:07:14 +02:00
Nicolas Goaziou 91b2398293 Do not fill paragraph before region
* lisp/org.el (org-fill-paragraph): Do not fill paragraph before
region.
* testing/lisp/test-org.el (test-org/fill-paragraph): Add test.

Reported-by: Matt Lundin <mdl@imapmail.org>
<http://lists.gnu.org/r/emacs-orgmode/2020-07/msg00164.html>
2020-07-14 11:46:38 +02:00
Alexandru-Sergiu Marton fe41103d50 ox: Add Romanian smart quotes
* lisp/ox.el (org-export-smart-quotes-alist): Add Romanian variants for
  smart quotes.

TINYCHANGE
2020-07-13 18:17:37 +02:00