Commit Graph

15828 Commits

Author SHA1 Message Date
Nicolas Goaziou 041138e47c Remove `org-export-link-as-file'
* lisp/ol.el (org-link-parameters): Remove reference to the function.
* lisp/ox.el (org-export-link-as-file): Remove function.
* testing/lisp/test-ox.el (test-org-export/link-as-file): Remove test.

The current implementation is not satisfactory, and not useful in the
code base. Using a pre-export hook turning custom link type into
"file" is enough for now. See "attachement" links for an example.
2020-02-28 01:30:30 +01:00
Gustav Wikström 0e0df5abf3 attach: translate directly as file links during export
* lisp/org-attach.el (org-attach-expand-links): translate directly as
file links during export.
2020-02-28 01:27:47 +01:00
Nicolas Goaziou 7707f898a1 ol: Fix opening file link with a starred search option
* lisp/ol.el (org-link-open-as-file): Fix logic so initial regexp is
matched against the file-name only, not the search option.
2020-02-26 16:29:32 +01:00
Bastien 30d0b6e1f6 org.el: Tiny enhancements `org-format-latex-as-html'
* lisp/org.el (org-create-math-formula): Use `warn'.
(org-format-latex-as-html): Don't set a free variable, return
the string directly.
2020-02-24 11:43:45 +01:00
Bastien e062ca7199 org.el: Use `defalias' for priority aliases.
* lisp/org.el (org-highest-priority, org-lowest-priority)
(org-default-priority): Use `defalias'.
2020-02-24 11:41:33 +01:00
Bastien 3a543a981b Enhancements to `org-latex-to-html-convert-command'
* lisp/org.el (org-latex-to-html-convert-command): Fix option.

* etc/ORG-NEWS: Document `org-latex-to-html-convert-command'
as a new option.
2020-02-24 11:21:40 +01:00
Matt Huszagh 860cfe7f13 Add an option to convert LaTeX fragments to HTML
* lisp/org.el (org-latex-to-html-convert-command): New option to
convert a LaTeX fragment directly into HTML.
(org-format-latex): Use the new option.
(org-format-latex-as-html): Do the conversion and return HTML.
* lisp/ox-html.el (org-html-with-latex): Document the 'html symbol.
(org-html-format-latex): This custom HTML conversion, like MathJax,
doesn't require preprocessing.
(org-html-latex-fragment): Use the new option.

This allows you to set a custom command
`org-latex-to-html-convert-command' that will take as input a LaTeX
fragment and use it to generate HTML for export.  This is very
open-ended in the sense that you can use any shell-command you
want.  This has been added in order to use latexml, but you could
use any other tool that generates HTML output text.
2020-02-24 11:16:01 +01:00
Bastien f56f2b323a org-id.el: Fix typo in comment
* lisp/org-id.el (org-id-find-id-file): Fix typo in comment.
2020-02-23 14:30:02 +01:00
Nicolas Goaziou a63073ec04 Move obsolete aliases into "org-compat.el" 2020-02-23 12:57:07 +01:00
Nicolas Goaziou ee0dba6402 Small fix to headline search string
* lisp/ol.el (org-link-heading-search-string):
(org-link-search):
* lisp/ox.el (org-export-search-cells): Replace statistics cookies
with a space before squeezing spaces so as to handle properly, e.g.,
"wordCOOKIEword".
2020-02-23 12:51:07 +01:00
Nicolas Goaziou fe5962ce9b Fix some time stamps regexps
* lisp/org.el (org-ts--internal-regexp): New variable.
(org-ts-regexp):
(org-ts-regexp-inactive):
(org-ts-regexp-both): Use new variable.
(org-maybe-keyword-time-regexp): Remove variable.
(org-logbook-drawer-re): Simplify regexp.

