1
1
Fork
You've already forked auto-id
0
Auto-generate CUSTOM_IDs for Org headlines
  • Emacs Lisp 100%
Find a file
2024年07月29日 14:04:42 +05:30
auto-id.el Use new calling convention for define-minor-mode 2023年07月14日 07:20:32 +05:30
README.org Update Emacs room JID 2024年07月29日 14:04:42 +05:30
tests.el Remove common words from CUSTOM_ID 2022年04月28日 00:13:52 +05:30

auto-id

Donate using Liberapay

Explanation

auto-id is a package to generate CUSTOM_ID properties for Org buffers.

Customization

auto-id provides a great degree of control over CUSTOM_ID generation -

  1. auto-id-ignore-existing is used to prevent existing CUSTOM_IDs from being modified.
  2. auto-id-transformers is used to control the generation of custom IDs. The default value aims to work for most situations. For everything else, the seven included transformer functions can be reused as desired.
  3. auto-id-words-to-remove can be used to remove specific words from a custom ID.
  4. In case of duplication, auto-id-uniquify-functions are used to determine how to make each custom ID unique.

If necessary, any of these may be made file- or directory-local.

TODO

  1. custom IDs based on headline lineage
  2. control over number of words
  3. omit or de-parenthesize text in parenthesis
  4. if the headline is a link with link text, use link text to create the ID

Contributions and contact

Feedback and MRs are very welcome. 🙂

Get in touch with the author and other Emacs users in the Emacs Jabber/XMPP channel - xmpp:emacs@conference.conversations.im?join (web chat)

(For help in getting started with Jabber, click here)

License

I'd like for all software to be liberated - transparent, trustable, and accessible for anyone to use, study, or improve.

I'd like anyone using my software to credit me for the work.

I'd like to receive financial support for my efforts, so I can spend all my time doing what I find meaningful.

But I don't want to make demands or threats (e.g. via legal conditions) to accomplish all that, nor restrict my services to only those who can pay.

Thus, auto-id is released under your choice of Unlicense or the WTFPL.

(See files UNLICENSE and WTFPL).

How-to guides

How to generate CUSTOM_IDs

Just once in the current buffer

To generate CUSTOM_IDs for a single Org mode buffer -

  1. Switch to the buffer
  2. Type M-x auto-id-this-buffer RET

In specific Org files

To enable CUSTOM_ID generation in specific Org files -

  1. Visit the file, then add a file local variable to enable auto-id-mode in it -

    M-x add-file-local-variable RET eval RET (auto-id-mode) RET
  2. Save and revert the buffer

The CUSTOM_IDs will be generated the next time the buffers are saved.

In Org files in a specific directory

To enable CUSTOM_ID generation for all Org files in a directory -

  1. Add a directory-local variable -

    M-x add-dir-local-variable RET org-mode RET eval RET (auto-id-mode) RET
  2. Save the .dir-locals.el buffer
  3. Revert the desired Org buffers

The CUSTOM_IDs will be generated the next time the buffers are saved.

For all Org files

To enable CUSTOM_ID generation in all Org files, add auto-id-mode to org-mode-hook -

(add-hook 'org-mode-hook #'auto-id-mode)

The CUSTOM_IDs will be generated the next time the buffers are saved.