Commit Graph

23337 Commits

Author SHA1 Message Date
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
Kyle Meyer 95eaab7f44 agenda: Fold case when retrieving user-configured effort values
* lisp/org-agenda.el (org-agenda-filter-by-effort):
(org-agenda-filter-completion-function): Ignore case when querying
effort property key in org-global-properties since property keys are
documented as case-insensitive.
2020-07-09 00:33:09 -04:00
Kyle Meyer eac255d911 Merge branch 'maint' 2020-07-08 00:12:06 -04:00
Kyle Meyer e62ca4a1bf org-attach: Fix :type for org-attach-use-inheritance
* lisp/org-attach.el (org-attach-use-inheritance): Drop repeated :type
keyword that incorrectly marked the option as boolean.

Reported-by: Philip Blagoveschensky <philip@crabman.me>
https://orgmode.org/list/7036d668-eb09-ba4d-0b46-503fbc4a50ce@crabman.me
2020-07-08 00:11:34 -04:00
Nick Dokos bc4fa8a008 org: add property names from #+PROPERTY keywords to completion list
* lisp/org.el (org-buffer-property-keys): Enhance the completion list
with property names from #+PROPERTY keywords, not just property
drawers. Also, for each xxx_ALL property, make sure that the bare xxx
property is added too.

* testing/lisp/test-org.el (test-org/buffer-property-keys): Add test
cases for #+PROPERTY keywords and also for xxx_ALL --> xxx properties.

See https://emacs.stackexchange.com/questions/59448/ for details.

Modified-by: Kyle Meyer <kyle@kyleam.com>
  Cosmetic tweaks to _ALL stripping.
2020-07-07 23:37:54 -04:00
Nicolas Goaziou 353e8cc2b7 Fix paragraph filling
* lisp/org.el (org-fill-paragraph): Fix regression introduced in
e2b62b4da8.
* testing/lisp/test-org.el (test-org/fill-paragraph): New test.

Reported-by: stardiviner <numbchild@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2020-07/msg00065.html>
2020-07-07 10:37:35 +02:00
Marco Wahl ab864a29be org: Improve consistency for org-ctrl-c-tab and children folding
* lisp/org.el (org-ctrl-c-tab): Don't move point when acting on
  outline level 0 (which is before first heading). This is consistent to
  the behavior for level > 0. And refactor some. And correct the
  docstring.
2020-07-07 00:39:35 +02:00
Marco Wahl 8b92bcd827 org: Enable org-show-entry before first heading
* lisp/org.el (org-show-entry): Before first heading show the region
  up to the first heading. Remove the now useless ignore-errors.

This behavior allows to reveal invisible text before the first
heading.
2020-07-07 00:12:39 +02:00
Nicolas Goaziou 07a4a72862 list: Fix regression when inserting items
* lisp/org-list.el (org-list-insert-item): Fix splitting item.
* testing/lisp/test-org-list.el (test-org-list/insert-item): Add test.

Reported-by: Duianto - <otnaiud@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2020-07/msg00061.html>
2020-07-06 12:05:18 +02:00
Albert Krewinkel c78db89106 entities: rename section with eth and thorn to "Icelandic"
Eth and thorn are letters in the Icelandic alphabet, and the language
is in active use.

TINYCHANGE
2020-07-05 23:51:40 +02:00
Erik Hetzner ab80b26667 id: Fix behavior when `org-id-extra-files' is a symbol
* lisp/org-id.el (org-id-update-id-locations): When
`org-id-extra-files' is a symbol, it should be evaluated as a
variable.

In 9865e6bd8be65229be4eac4f459f62e47fab2be737a5020bb,
`org-id-update-id-locations' was rewritten, and the functionality to
allow the variable `org-id-extra-files' to be a symbol that references
another variable was removed.  This change restores that
functionality.
2020-07-05 23:47:51 +02:00