Commit Graph

324 Commits

Author SHA1 Message Date
Ihor Radchenko 2b49d6fd9c
org-id-update-id-locations: Disable cache in throwaway buffers
* lisp/org-macs.el (org-element-with-disabled-cache): Move from
org-element.el to org-macs.el
2022-01-30 15:40:14 +08:00
Kyle Meyer 5a229cbc44 Update copyright year to 2022 2022-01-01 15:17:08 -05:00
Nicholas Vollmer b41f2971ab org-id: Fix checkdoc warnings
* org-id: Fix checkdoc warnings.
2021-09-29 08:50:06 +02:00
Stefan Kangas 51cdd6e30f Various minor docfixes found by checkdoc 2021-09-16 21:24:59 +02:00
Bastien fa3c9c8b69 lisp/org-id.el: Small enhancements
* lisp/org-id.el (org-id-locations-load, org-id-add-location):
Update messages.
(org-id-hash-to-alist, org-id-paste-tracker, org-id-find-id-file):
Docstring minor enhancements.
(org-id-new): Tiny refactoring.
2021-05-15 16:13:49 +02:00
Bastien 0f2ece647b Update Carsten's email address in some files 2021-05-07 16:50:57 +02:00
Gustav Wikström 3d52843269 Org-id: Clarify customization documentation for org-id, ts option
* lisp/org-id.el (org-id-ts-format, org-id-method): Clarify docstrings.
* doc/org-manual.org (Handling Links): Mention org-id-method in
the manual.
2021-04-19 22:55:48 +02:00
Kyle Meyer 49364f904b Avoid alist-get for compatibility with Emacs 24
* lisp/ob-java.el (org-babel-execute:java):
* lisp/org-id.el (org-id-store-link): Don't use alist-get, which isn't
available until Emacs 25.
2021-02-07 20:05:51 -05:00
Gustav Wikström be2966abb5 org-id: Add title to description when storing id links
* lisp/org-id.el (org-id-store-link): Store title as link description
if it is available.
2021-02-06 20:46:05 +01:00
Kyle Meyer 291993888d Merge branch 'maint' 2021-01-01 15:02:10 -05:00
Kyle Meyer 99eafe3787 Update copyright year to 2021 2021-01-01 14:59:01 -05:00
Gustav Wikström f6e41c1d14 org-id: org-id-get-with-outline-path-completion for file targets
* lisp/org-id.el (org-id-get-with-outline-path-completion): Make the
function work also for files (outline level 0)
2020-12-11 11:27:23 +01:00
Gustav Wikström 19d2f79a0f Speedup of org-id-update-id-locations
Since this is about performance, a benchmark before this change, on a
set of 519 files with total size of 1500 kb gives the following result:

  519 files scanned, 504 files contains IDs, and 911 IDs found.
  (168.243948 38 2.053949000000003)

After the change the following result:

  519 files scanned, 504 files contains IDs, and 911 IDs found.
  (3.034806 3 0.16445799999999622)

Benchmark done on a a Windows machine with no files previously loaded
into Emacs.

* lisp/org-id.el (org-id-update-id-locations): This function has
gotten a bit of back and forth changes in terms of performance.  One
year ago in 9865e6bd8 and then six months ago in 37a5020bb.
Unfortunately the latest speedup actually was a speed-down.  Speed is
not good again.
2020-11-04 16:41:20 +01:00
Nicolas Goaziou 41651f4ed0 id: Close unnecessary buffers after having looked for an ID
* lisp/org-id.el (org-id-find-id-in-file): When the file was not being
visited, and the caller didn't request a marker pointing to the ID
location, close the newly created buffer.

