Commit Graph

24315 Commits

Author SHA1 Message Date
Nicolas Goaziou e7454ceb79 oc: Call select-style function with a citation argument
* lisp/oc.el (org-cite--keys-to-citation): New function.
(org-cite-make-insert-processor): Use new function.  Change signature
of SELECT-STYLE.

Reported-by: "Bruce D'Arcus" <bdarcus@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2021-07/msg00638.html>
2021-08-11 12:11:34 +02:00
Nicolas Goaziou 490eba3a42 Remove spurious `provide'
Provide only features matching file names.
2021-08-11 11:31:54 +02:00
Nicolas Goaziou 733623761d oc-basic: Pacify byte-compilator
* lisp/oc-basic.el (org-cite-basic--parse-bibliography): Use
`org-buffer-hash' instead of `buffer-hash' since Org supports Emacs 25.1.
2021-08-11 11:29:34 +02:00
Nicolas Goaziou 100641bc5a oc-biblatex: Refactor code to simplify byte-compilation
* lisp/oc-biblatex.el (org-cite-biblatex-export-citation): Refactor
code.

Reported-by: Maxim Nikulin <manikulin@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2021-08/msg00100.html>
2021-08-11 11:27:51 +02:00
Max Nikulin 26d1711167 oc: Add missing `require'
* lisp/oc.el:
* lisp/oc-basic.el: Add some `require' to avoid compile warnings.
2021-08-11 11:15:17 +02:00
Max Nikulin 31c07bd3bd oc: rx compatibility with Emacs < 27.1
* lisp/oc.el (org-cite-adjust-note):
* lisp/oc-basic.el (org-cite-basic-goto):
* lisp/oc-biblatex.el (org-cite-biblatex-prepare-preamble):
* lisp/oc-csl.el (org-cite-csl--label-regexp): Avoid `rx' forms
introduced in Emacs-27.1 to keep compatibility with older versions.

Use `rx-to-string' instead of `rx' due to lack of support of  `regexp'
and `literal' forms with a variable as an argument.
2021-08-11 11:14:22 +02:00
Marco Wahl 01877f4804 org-compat: Fix org-directory-empty-p
* lisp/org-compat.el: Remove COUNT parameter in call of
directory-files.  COUNT not available in Emacs < 28.
2021-08-10 22:38:00 +02:00
Marco Wahl 81eb8c5f9e attach: Fix for Emacs<28
* lisp/org-compat.el: Introduce org-directory-empty-p which is directory-empty-p from Emacs 28.
* lisp/org-attach.el (org-attach-sync): Use org-directory-empty-p instead of directory-empty-p.
* etc/ORG-NEWS: Note about org-directory-empty-p.