Also move "Timestamp" section higher in the library (topological
order). This change should pacify "Relint" checks.
2020-02-23 12:41:33 +01:00
Nicolas Goaziou 83518daf11 Small fix
* lisp/org.el (org-set-tags-command): Also avoid using `looking-back',
in particular without a LIMIT argument.  This silences the
byte-compiler.
2020-02-23 10:30:22 +01:00
Bastien d9d877491b org-archive.el: Add :package-version to an option
* lisp/org-archive.el (org-archive-subtree-save-file-p): Add
:package-version.
2020-02-23 09:42:02 +01:00
Nicolas Goaziou 42ec2462a0 Do not leak "attachment" links
* lisp/ol.el (org-link-open): Remove "attachment" for special cases.
* lisp/org-attach.el (org-attach-expand-links):
(org-attach-follow): New functions.
(org-attach-link-expand): Remove function.
* lisp/org-element.el (org-element-link-parser):
* lisp/ox-ascii.el (org-ascii-link):
* lisp/ox-html.el (org-html-link):
* lisp/ox-latex.el (org-latex--inline-image):
(org-latex-link):
* lisp/ox-man.el (org-man-link):
* lisp/ox-md.el (org-md-link):
* lisp/ox-odt.el (org-odt-inline-image-rules):
(org-odt-link):
* lisp/ox-texinfo.el (org-texinfo-inline-image-rules):
(org-texinfo-link): Remove "attachment" from special cases.
2020-02-22 14:22:49 +01:00
Bastien 08428fed78 ob-shell.el: Delete `org-babel-shell-return-value-is-exit-status'
* lisp/ob-shell.el (org-babel-sh-evaluate): Return the output
by default.  Return exit status as the "value" when :result is
explicitely set to "value".

* lisp/ob-shell.el
(org-babel-shell-return-value-is-exit-status): Delete option.

* doc/org-manual.org (Collection): Be more accurate.

See the whole thread here:
https://lists.gnu.org/archive/html/emacs-orgmode/2020-02/msg00715.html

Thanks to everyone in this discussion.
2020-02-22 10:58:55 +01:00
Bastien 5dee070fb2 lisp/ol-bbdb.el (org-bbdb-anniversaries): Enhance docstring
* lisp/ol-bbdb.el (org-bbdb-anniversaries): Enhance docstring.

Thanks to Andrés Ramírez for suggesting this.
2020-02-22 10:33:07 +01:00
Bastien e360cd8f3a Change the default values for several options
* doc/org-manual.org (Execute commands in the active region):
Update the manual given the new defaults.

* etc/ORG-NEWS (New default settings for some options): New
section.

* lisp/org.el (org-loop-over-headlines-in-active-region):
Change the default value to `t'.
(org-fontify-done-headline): Ditto.

* lisp/org-agenda.el
(org-agenda-loop-over-headlines-in-active-region): Ditto.

* lisp/org-src.el (org-src-tab-acts-natively): Ditto.
2020-02-21 16:35:56 +01:00
Bastien 450452de4b org.el: Two minor fixes
* lisp/org.el (org-set-tags-command): Fix point position after
setting tag at the beginning of a blank heading.
(org-kill-line): Prevent from throwing an error when killing
the headline while point is right after the * chars.
2020-02-21 16:12:28 +01:00
Bastien 4cd497416f org-agenda.el: Rename two options
* lisp/org-agenda.el (org-sort-agenda-notime-is-late): Make an
obsolete alias to `org-agenda-sort-notime-is-late'.
(org-sort-agenda-noeffort-is-high): Make an obsolete alias to
`org-agenda-sort-noeffort-is-high'.
(org-agenda-finalize-entries, org-cmp-effort, org-cmp-time)
(org-cmp-ts, org-agenda-compare-effort): Use the new names.
2020-02-21 08:29:42 +01:00
Bastien 0c02928eb2 ob-shell.el: Rename `ob-shell-return-value-is-exit-status'
* lisp/ob-shell.el
(org-babel-shell-return-value-is-exit-status): Rename from
`ob-shell-return-value-is-exit-status'.
(org-babel-execute:shell, org-babel-sh-evaluate): Use new name.
(org-babel--variable-assignments:bash_assoc): Fix indentation.
2020-02-21 08:26:37 +01:00
D. Williams 1b2de14d84 org-indent.el: Deprecate `org-hide-leading-stars-before-indent-mode'
* lisp/org-indent.el (org-indent-mode): Make `org-hide-leading-stars'
buffer local and revert it back to it's global value when exiting the
mode without storing it's global value manually.
(org-hide-leading-stars-before-indent-mode): Remove declaration.

This commit implements my suggestion from the mailing list
(https://lists.gnu.org/archive/html/emacs-orgmode/2020-02/msg00759.html)
to rely on Emacs' native mechanisms for restoring a buffer-local
variable to it's global default value instead of storing the global
value in a temporary variable (in this case:
`org-hide-leading-stars-before-indent-mode').

