Files
org-roam/20230522134437-org_marginalia.org
2025-11-05 09:18:11 +01:00

65 lines
4.0 KiB
Org Mode
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
:PROPERTIES:
:ID: 7f5dafdd-7d74-4551-bd7b-666729b1c1d4
:END:
#+title: org-marginalia
Org-marginalia ist ein [[id:5f1df0e1-384f-4685-ae1e-fec2431b04e5][emacs]] addon Package, welches es ermöglicht, Notes an ordinäre .org-Files anzuhängen und diese auch zu markieren. Dieses Package ist nicht in [[id:79bae242-a2b4-4753-9960-1f929c8c6300][melpa]] enthalten und muss deshalb über die Befehle
#+begin_src emacs-lisp
(add-to-list 'load-path "~/.emacs.d/packages/marginalia")
#+end_src
und
#+begin_src emacs-lisp
(require 'org-marginalia)
#+end_src
Eingefügt werden.
Außerdem wird der Mode noch in die Texthook eingefügt.
#+begin_src emacs-lisp
(setq om/notes-file-path "~/org/annotations/file-notes/diss_notes.org")
(add-hook 'after-init-hook (lambda()
(add-to-list 'load-path "~/local-repos/org-marginalia/")
(require 'org-marginalia)
(add-hook 'text-mode-hook #'org-marginalia-mode 1)
#+end_src
Die Markierungen müssen manuell über ~om/save~ gespeichert werden, ansonsten muss das in die "after-save-hook"
* Befehle
** ~org-marginalia-mode~
Org-marginalia is a local minor mode. Toggle it on/off with using org-marginalia-mode. On activating, it loads your saved highlights from the marginalia file (defined by om/notes-file-path), and enables automatic saving of highlights. The automatic saving is achieved via function om/save added to after-save-hook.
** ~om/mark~ (C-c m by default)
Select a region of text, and call om/mark to highlight the region. It will generate a new ID, and start tracking the location so you can edit text around the highlighted text. Do not cut, copy and paste as the highlight will disappear and it is a bit tricky to recover it. To create a new margin note entry in the marginalia file, save the buffer.
** ~om/save~
By default, Org-marginalia automatically creates or updates corresponding entries in the marginalia file with location and text of highlights on saving the buffer. Nevertheless, you can manually call om/save to do so (automatic process also call this command).
** ~om/open~ (C-c n o by default)
Move your cursor on the highlighted text, and call om/open to open the relevant margin notes in a separate window. Your cursor will move to the marginalia buffer narrowed to the relevant margin notes entry. You can edit the marginalia buffer as a normal Org buffer. Once you have done editing, you may simply save and close the it (kill it or close the window) as per your normal workflow. Technically, the marginalia buffer is a cloned indirect buffer of the marginalia file.
** ~om/load~
This command visits the marginalia file and loads the saved highlights onto the current buffer. If there is no margin notes for it, it will output a message in the echo. Highlights tracked locally by Org-marginalia cannot persist when you kill the buffer, or quit Emacs. When you re-launch Emacs, ensure to turn on org-marginalia-mode to load the highlights. Loading is automatically done when you activate the minor mode.
** ~om/remove~
This command removes the highlight at point. It will remove the highlight, and remove the properties from the marginalia, but will keep the headline and notes in tact.
** ~om/next~ (C-c n ] by default)
Move to the next highlight if any. If there is none below the cursor, and there is a highlight above, loop back to the top one.
** ~om/prev~ (C-c n [ by default)
Move to the previous highlight if any. If there is none above the cursor, and there is a highlight below, loop back to the bottom one.
** ~om/toggle~
Toggle showing/hiding of highlighters in current buffer. It only affects the display of the highlighters. When hidden, highlights locations are still kept tracked; thus, upon buffer-save the correct locations are still recorded in the marginalia file.
* Customizing
You can customize settings in the ~org-marginalia~ group.
Highlights face can be changed via ~om/highlighter~
Marginalia file is defined by ~om/notes-file-path~