Thanks Kyle identifying the issue.  Thanks Arthur for suggesting a
fix.
2021-08-10 22:20:48 +02:00
Kyle Meyer 926dbafe43 Merge branch 'km/from-emacs-master' 2021-08-08 18:07:20 -04:00
Lars Ingebrigtsen 0f7fcc9de0 Backport commit 6a3920c07 from Emacs
* lisp/org-agenda.el (org-agenda-get-restriction-and-command):
Using `error' here will trigger users with `debug-on-error' so use
`user-error' instead (bug#49920).  It would probably be preferable
to rewrite this to not use the error system to do control flow.

Make `q' in `org-agenda' work even with `debug-on-error' set
6a3920c07eaae58408dd27e7db22bff7ad4d1f80
Lars Ingebrigtsen
Sat Aug 7 12:55:39 2021 +0200
2021-08-08 18:06:30 -04:00
Nicolas Goaziou a6d93cfb62 oc-natbib: Refactor code to ease byte-compilation
* lisp/oc-natbib.el (org-cite-natbib--style-to-command): Refactor code
so byte-compilation is faster, and, in some cases, do not end with
Bytecode overflow error.

Reported-by: Maxim Nikulin <manikulin@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2021-08/msg00100.html>
2021-08-08 16:10:14 +02:00
Nicolas Goaziou 4198cbd074 Strictly match language when loading Elisp code
* lisp/org.el (org-babel-load-file): Strictly check language before
loading source code.

Reported-by: dmg <dmg@turingmachine.org>
<http://lists.gnu.org/r/emacs-orgmode/2021-07/msg00631.html>
2021-08-07 22:22:05 +02:00
Nicolas Goaziou a43d7a575d ox: Fix docstring
* lisp/ox.el (org-export-define-backend): Fix docstring.

Reported-by: Zachary Kanfer <zkanfer@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2021-08/msg00009.html>
2021-08-07 22:14:41 +02:00
Juan Manuel Macias 8c78db4910 ox: Fix spanish translation for `footnotes'
* lisp/ox.el (org-export-dictionary): tiny fix in spanish
translation (plural instead of singular).
2021-08-07 22:10:28 +02:00
Nicolas Goaziou 8df3e25db8 Revert "oc: Remove spurious `provide'"
This reverts commit ad006e2930.
2021-08-01 10:29:23 +02:00
Nicolas Goaziou ad006e2930 oc: Remove spurious `provide'
* lisp/oc-basic.el:
* lisp/oc-biblatex.el (biblatex):
* lisp/oc-csl.el:
* lisp/oc-natbib.el:
* lisp/oc.el: Provide only the full library name.
2021-08-01 10:07:39 +02:00
Nicolas Goaziou 3ba46cbe4a Merge branch 'maint' 2021-07-31 10:57:00 +02:00
Nicolas Goaziou dcc3a84a98 keys: Re-instate some RET bindings
* lisp/org-keys.el (org-mode-map): Re-instate S-RET and M-S-RET, which
are not translated from S-<return> and M-S-<return>, unlike
M-<return>/M-RET.

This is a followup to ee652a47df.

Reported-by: Kévin Le Gouguec <kevin.legouguec@gmail.com>
2021-07-31 10:55:01 +02:00
Nicolas Goaziou 18570684ad oc-basic: Improve <mouse-1> handling on citation keys
* lisp/oc-basic.el (org-cite-basic--set-keymap): New function.
(org-cite-basic--make-repair-keymap): Remove function.
(org-cite-basic-activate): Use new function.
2021-07-30 09:47:20 +02:00
Nicolas Goaziou c0dde2c800 oc-basic: Fix `org-cite-basic-goto'
* lisp/oc-basic.el (org-cite-basic-goto): Set BibTeX dialect before
calling `bibtex-search-entry'.
2021-07-30 08:52:34 +02:00
Nicolas Goaziou c839849aba footnote: Allow inserting footnotes at the end of table cells
* lisp/org-footnote.el (org-footnote--allow-reference-p): Allow
inserting footnotes at the end of table cells.
* testing/lisp/test-org-footnote.el (test-org-footnote/new): Add test.
2021-07-29 21:15:11 +02:00
Nicolas Goaziou 7ea9099725 oc: Allow inserting citations in table cells (part 2)
* lisp/oc.el (org-cite--allowed-p): Allow inserting a citation after
two or more spaces at the end of a table cell.
* testing/lisp/test-oc.el (test-org-cite/insert-capability): Add
tests.
2021-07-29 21:13:01 +02:00
Nicolas Goaziou 78c450247b oc: Allow inserting citations in captions
* lisp/oc.el (org-cite--allowed-p): Allow inserting citations in captions.
* testing/lisp/test-oc.el (test-org-cite/insert-capability): Add test.
2021-07-28 11:11:46 +02:00
Nicolas Goaziou af0fcb6833 element: Allow citations in table cells
* lisp/org-element.el (org-element-object-restrictions): Allow
citations in table cells.
* testing/lisp/test-org-element.el (test-org-element/citation-parser):
Add test.  Remove outdated test.
2021-07-28 10:32:29 +02:00
Juan Manuel Macias 40a20136d3 Prevent partial fontification when a link is displayed full
* lisp/org.el (org-activate-links): apply `face-property' variable in
other cases when handle invisible parts in bracket
links: `(add-face-text-property start end face-property)' suggestion
from Ihor Radchenko
2021-07-27 22:01:36 +02:00
Nicolas Goaziou 229b018b60 ox-latex: Do not duplicate \texttt on inline source blocks
* lisp/ox-latex.el (org-latex-inline-src-block): When
`org-latex-listings' is nil, simply translate source block as code,
without adding an additional \texttt command.

