Commit Graph

53 Commits

Author SHA1 Message Date
Po Lu 9f1d6dfd73 Backport commit 8e1c56ae4 from Emacs
; Add 2024 to copyright years
8e1c56ae46754dd7baedff49a464f078f0e9912d
Po Lu
Tue Jan 2 09:47:10 2024 +0800
2024-01-06 15:48:23 -05:00
Stefan Kangas dc1230a3b5 Backport commit 5f923ff1a from Emacs
; Fix typos
5f923ff1a6a8a9ff6f06dc49c8e0e2ceee111567
Stefan Kangas
Sun Dec 3 23:31:30 2023 +0100
2023-12-04 23:23:45 -05:00
Ihor Radchenko c827341dfb
org-cite-activate: Ensure that we keep the correct match-data
* lisp/oc.el (org-cite-activate): Discard match data set by activate
function.  We already move the point after citation by force, so can
as well ensure that match-data remain accurate for later font-lock
use.

Reported-by: Lin Jian <me@linj.tech>
Link: https://orgmode.org/list/87sfczztg6.fsf@linj.tech
2023-04-17 12:45:07 +02:00
Eli Zaretskii e0815d7545 Backport commit cae528457 from Emacs
; Add 2023 to copyright years.
cae528457cb862dc886a34240c9d4c73035b6659
Eli Zaretskii
Sun Jan 1 05:31:12 2023 -0500
2023-01-01 12:44:47 -05:00
Ihor Radchenko 2b9f9646ef
org-cite: Fix style completion
* lisp/oc.el (org-cite-make-insert-processor): Provide the required
argument to SELECT-STYLE.

Reported-by: Kierin Bell <bellkierin@gmail.com>
Link: https://orgmode.org/list/875yg940z8.fsf@gmail.com
2022-10-25 14:25:37 +08:00
Ihor Radchenko 3d1f4e0af0
org-cite-insert: Allow citations at the beginning of empty heading
* lisp/oc.el (org-cite--allowed-p): When heading is empty, allow
to insert citations after priority/todo/stars.

Reported-by: Scott Otterson <scotto@sharpleaf.org>
Link: https://orgmode.org/list/CAPY3P0TBuoU2AJX78Qi2FevGuCx6KW1YSoSGQQZrzusTiuphRA@mail.gmail.com
2022-10-20 11:22:05 +08:00
Ihor Radchenko 9db57aee3e
Do not use visual `current-indentation' when we need real values
* lisp/org-macs.el (org-current-text-indentation): New macro
calculating the real text indentation disregarding buffer visibility.
(org-do-remove-indentation):
* lisp/org-src.el (org-src--edit-element):
* lisp/org.el (org-indent-line):
(org-indent-region):
(org-toggle-fixed-width):
(org-comment-or-uncomment-region):
* lisp/ox.el (org-export-expand-include-keyword): Use
`org-current-text-indentation' instead of `current-indentation' and
`org-current-text-column' instead of `current-column' when we need
real text values but not visible values.

See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=56837

Reported-by: tony aldon <tony.aldon.adm@gmail.com>
Link: https://orgmode.org/list/87k0h49s7z.fsf@localhost
2022-10-04 15:21:20 +08:00
Ihor Radchenko e81a094383
Assert all the Org files to load the same Org version
* lisp/org-compat.el (org-assert-version): New macro comparing Org
version at compile time and laod time.