TINYCHANGE
2020-02-20 15:17:21 +01:00
Eric Abrahamsen 6de5bcee87 Skip entries with no ID when updating ID locations
* lisp/org-id.el (org-id-update-id-locations): Saves a little chatter
about duplicate "nil" IDs.
2020-02-19 22:37:25 +01:00
Bastien 6f943b1da5 org.el (org-use-sub-superscripts): Remove old comment in docstring
* lisp/org.el (org-use-sub-superscripts): Remove old comment
in docstring.
2020-02-19 22:26:47 +01:00
Bastien bc75b75d9f org.el (org-special-ctrl-k): Enhance docstring
* lisp/org.el (org-special-ctrl-k): Enhance docstring.

Thanks to Marco Wahl for suggesting this change.
2020-02-19 21:43:31 +01:00
Nicolas Goaziou 0c55d3f421 Remove special syntax from context in file links
* lisp/ol.el (org-link--clear-syntax-from-context): New function.
(org-store-link): Use new function.
2020-02-19 18:42:50 +01:00
Nicolas Goaziou 12c09be3a6 Refactor context part in file links
* lisp/ol.el (org-link--context-from-region):
(org-link--squeeze-white-spaces): New functions.
(org-link-heading-search-string): Refactor code. Always start with an asterisk.
(org-store-link): Use new functions.
* lisp/org-pcomplete.el (pcomplete/org-mode/searchhead):
* testing/lisp/test-org-clock.el (test-org-clock/clocktable/link):
Update tests.
2020-02-19 18:42:50 +01:00
Nicolas Goaziou 8c4e270df2 ol: Refuse to define reserved internal link types
* lisp/ol.el (org-link-set-parameters): Raise an error when trying to
define reserved internal link types.
2020-02-19 18:42:50 +01:00
Nicolas Goaziou f4bed78a19 Move custom links to new tooling
* contrib/lisp/ol-bookmark.el (org-bookmark-open):
* contrib/lisp/ol-elisp-symbol.el (elisp-symbol-open):
* contrib/lisp/ol-git-link.el (org-gitbare-open):
(org-git-open):
* contrib/lisp/ol-man.el (org-man-open):
* contrib/lisp/ol-mew.el (org-mew-open):
* contrib/lisp/ol-notmuch.el (org-notmuch-open):
(org-notmuch-search-open):
(org-notmuch-tree-open):
* contrib/lisp/ol-vm.el (org-vm-open):
(org-vm-imap-open):
* contrib/lisp/ol-wl.el (org-wl-open):
* contrib/lisp/org-mac-link.el (org-mac-together-item-open):
(org-mac-addressbook-item-open):
(org-mac-skim-open):
(org-mac-acrobat-open):
(org-mac-outlook-message-open):
(org-mac-evernote-note-open):
(org-devonthink-item-open):
(org-mac-message-open):
* contrib/lisp/org-mairix.el (org-mairix-open):
* lisp/ol-bbdb.el (org-bbdb-export):
(org-bbdb-open):
* lisp/ol-bibtex.el (org-bibtex-open):
* lisp/ol-docview.el (org-docview-open):
* lisp/ol-eshell.el (org-eshell-open):
* lisp/ol-eww.el ("eww"):
* lisp/ol-gnus.el (org-gnus-open):
* lisp/ol-info.el (org-info-open):
* lisp/ol-irc.el (org-irc-visit):
* lisp/ol-mhe.el (org-mhe-open):
* lisp/ol-rmail.el ("rmail"):
(org-rmail-open):
* lisp/ol.el (org-link--open-doi):
(org-link--open-elisp):
(org-link--open-help):
(org-link--open-shell):
* lisp/org-id.el (org-id-open):
* testing/lisp/test-ox.el (test-org-export/custom-protocol-maybe): Use
new tooling.
* doc/org-manual.org (Adding Hyperlink Types): Adapt example.
2020-02-19 18:42:50 +01:00
Nicolas Goaziou afd3b04ecc ol: Extend open tooling in link parameters
* lisp/ol.el (org-link-parameters): Extend :follow parameter to handle
a second argument.
(org-link-open): Call custom-link functions after internal ones.
(org-link-open-as-file): New function.
(org-link-parameters): Reference new function.
(org-link-open): Use new function.
2020-02-19 18:42:47 +01:00
Nicolas Goaziou ab9166ad29 Extend export tooling in link parameters
* lisp/ol.el (org-link-parameters): Allow a fourth "info" argument for
`:export' property.  Expound docstring.
* lisp/ox.el (org-export-custom-protocol-maybe): Accept a fourth
optional argument.
* lisp/ox-ascii.el (org-ascii--describe-links):
(org-ascii-link):
* lisp/ox-beamer.el (org-beamer-link):
* lisp/ox-html.el (org-html-link):
* lisp/ox-latex.el (org-latex-link):
* lisp/ox-man.el (org-man-link):
* lisp/ox-md.el (org-md-link):
* lisp/ox-odt.el (org-odt-link):
* lisp/ox-org.el (org-org-link):
* lisp/ox-texinfo.el (org-texinfo-link):
* contrib/lisp/ox-groff.el (org-groff-link): Provide expected fourth
argument.
* lisp/ox.el (org-export-link-as-file): New function.
* lisp/ol.el (org-link-parameters): Add reference to new function in docstring.
* testing/lisp/test-ox.el (test-org-export/link-as-file): Add tests.
(test-org-export/custom-protocol-maybe): Update tests.
2020-02-19 18:41:37 +01:00
Bastien 9d58806fab Fix 5acf4d4692 2020-02-19 18:10:41 +01:00
Bastien 4533d783c2 ob-shell.el: New option `ob-shell-return-value-is-exit-status'
* lisp/ob-shell.el (ob-shell-return-value-is-exit-status): New
option.
(org-babel-execute:shell, org-babel-sh-evaluate): Use it.