Reported-by: this nkk <thisnkk@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2020-09/msg01018.html>
2020-10-06 12:11:58 +02:00
Kyle Meyer bc96649e2e org-id: Add some keywords to the new org-id-ts-format option
* lisp/org-id.el (org-id-ts-format): Add package version and type
keywords.
2020-09-23 22:47:06 -04:00
Ihor Radchenko 6c75b00217 Allow customised ID format for `ts' `org-id-method'
* lisp/org-id.el (org-id-new): Use `org-id-ts-format' as ID format for
`ts' ID generation method.
(org-id-ts-format): New custom variable for `ts' ID format.  The
default value is the same as old hard-coded ID format string.
* etc/ORG-NEWS (New option ~org-id-ts-format~): Announce the new
custom variable.
2020-09-23 10:29:50 +02: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
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
Nicolas Goaziou 37a5020bbe id: Faster `org-id-update-id-locations'
* lisp/org-id.el (org-id-update-id-locations): Do not copy contents of
files in order to parse them.
2020-05-14 22:56:29 +02:00
Kyle Meyer 3c31941139 Fix loading issues related to org-refile.el move
* lisp/org-refile.el (org-directory):
(org-default-notes-file):
(org-reverse-note-order):
(org-outline-path-cache):
(org--get-outline-path-1):
(org-get-outline-path):
(org-format-outline-path):
(org-display-outline-path): Move back to org.el.
* lisp/org-id.el: Require org-refile.
* lisp/org-refile.el: Require org.