Add `org-assert-version' call to all files:

* lisp/org-macs.el:
* lisp/org-crypt.el:
* lisp/org-ctags.el:
* lisp/org-cycle.el:
* lisp/org-datetree.el:
* lisp/org-duration.el:
* lisp/org-element.el (avl-tree):
* lisp/org-entities.el:
* lisp/org-faces.el:
* lisp/org-feed.el:
* lisp/org-fold-core.el:
* lisp/org-fold.el:
* lisp/org-footnote.el:
* lisp/org-goto.el:
* lisp/org-habit.el:
* lisp/org-id.el:
* lisp/org-indent.el:
* lisp/org-inlinetask.el:
* lisp/org-keys.el:
* lisp/org-lint.el:
* lisp/org-list.el:
* lisp/org-macro.el:
* lisp/org-mobile.el:
* lisp/org-mouse.el:
* lisp/org-num.el:
* lisp/org-pcomplete.el:
* lisp/org-persist.el:
* lisp/org-plot.el:
* lisp/org-protocol.el:
* lisp/org-refile.el:
* lisp/org-src.el:
* lisp/org-table.el:
* lisp/org-tempo.el:
* lisp/org-timer.el:
* lisp/org.el:
* lisp/ox-ascii.el:
* lisp/ox-beamer.el:
* lisp/ox-html.el:
* lisp/ox-icalendar.el:
* lisp/ox-koma-letter.el:
* lisp/ox-latex.el:
* lisp/ox-man.el:
* lisp/ox-md.el:
* lisp/ox-odt.el:
* lisp/ox-org.el:
* lisp/ox-publish.el:
* lisp/ox-texinfo.el:
* lisp/ox.el:
2022-09-04 12:24:55 +08:00
Ihor Radchenko b061e7b61c
org-cite-list-citations: Cache footnote-definition searches
* lisp/oc.el (org-cite-list-citations): Avoid quadratic complexity.
Pre-calculate list of all footnote definitions and cache the footnote
label search hits.  Do not make `org-element-map' accumulate unused
result.
2022-06-16 10:43:29 +08:00
Kyle Meyer aae2ac3a68 Merge branch 'bugfix' 2022-01-01 15:21:37 -05:00
Kyle Meyer 5a229cbc44 Update copyright year to 2022 2022-01-01 15:17:08 -05:00
Nicolas Goaziou 7e2d9091d0 oc: Allow declaring cite styles as a function
* lisp/oc.el (org-cite-register-processor): Allow a function
as :cite-styles value.
(org-cite-supported-styles): Propagate change above.
* testing/lisp/test-oc.el (test-org-cite/supported-styles): Add test.
2021-12-12 15:42:29 +01:00
Nicolas Goaziou 41f412f0bc Merge branch 'bugfix' 2021-12-11 14:21:54 +01:00
Nicolas Goaziou 957feb2df4 oc: Fix typo in docstring
* lisp/oc.el (org-cite-make-insert-processor): Fix typo.
2021-12-11 14:21:10 +01:00
Nicolas Goaziou e83a04b5af oc: Make `org-cite-try-load-process' public
* lisp/oc.el (org-cite-try-load-processor): New function.
(org-cite--try-load-processor): Remove function.
(org-cite-store-export-processor):
(org-cite-follow):
(org-cite-insert): Use new function.
2021-12-05 19:02:03 +01:00
Nicolas Goaziou 4f1c878d9a oc: Fix `org-cite--try-load-processor'
* lisp/oc.el (org-cite--try-load-processor): Add missing `intern'
call.
2021-12-05 18:59:24 +01:00
Nicolas Goaziou 191552df35 oc: Fix slowdown on tests
* lisp/oc.el (org-cite--try-load-processor): New function.
(org-cite-store-export-processor):
(org-cite-follow):
(org-cite-insert): Use new function.
(org-cite-get-processor): Do not try to load unknown processor.
Loading now happens at another level.
2021-12-04 18:09:24 +01:00
Nicolas Goaziou 3744713b8a oc: Make `org-cite-get-processor' public
* lisp/oc.el (org-cite--get-processor): rename to...
(org-cite-get-processor): ... this.
(org-cite-unregister-processor):
(org-cite-processor-has-capability-p):
(org-cite-supported-styles):
(org-cite-activate):
(org-cite-store-export-processor):
(org-cite-export-citation):
(org-cite-export-bibliography):
(org-cite-finalize-export):
(org-cite-follow):
(org-cite-insert): Apply renaming.
2021-11-30 22:21:46 +01:00
Nicolas Goaziou 5d2e2cd1bc oc: Factor out string to cite export processor triplet conversion
* lisp/oc.el (org-cite-read-processor-declaration): New function.
(org-cite-store-export-processor): Use new function.
* testing/lisp/test-oc.el (test-org-cite/read-processor-declaration):
New test.
2021-11-30 22:21:46 +01:00
Nicolas Goaziou 0bf211a340 oc: Opportunistically load processors
* lisp/oc.el (org-cite--get-processor): Try requiring 'oc-NAME where
name is the name of the processor used.
(org-cite-register-processor): Do not use `org-cite--get-processor' to
avoid circular requires.

Suggested-by: Timothy <tecosaur@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2021-11/msg00664.html>
2021-11-29 23:46:00 +01:00
Nicolas Goaziou b3cc2f793b Merge branch 'bugfix' 2021-11-24 22:51:41 +01:00
Nicolas Goaziou 30a6126bb9 oc: Fix `org-cite-fontify-default' docstring and simplify code
* lisp/oc.el (org-cite-fontify-default): We don't need to assume
activate processor may be used on a citation reference: that will not
happen.
2021-11-24 22:50:09 +01:00
Nicolas Goaziou 308f4cb570 oc: Ensure activation returns a non-nil value
* lisp/oc.el (org-cite-activate): Return a non-nil value when
successful, even if citation processor doesn't.
2021-11-24 22:39:50 +01:00
Nicolas Goaziou e961125768 oc: Fix docstring typos
* lisp/oc.el (org-cite-make-insert-processor): Fix typos in docstring.
Fill mostly under 60 characters.
2021-11-10 11:47:22 +01:00
Nicolas Goaziou ad40282860 oc: Refactor affixes extraction
* lisp/oc.el (org-cite-main-affixes): New function.
* lisp/oc-natbib.el (org-cite-natbib--build-optional-arguments): Use
new function.
* testing/lisp/test-oc.el (test-org-cite/main-affixes): New test.
2021-11-03 16:27:53 +01:00
Nicolas Goaziou 95ad5a954b oc-csl: Small refactoring
* lisp/oc.el (org-cite-wrap-citation): Mention return value.
* lisp/oc-csl.el (org-cite-csl--create-structure): Use return value
from `org-cite-wrap-citation' instead of using `org-element-lineage'.
2021-11-02 18:39:09 +01:00
Nicolas Goaziou 009900d7fa oc: Add autoload cookie for `org-cite-insert'
* lisp/oc.el (org-cite-insert): Autoload function.
2021-10-13 22:22:22 +02:00
Nicolas Goaziou c83fe001c7 oc: Fix error message
* lisp/oc.el (org-cite-insert): Fix copy-pasta in error message.
2021-10-13 22:20:11 +02:00
Nicolas Goaziou 18dca3478a oc: Upon inserting citations, add a space between keys
* lisp/oc.el (org-cite-make-insert-processor): Add a space in addition
to the semicolon.
2021-10-11 11:38:18 +02:00
Nicolas Goaziou 8dfc056fcc oc: Fix failing test about `org-cite-list-citations'
* lisp/oc.el (org-cite-list-citations): Properly implement
a simplified version of `org-export-get-footnote-definition'.
2021-10-09 23:01:35 +02:00
Nicolas Goaziou 7d22dca54e oc: Fix citations in footnotes when using biblatex back-end
* lisp/oc.el (org-cite-list-citations): Do not use
`org-export-get-footnote-definition' so as to not cache footnote
definitions too early, i.e., when citations are still present in the
parse tree.
* lisp/oc-biblatex.el (org-cite-biblatex--multi-arguments): Append
"\relax" unconditionally to avoid calling `org-export-data' on next
object, when citations are still present in the parse tree.

Reported-by: Elias Bounatirou <elias.bounatirou@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2021-09/msg00067.html>
2021-10-06 16:07:19 +02:00
Nicolas Goaziou b07c312f28 oc: Allow citations at footnote definition start
* lisp/oc.el (org-cite--allowed-p): Allow citations at footnote
definition start.
* testing/lisp/test-oc.el (test-org-cite/insert-capability): Add tests.
2021-10-06 14:29:40 +02:00
Nicolas Goaziou d68d8bc1f8 oc: Pacify checkdoc
* lisp/oc.el (org-cite-export-processors):
(org-cite--move-punct-before):
(org-cite-adjust-note):
(org-cite--allowed-p): Add missing argument.
2021-10-04 00:00:33 +02:00
Nicolas Goaziou d6f0e9e105 oc: Be stricter when introducing spaces before citations
* lisp/oc.el (org-cite-process-citations): Add a space before citation
only if it is preceded by a quotation mark.
* testing/lisp/test-oc.el (test-org-cite/export-capability): Add
tests.

Reported-by: Denis Maier <denismaier@mailbox.org>
<http://lists.gnu.org/r/emacs-orgmode/2021-09/msg00085.html>
2021-10-03 23:51:43 +02:00
Nicolas Goaziou 4b346e5157 oc: Fix typo in docstring
* lisp/oc.el (org-cite-adjust-note): Fix typo.
2021-10-03 23:23:37 +02:00
Glenn Morris 41e67cff0d Backport commit 4341e79a5 from Emacs
* lisp/oc.el (org-cite-global-bibliography)
(org-cite-note-rules, org-cite-punctuation-marks):
* lisp/oc-csl.el (org-cite-csl-locales-dir)
(org-cite-csl-styles-dir, org-cite-csl-no-citelinks-backends):
* lisp/oc-natbib.el (org-cite-natbib-options):
* lisp/org-keys.el (org-mouse-1-follows-link):
Remove bogus ":safe t" properties that would largely need to be
replaced by custom predicates.

Remove bogus ":safe t" custom properties
4341e79a5fad3e5e668a3eeb1b688d1986011481
Glenn Morris
Sat Oct 2 11:00:23 2021 -0700
2021-10-02 14:20:38 -04:00
Glenn Morris ec22cf0a53 Backport commit 62d6cecfc from Emacs
* lisp/oc.el (org-cite-activate-processor)
(org-cite-export-processors, org-cite-follow-processor)
(org-cite-insert-processor):
* lisp/ol.el (org-link-parameters, org-link-frame-setup)
(org-link-shell-confirm-function)
(org-link-shell-skip-confirm-regexp)
(org-link-elisp-confirm-function)
(org-link-elisp-skip-confirm-regexp):
* lisp/org-num.el (org-num-format-function):
Remove bogus ":safe nil" that do nothing but propagate a
misunderstanding of the safe-local-variable property.

Remove bogus ":safe nil" custom properties
62d6cecfcd1a67e15a436c5c2b975f327d9a8b50
Glenn Morris
Sat Oct 2 10:46:29 2021 -0700
2021-10-02 13:56:50 -04:00
Glenn Morris c3e8709e2d Backport commit f9111d878 from Emacs
* lisp/oc-basic.el (org-cite-basic-sorting-field)
(org-cite-basic-author-year-separator)
(org-cite-basic-max-key-distance)
(org-cite-basic-author-column-end)
(org-cite-basic-column-separator)
(org-cite-basic-mouse-over-key-face):
* lisp/oc-biblatex.el (org-cite-biblatex-options):
* lisp/oc-csl.el (org-cite-csl-link-cites)
(org-cite-csl-html-hanging-indent)
(org-cite-csl-html-label-width-per-char)
(org-cite-csl-latex-hanging-indent):
* lisp/oc.el (org-cite-adjust-note-numbers):
* lisp/org-keys.el (org-return-follows-link):
* lisp/org.el (org-fontify-todo-headline):
* lisp/ox-html.el (org-html-equation-reference-format)
(org-html-wrap-src-lines):
* lisp/ox-latex.el (org-latex-reference-command)
(org-latex-default-quote-environment): Fix :safe property.

The safe-local-variable property is a function (bug#50944)
f9111d8784bf12263abbe127cdfcbe5f409c9b3b
Glenn Morris
Sat Oct 2 10:37:42 2021 -0700
2021-10-02 13:44:34 -04:00
Glenn Morris e83ee601f2 Backport commit d50597189 from Emacs
; Standardize some license headers
d505971894d83e04e8d206be1dcee1cee5e8bb93
Glenn Morris
Fri Oct 1 18:07:45 2021 -0700
2021-10-01 21:57:10 -04:00
Bastien c80fea7355 lisp/oc.el: Fix docstring wrapping
* lisp/oc.el (org-cite-parse-elements): Fix docstring wrapping.
2021-09-27 17:23:21 +02:00
Bastien 80798fcdbb oc.el (org-cite-register-processor): Silence a compiler warning
* lisp/oc.el:
(org-cite-register-processor): Silence a compiler warning.
2021-09-27 12:15:09 +02:00
Bastien ca441be377 lisp/oc.el: Fix typo in comment string
* lisp/oc.el: Fix typo in comment string.
2021-09-27 12:08:15 +02:00
Marco Wahl d3d2e56bd6 oc: Replace an obsolete alias
* lisp/oc.el (org-cite--allowed-p): The replace removes the respective
  warning at compilation.
2021-09-20 00:38:28 +02:00
TEC b02f1eae19
oc: Allow citations following an item bullet
* lisp/oc.el (org-cite--allowed-p): Expand the allowed cases to include
"item", which lets one insert a citation following a bullet, e.g. "- ".
We just have to check to make sure the citation actually is at least one
character away from the bullet, or five if a checkbox is present.
2021-09-18 13:41:21 +08:00
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
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
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