Reported-by: Maxim Nikulin <manikulin@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2021-07/msg00489.html>
2021-07-27 21:59:43 +02:00
Tom Gillespie c9dfed48a6
ob-core: tangle check LOB after current buffer
* lisp/ob-core.el (org-babel-expand-noweb-references): Fix order when
searching for named babel blocks so that blocks in the current buffer
are always found first. This fixes a bug where stale versions of
blocks that have been ingested into the library of babel were being
preferentially tangled instead of newly modified versions from the
current buffer.
2021-07-25 03:42:42 +08:00
TEC 604bfd9d75
oc-csl: be more caution about the csl etc location
* lisp/oc-csl.el (org-cite-ctl--etc-dir): The previous value of
`org-cite-ctl--etc-dir' is incorrect when using either package.el or
straight to manage Org. We can be a bit more considerate by just
checking if the initial location exists, and then trying the expected
location when using package.el/straight if it doesn't exist.
2021-07-15 03:36:24 +08:00
Kyle Meyer fc273bfce1 Merge branch 'maint' 2021-07-11 22:42:38 -04:00
Amin Bandali 1ee52c5eb6 Backport commit 348b2aed0 from Emacs
Update IRC-related references to point to Libera.Chat
348b2aed0c8c3630be4c15c8e70acf7ea9c023af
Amin Bandali
Sat Jul 3 23:39:18 2021 -0400
2021-07-11 22:40:57 -04:00
Marco Wahl 61e0837325 org-attach: Possibly delete empty attach directory
* lisp/org-attach.(org-attach-sync): Enable possible deletion of empty
attachment directories.  `org-attach-sync-delete-empty-dir' controls
the action: Never delete, Always delete or Query the user (default).
2021-07-09 21:03:44 +02:00
TEC 32739e35e3
ox-latex: Change default compiler to latexmk
* lisp/ox-latex.el (org-latex-pdf-process): Check for the presence of
latexmk when setting the default, and use it when available.  Fall back
to the current default.  This is important for the incoming citation
support, as PDF generation will now need to involve bibliography
generation.  By using latexmk this is taken care of for us.  The -%latex
part of the command is slightly hacky, but allows latexmk to behave more
intelligently for non-pdflatex options.  Note that latexmk also seems to
care about the order of the arguments.
2021-07-10 00:31:40 +08:00
Nicolas Goaziou 971c1359a5 oc-csl: Implement `csl' citation processor
* etc/csl/chicago-author-date.csl:
* etc/csl/locales-en-US.xml:
* lisp/oc-csl.el (csl): New files.
* etc/Makefile (ETCDIRS): Register new files.
2021-07-09 08:47:14 +02:00
Nicolas Goaziou ae5f5151fe oc-biblatex: Implement `biblatex' citation processor
* lisp/oc-biblatex.el: New file.
2021-07-09 08:47:14 +02:00
Nicolas Goaziou d6cb37f4be oc-natbib: Implement `natbib' citation processor
* lisp/oc-natbib.el: New file.
2021-07-09 08:47:14 +02:00
Nicolas Goaziou c089c234bb Allow `org-edit-special' to open "bibliography" files
* lisp/org.el (org-edit-special): Also edit "bibliography" keywords.
2021-07-09 08:47:14 +02:00
Nicolas Goaziou ef79a8d8e6 org-keys: Plug citation insertion
* lisp/org-keys.el: Add a key-binding for `org-cite-insert'.
2021-07-09 08:47:14 +02:00
Nicolas Goaziou 524d8fe4c1 Plug citations into fontification process 2021-07-09 08:47:14 +02:00
Nicolas Goaziou a20a3ad5f1 Plug citations into `org-open-at-point'
* lisp/org.el (org-open-at-point): Follow citations and citation
references.
2021-07-09 08:47:14 +02:00
Nicolas Goaziou 2c2b720394 ox: Plug citations into export process
* lisp/ox.el (org-export-as): Add citation pre-processing.
2021-07-09 08:47:14 +02:00
Nicolas Goaziou 44156353c9 oc-basic: Implement `basic' citation processor
* lisp/oc-basic.el: New file.
2021-07-09 08:47:14 +02:00
Nicolas Goaziou e844a6fd41 oc: Add Org Cite library
* lisp/oc.el: New file.
* testing/lisp/test-oc.el: New file.
2021-07-09 08:47:14 +02:00
Nicolas Goaziou a922b1764d faces: Add `org-cite' and `org-cite-key' faces
* lisp/org-faces.el (org-cite):
(org-cite-key): New faces.
2021-07-09 08:47:14 +02:00
Nicolas Goaziou 4c646a6bde ox: Introduce "raw" pseudo objects
* lisp/ox.el (org-export-raw-string): New function
(org-export-data):
(org-export-with-backend): React to raw objects.
* testing/lisp/test-ox.el (test-org-export/raw-string): New test.