In a shell source code block, when there is no :results header or when
the :results header is "value", the code block should return the value
of the source block, called in "functional mode", i.e. with the code
being called as a function and returning a value.  See this part of
the manual:

‘value’
     Default.  Functional mode.  Org gets the value by wrapping the code
     in a function definition in the language of the source block.  That
     is why when using ‘:results value’, code should execute like a
     function and return a value.  For languages like Python, an
     explicit ‘return’ statement is mandatory when using ‘:results
     value’.  Result is the value returned by the last statement in the
     code block.

Strictly speaking, the "return value" of a shell source code block
should be the exit status of the last command in the block.  As the
manpage for bash says: "the return value of a simple command is its
status".

This patch allows this strict interpretation of "value" for shell
blocks, while sticking to the current behavior of returning the shell
output of the code block.

Thanks to Vladimir Nikishkin for asking a question about this and to
Eric Fraga and Tim Cross for their inputs on this issue.
2020-02-19 16:57:15 +01:00
stardiviner 4f31aa2d3b ob-python.el: Fix session initiation when using python-mode.el
* lisp/ob-python.el (org-babel-python-initiate-session-by-key): Fixes
new session initiation when org-babel-python-mode is
python-mode.el.
2020-02-19 07:39:28 -08:00
Bastien 39f1c1f1e1 Merge branch 'maint' 2020-02-19 14:35:05 +01:00
Bastien 10607d45ae org.el: Fix typo in docstring
* lisp/org.el (org-special-ctrl-k): Fix typo in docstring.
2020-02-19 14:34:58 +01:00
Bastien 5af2d215ff Revert "org-capture.el: Conditionally throw an error on missing annotation"
This reverts commit 78ec8da52a.
2020-02-19 13:37:24 +01:00
Bastien 0b9fcc603f Revert "org-capture.el: Don't throw an error abusively"
This reverts commit 26ba4f7d7f.
2020-02-19 13:37:17 +01:00
Bastien 26ba4f7d7f org-capture.el: Don't throw an error abusively
* lisp/org-capture.el (org-capture-fill-template): Don't throw
a user error when immediately finishing a template from which
an initial annotation is missing, warn instead.