f636cf91b (New org-refile.el file with refile definitions, 2020-02-05)
moved refile-related code into a new file, org-refile.el.  This
introduced several dependency issues, which can be seen by running
`make single'.

Many of these issues could be solved by loading org.el in
org-refile.el and loading org-refile in several libraries that depend
on moved functionality.  However, there would still be a circular
dependency because org.el depends on three variables now defined in
org-refile.el.  Also, conceptually there is the problem that the
outline path functionality, despite being used primarily for refile
internally, is now used more generally in third-party code and in a
couple of spots within this repo.

Resolve the above situation by moving the three org-refile.el
variables that org.el needs and the outline path bits back to org.el.

Reported-by: Kaushal Modi <kaushal.modi@gmail.com>
<CAFyQvY1VR5t_a=JO01+QWbUQk_9i8+2XG6W2-mg-DpFzjz9seg@mail.gmail.com>

Reported-by: Ihor Radchenko <yantar92@gmail.com>
<878sj74lfp.fsf@localhost>

Reported-by: Ryan C. Thompson <rct@thompsonclan.org>
<8861c9e9-6c19-ea8f-6a90-7a466782096f@thompsonclan.org>
2020-04-26 01:29:33 -04:00
Kyle Meyer bab2995c71 Merge branch 'maint' 2020-04-20 20:47:24 -04:00
Kyle Meyer c716b7c085 org-id: Allow file name to be overridden on ID creation
* lisp/org-id.el (org-id-overriding-file-name): New variable.
(org-id-get): Prefer org-id-overriding-file-name over the buffer's
file name if set.
(org-id-locations-load): Give a more informative error when file is
nil.
* lisp/org.el (org-clone-subtree-with-time-shift): Let-bind
org-id-overriding-file-name, enabling an ID to be created for a cloned
subtree rather than crashing with a type error.

Note that, before 9865e6bd8 (org-id: Speedup, minor functional change
and fix, 2019-08-01), this wouldn't fail with a type error.  However,
the ID would not be added correctly because org-id-add-location simply
wouldn't process the ID at all if the passed file was nil.

Reported-by: Ian Eure <ian@retrospec.tv>
<87a73caayj.fsf@phaktory>
2020-04-20 20:46:56 -04:00
Gustav Wikström 8e3b73d4dc Allow storing and following ID links before first heading
* lisp/org.el (org-find-property): Make org-find-property work
  correctly also before first heading.

* lisp/org-id.el (org-id-store-link): Make it possible to store ID
  links also before first heading.
2020-04-10 10:04:12 +02: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
Bastien 38928848c7 org-id.el: Fix typo in comment
* lisp/org-id.el (org-id-find-id-file): Fix typo in comment.
2020-02-23 14:29:38 +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
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
Kyle Meyer ff5fc050d3 Update copyright year to 2020 2020-01-01 13:38:46 -05:00
Kyle Meyer d215c3a8c0 Merge branch 'maint' 2019-09-29 15:49:08 -04:00
Juanma Barranquero 001306c1c0 Backport commit 79a01866a from Emacs
* lisp/org-agenda.el (org-agenda-change-all-lines)
(org-agenda-today-p):
* lisp/org-id.el (org-id-get):
* lisp/org.el (org-highlight-latex-and-related)
(org--valid-property-p):
* lisp/ox-beamer.el (org-beamer--get-label):
* lisp/ox-latex.el (org-latex--caption-above-p):
* lisp/ox-odt.el (org-odt--copy-image-file)
(org-odt--copy-formula-file):
* lisp/ox.el (org-export-with-timestamps): Fix typos in docstrings.

lisp/*.el, src/*.c: Fix typos in docstrings
79a01866a01754b9f566af76ef96e80cd90d094b
Juanma Barranquero
Thu Sep 19 04:32:25 2019 +0200
2019-09-29 15:47:57 -04:00
Gustav Wikström dea0c70c7b org-id: Add decimals to ISO 8601 timestamp when used as ID
With nanoseconds precision in the timestamp risk for duplicates shall
be ... near 0 ... even in heavy teamwork-environments or heavily
scripted setups.
2019-09-01 14:48:16 +02:00
Kyle Meyer c7c04b0447 Merge branch 'maint' 2019-08-18 17:44:08 -04:00
Kyle Meyer 24ba689506 org-compat: Add time-convert compatibility wrappers
* lisp/org-compat.el (org-time-convert-to-integer)
(org-time-convert-to-list): New defsubt's to replace common
invocations of time-convert (new in Emacs 27).
* lisp/org-compat.el (org-current-time-as-list): Drop in favor of
org-time-convert-to-list.

These will be used to port changes from the Emacs repo.
2019-08-18 17:31:05 -04:00
Paul Eggert 218e694964 Backport commit c6ba8100e from Emacs
* lisp/org-id.el (org-id-time-to-b36):
Remove unnecessary ‘or’.

Fix minor Org timestamp inefficiencies
c6ba8100ea1db4616d3fe8485430b29143bc3d2e
Paul Eggert
Mon Aug 5 17:38:15 2019 -0700
2019-08-17 09:45:22 -04:00
Paul Eggert 71ce18920a Backport commit 5f3f3884a from Emacs
Improve time function doc
5f3f3884a0d2a88101d330b82ef5b584cfc02aa6
Paul Eggert
Sun Aug 4 10:09:25 2019 -0700
2019-08-17 09:45:22 -04:00
Gustav Wikström b082de626d org-id: Additional id method; ISO8601 timestamp
* New choice in org-id-method

Timestamps can be chosen as org-id-method.  This id-method has the
benefit of being human-readable and has synergies with org-attach if
one likes to organize attachment directories by timestamp instead of
by random names.
2019-08-02 17:02:01 +02:00
Gustav Wikström 9104c0c52d org-id: New customization, org-id-locations-file-relative
* org-id-locations-file-relative

New customization that allows the user to specify that filenames
should be saved relative to the file specified in
org-id-locations-file, instead of being absolute paths.

* org-id-locations-save

Respects new custom variable, org-id-locations-file-relative, and
can save locations with relative filenames.

* org-id-locations-load

Updated to be able to deal with relative filenames if they exist.
2019-08-02 17:00:01 +02:00
Gustav Wikström 9865e6bd8b org-id: Speedup, minor functional change and fix
* org-id-update-id-locations

Major speedup and minor functionality change.  This function is more
predictable now since local open files are not considered.  Providing
files as arguments to the function does no longer override other
files.  They are instead seen as a complement.

* org-id-add-location

Don't add duplicates.

* org-id-hash-to-alist

Fixed function, previously didn't do its job correctly.
2019-08-02 15:35:19 +02:00
Kyle Meyer 81920b3f86 Merge branch 'maint' 2019-06-09 21:39:18 -04:00
Paul Eggert 43bdc85b9d Backport commit 542443645 from Emacs
* lisp/org-id.el (org-id-link-to-org-use-id):
* lisp/org.el (org-support-shift-select, org-file-apps):
Remove backslash-newline that immediately precedes another
newline, as this is not the usual style and is confusing.

Avoid backslash-newline-newline in source code
5424436452bc0b3d8a62a8398f92d0c2db81e22b
Paul Eggert
Wed May 22 23:59:36 2019 -0700
2019-06-09 21:26:08 -04:00
Nicolas Goaziou a486d9cbd7 Move link-related core functions out of "org.el"
* contrib/lisp/org-wl.el (org-wl-store-link-message):
* lisp/Makefile (clean-install):
* lisp/ob-core.el (org-link-bracket-re):
(org-babel-open-src-block-result):
(org-babel-read-element):
(org-babel-read-link):
(org-babel-result-end):
* lisp/ob-tangle.el (org-link-bracket-re):
(org-babel-tangle-single-block):
(org-link-analytic-bracket-re):
(org-babel-detangle):
(org-babel-tangle-jump-to-org):
* lisp/ol.el:
* lisp/org-agenda.el (org-agenda-get-some-entry-text):
(org-diary):
(org-agenda-format-item):
(org-agenda-open-link):
(org-agenda-switch-to):
(org-agenda-to-appt):
* lisp/org-bbdb.el (org-bbdb-store-link):
* lisp/org-bibtex.el (org-bibtex-store-link):
* lisp/org-capture.el (org-capture-fill-template):
* lisp/org-clock.el (org-clocktable-write-default):
(org-clock-get-table-data):
* lisp/org-compat.el (org-doi-server-url):
(org-email-link-description-format):
(org-make-link-description-function):
(org-from-is-user-regexp):
(org-descriptive-links):
(org-url-hexify-p):
(org-context-in-file-links):
(org-keep-stored-link-after-insertion):
(org-display-internal-link-with-indirect-buffer):
(org-confirm-shell-link-function):
(org-confirm-shell-link-not-regexp):
(org-confirm-elisp-link-function):
(org-confirm-elisp-link-not-regexp):
(org-file-complete-link):
(org-email-link-description):
(org-make-link-string):
(org-store-link-props):
(org-add-link-props):
(org-make-link-regexps):
(org-angle-link-re):
(org-plain-link-re):
(org-bracket-link-regexp):
(org-bracket-link-analytic-regexp):
(org-any-link-re):
* lisp/org-docview.el (org-docview-store-link):
(org-docview-complete-link):
* lisp/org-element.el (org-element-link-parser):
* lisp/org-eshell.el (org-eshell-store-link):
* lisp/org-eww.el (org-eww-store-link):
(org-eww-copy-for-org-mode):
* lisp/org-footnote.el (org-footnote-next-reference-or-definition):
* lisp/org-gnus.el (org-gnus-article-link):
(org-gnus-store-link):
* lisp/org-id.el (org-id-store-link):
* lisp/org-info.el (org-info-store-link):
* lisp/org-irc.el (org-irc-erc-store-link):
* lisp/org-mhe.el (org-mhe-store-link):
* lisp/org-pcomplete.el (pcomplete/org-mode/searchhead):
* lisp/org-protocol.el (org-protocol-do-capture):
* lisp/org-rmail.el (org-rmail-store-link):
* lisp/org-w3m.el (org-w3m-store-link):
(org-w3m-copy-for-org-mode):
2019-03-10 18:00:27 +01:00
Paul Eggert 6b5695aabd Backport commit b5e66f46a from Emacs
* lisp/org-id.el: Update RFC citations.

Update citations of Internet RFCs
b5e66f46a6f33f9d633e6cc3e0770a566bdfcf6b
Paul Eggert
Sat Feb 16 12:00:02 2019 -0800
2019-03-03 22:25:22 -05:00
Kyle Meyer d782b01d35 org-compat: Add org-current-time-as-list
* lisp/org-compat.el (org-current-time-as-list): New function for
compatibility with Emacsen before 27.1.

This is a follow-up to the backport of Emacs's 93fe42094.
2019-01-13 12:43:04 -05:00
Paul Eggert 2b6c7e14f2 Backport commit 93fe42094 from Emacs
This follows on a suggestion by Stefan Monnier in:
https://lists.gnu.org/r/emacs-devel/2018-08/msg00991.html
(Bug#32902).

* lisp/org-id.el (org-id-uuid, org-id-time-to-b36):
Don't assume timestamps default to list form.

New (TICKS . HZ) timestamp format
93fe420942c08111a6048af7c4d7807c61d80a09
Paul Eggert
Sat Oct 6 23:31:04 2018 -0700
2019-01-13 12:43:04 -05:00
Bastien f584d37a67 Update copyright year 2019-01-01 11:50:56 +01:00
Nicolas Goaziou 0155441358 Merge branch 'maint' 2018-01-19 18:22:00 +01:00
Tim Landscheidt b289a65be7 Use https for links to orgmode.org
TINYCHANGE
2018-01-19 18:14:58 +01:00
Kyle Meyer d94f7024bc Merge branch 'maint' 2018-01-07 00:28:35 -05:00
Kyle Meyer 3e1641ef0a Update copyright years 2018-01-07 00:27:54 -05:00
Nicolas Goaziou fd50740c96 Merge branch 'maint' 2017-11-04 22:41:07 +01:00