A raw object is a pseudo-object (i.e., special object type that exists
only during export) with the property of being exported as-is, with no
processing from an export back-end.

It is particularly useful to add contents to, or pre-process objects
from, a parse tree.
2021-07-09 08:47:14 +02:00
Nicolas Goaziou fed07be5b8 element: Add citation support
* lisp/org-element.el (org-element-citation-key-re):
(org-element-citation-prefix-re): New variables.
(org-element--set-regexps): Set `org-element--object-regexp' so it
finds citations.
(org-element-all-objects): Add citation and citation-reference
objects.
(org-element-recursive-objects): Add citation object.
(org-element-object-restrictions): Add citation and citation-reference
to restrictions.
(org-element-secondary-value-alist): citation and citation references
can hold secondary strings.
(org-element-citation-parser):
(org-element-citation-interpreter):
(org-element-citation-reference-parser):
(org-element-citation-reference-interpreter): New functions.
(org-element--object-lex): Parse citations and citations references.
* testing/lisp/test-org-element.el (test-org-element/citation-parser):
(test-org-element/citation-reference-parser):
(test-org-element/citation-interpreter): New tests.

This patch adds support for [cite:@key], [cite:pre @key post]
[cite:global prefix; pre @key1 post; pre @key2 post; global suffix]
objects along with their [cite/style: ...] counterparts.
2021-07-09 08:47:14 +02:00
Allen Li 622f9fa76c org: Use crm for completing tags
* lisp/org-capture.el (org-capture-fill-template): Changed to use
completing-read-multiple.
* lisp/org.el (org-set-tags-command): Changed to use
completing-read-multiple.
(org-change-tag-in-region): Changed to use a simple completion table.
* testing/lisp/test-org.el (test-org/set-tags-command): Fixed tests.

Change various places which use `completing-read' to read tags using a
custom completion function to instead use `completing-read-multiple'
with a completion table instead.

This makes tab completion play better with alternative completion
frameworks such as vertico, selectrum, etc.

`org-change-tag-in-region' only reads a single tag, so it is changed
to use a completion table with `completing-read'.  This also makes it
play better with alternative completion frameworks.

Note that there is still one use for `org-tags-completion-function',
which is for completing tag matches.  Completing tag matches is
different from completing lists of tags since the separators (+, -,
etc) have semantic meaning.  This commit does not address that use
case.
2021-07-09 08:44:32 +02:00
Nicolas Goaziou fdb98a436b Merge branch 'maint' 2021-07-02 16:03:19 +02:00
Nicolas Goaziou ee652a47df org-keys: Remove fancy RET keybindings
There is no such binding as "S-RET", and "ESC ..." is translated to
"M-..." in both GUI and TUI. Finally, "M-<return>" is translated to
"M-RET" so we shouldn't use the former.
2021-07-02 16:01:05 +02:00
Nico Sonack f76d4d103f ob-fortran: Use a defcustom for fortran compiler
* lisp/ob-fortran.el (org-babel-fortran-compiler): Change `defvar' to
`defcustom' so that the fortran compiler is customizable like almost
all other org-babel compilers.

TINYCHANGE

Sometimes the compiler isn't `gfortran` (but e.g. `gfortran10`
etc.). Accomodate for that like we do with all other org-babel
language integrations.
2021-07-01 23:21:15 +02:00
Eric S Fraga d1900adfbe ol-bibtex: Added url and doi as optional entries for BiBTeX export
* lisp/ol-bibtex.el: :doi and :url entries added to optional list of
entries to export to BiBTeX when present in the properties.

* etc/ORG-NEWS: added news item noting this change.
2021-07-01 23:15:22 +02:00