This fixes 78ec8da52a.  Thanks to Eric Fraga for reporting this.
2020-02-19 13:32:49 +01:00
Bastien 4150832d43 Merge branch 'maint' 2020-02-19 10:56:20 +01:00
Bastien d0018ce62c ob-core.el: Fix `org-babel--string-to-number'
* lisp/ob-core.el (org-babel--string-to-number): Prevent
strings containing whitespaces after being trimmed to be
interpreted as numbers.
2020-02-19 10:55:36 +01:00
Bastien 09877e5be2 Merge branch 'maint' 2020-02-19 10:39:51 +01:00
Bastien 6b2a7cb20b ob-core.el: Correctly interpret all numbers
* lisp/ob-core.el (org-babel--string-to-number): Correctly
interpret all numbers.

Thanks to Vladimir Nikishkin for reporting this.
2020-02-19 10:39:37 +01:00
Bastien 093e65ecc7 Merge branch 'maint' 2020-02-19 00:35:34 +01:00
Bastien 7e52b76612 org-agenda: Fix logic of `org-agenda-filter-make-matcher'
* lisp/org-agenda.el (org-agenda-filter-make-matcher): Fix
logic: only use 'or when including several categories as e.g.
'("+cat1" "+cat2").

This fixes 06cf532f4.
2020-02-19 00:35:20 +01:00
Bastien fae16ed8f5 Add `generated-autoload-file' buffer local variable
* lisp/org.el:
* lisp/org-num.el:
* lisp/org-macs.el:
* lisp/org-list.el:
* lisp/org-lint.el:
* lisp/org-keys.el:
* lisp/org-goto.el:
* lisp/org-duration.el:
* lisp/org-compat.el:
* lisp/org-colview.el:
* lisp/org-capture.el:
* lisp/org-agenda.el:
* lisp/ol.el: Add `generated-autoload-file' buffer local variable.

This is needed when compiling Org files within GNU Emacs.
2020-02-18 23:37:24 +01:00
Bastien 273a7775cd Various minor fixes
* mk/eldo.el: Update copyright year and fix formatting.

* lisp/ox-man.el: Don't set generated-autoload-file as a
buffer local variable.

* lisp/org-refile.el: Place ;;;###autoload correctly.

* lisp/ob-lilypond.el (org-babel-lilypond-switch-extension):
Formatting fix.
2020-02-18 23:24:09 +01:00
Bastien 6a1f6ee1f8 Tiny formatting fixes
* lisp/ox.el (org-export-table-dimensions):
* lisp/ox-texinfo.el (org-texinfo-template):
* lisp/ox-md.el (org-md-link):
* lisp/ox-icalendar.el (org-icalendar-use-UTC-date-time-p):
* lisp/ox-ascii.el (org-ascii-fixed-width):
* lisp/org.el (org-context):
* lisp/org-table.el (org-table-eval-formula)
(org-table-export):
* lisp/org-refile.el:
* lisp/org-plot.el (org-plot/gnuplot-to-grid-data):
* lisp/org-num.el (org-num):
* lisp/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org-macro.el (org-macro):
* lisp/org-lint.el (org-lint):
* lisp/org-keys.el (org-keys):
* lisp/org-duration.el:
* lisp/org-clock.el (org-clock-get-last-clock-out-time)
(org-clock-update-mode-line, org-find-open-clocks):
* lisp/org-agenda.el (org-diary)
(org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item)
(org-agenda-highlight-todo, org-cmp-alpha)
(org-agenda-filter-by-category):
* lisp/ol.el (org-link-expand-abbrev, ol):
* lisp/ol-docview.el (ol-docview):
* lisp/ol-bibtex.el (org-execute-file-search-in-bibtex)
(org-bibtex, org-bibtex-read):
* lisp/ol-bbdb.el (org-bbdb-anniversary-description):
* lisp/ob-tangle.el (org-babel-tangle-jump-to-org):
* lisp/ob-table.el (org-babel-table-truncate-at-newline):
* lisp/ob-stan.el:
* lisp/ob-sqlite.el (org-babel-sqlite-table-or-scalar):
* lisp/ob-sql.el:
* lisp/ob-shen.el:
* lisp/ob-shell.el (org-babel-prep-session:shell)
(org-babel-prep-session:shell):
* lisp/ob-sed.el (org-babel-execute:sed)
(org-babel-execute:sed):
* lisp/ob-screen.el:
* lisp/ob-sass.el:
* lisp/ob-ruby.el (org-babel-prep-session:ruby)
(org-babel-prep-session:ruby):
* lisp/ob-ref.el (org-babel-ref-resolve, ob-ref):
* lisp/ob-python.el (org-babel-prep-session:python)
(org-babel-prep-session:python):
* lisp/ob-plantuml.el:
* lisp/ob-picolisp.el:
* lisp/ob-perl.el:
* lisp/ob-org.el:
* lisp/ob-octave.el (org-babel-prep-session:octave)
(org-babel-prep-session:octave)
(org-babel-octave-evaluate-session):
* lisp/ob-ocaml.el:
* lisp/ob-mscgen.el (org-babel-execute:mscgen)
(org-babel-execute:mscgen):
* lisp/ob-maxima.el:
(ob-maxima):
* lisp/ob-matlab.el:
* lisp/ob-makefile.el:
* lisp/ob-lua.el (org-babel-prep-session:lua)
(org-babel-prep-session:lua):
* lisp/ob-lisp.el:
* lisp/ob-ledger.el:
* lisp/ob-latex.el (org-babel-expand-body:latex)
(org-babel-expand-body:latex, ob-latex):
* lisp/ob-js.el:
* lisp/ob-java.el:
* lisp/ob-io.el (org-babel-prep-session:io)
(org-babel-prep-session:io):
* lisp/ob-hledger.el:
* lisp/ob-haskell.el:
* lisp/ob-groovy.el (org-babel-groovy-wrapper-method)
(org-babel-groovy-evaluate):
* lisp/ob-gnuplot.el:
* lisp/ob-fortran.el (org-babel-expand-body:fortran)
(org-babel-expand-body:fortran):
* lisp/ob-forth.el (org-babel-forth-session-execute):
* lisp/ob-exp.el (ob-exp):
* lisp/ob-eval.el:
* lisp/ob-emacs-lisp.el:
* lisp/ob-ebnf.el:
* lisp/ob-dot.el:
* lisp/ob-ditaa.el:
* lisp/ob-css.el:
* lisp/ob-core.el (org-babel-put-rownames):
* lisp/ob-coq.el:
* lisp/ob-comint.el:
* lisp/ob-calc.el:
* lisp/ob-awk.el:
* lisp/ob-asymptote.el:
* lisp/ob-abc.el:
* lisp/ob-R.el (org-babel-prep-session:R): Formatting fixes.
2020-02-18 22:57:37 +01:00
Bastien 325962c003 org.el: New option `org-startup-numeroted' and #+startup: num
* lisp/org.el (org-startup-numeroted): New option.
(org-startup-options): New "num" and "nonum" startup keywords.
(org-mode): Startup according `org-startup-numeroted' or the
local #+startup setup.

* doc/org-manual.org (Dynamic Headline Numbering)
(Summary of In-Buffer Settings): Document
`org-startup-numeroted' and #startup: num.

* etc/ORG-NEWS: Document the new startup option.

Thanks to Guillaume MULLER for this idea.
2020-02-18 13:27:33 +01:00
Bastien 44e17c420b Merge branch 'maint' 2020-02-18 10:31:49 +01:00
Stefan Kangas 2129ece3b5 org-agenda.el: Fix typo
* lisp/org-agenda.el (org-agenda-add-entry-text-descriptive-links):
Fix typo.
2020-02-18 10:31:37 +01:00