Skip to content

Latest commit

 

History

History
87 lines (65 loc) · 2.93 KB

README.org

File metadata and controls

87 lines (65 loc) · 2.93 KB

Introduction

This package extends ‘zk’ and ‘zk-index’ to include support for working with files assigned Luhmann-style IDs.

A demo of this package can be viewed here: https://youtu.be/O6iSV4pQQ5g

Luhmann-style IDs are alphanumeric sequences that immediately follow the zk-id in a note’s filename. By default, the Luhmann ID is surrounded by parentheses, with each character in the ID delimited by a comma. A note with such a Luhmann ID will have a file name that looks something like:

“202012101215 (1,1,a,3,c) The origin of species.md”

Because all files with Luhmann IDs have normal zk-ids, they are normal zk-files. As a result, the naming and ID scheme supported by this package simply offers a different organizing scheme within a zk. It is both fully integrated with zk while being, nevertheless, completely distinct — a system within a system.

Setup

After setting up ‘zk’ and ‘zk-index’, load zk-luhmann and set the variables as desired:

(add-to-list 'load-path "/path/to/zk-luhmann.el")
(require 'zk-luhmann)

(setq zk-luhmann-id-prefix "{"
      zk-luhmann-id-postfix "}"
      zk-luhmann-id-delimiter ",")

(setq zk-luhmann-indent-index t)

Note that if you change the above variables, you should ensure that the zk-luhmann-id-regexp is set properly by subsequently (re)evaluating the following:

(setq zk-luhmann-id-regexp (concat zk-luhmann-id-prefix
                                   "\\([0-9a-zA-Z"
                                   zk-luhmann-id-delimiter
                                   "]*\\)"
                                   zk-luhmann-id-postfix)

Finally, add zk-luhmann functions to zk-index-map, by include the following to your config file, substituting whatever keybindings you like:

(define-key zk-index-map (kbd "L") #'zk-luhmann-index-sort)
(define-key zk-index-map (kbd "l") #'zk-luhmann-index)
(define-key zk-index-map (kbd "C-f") #'zk-luhmann-index-forward)
(define-key zk-index-map (kbd "C-b") #'zk-luhmann-index-back)
(define-key zk-index-map (kbd "C-t") #'zk-luhmann-index-unfold)
(define-key zk-index-map (kbd "t") #'zk-luhmann-index-top)

Or, with use-package:

(use-package zk-luhmann
  :bind (:map zk-index-map
              ("L" . zk-luhmann-index-sort)
              ("l" . zk-luhmann-index)
              ("C-f" . zk-luhmann-index-forward)
              ("C-b" . zk-luhmann-index-back)
              ("C-t" . zk-luhmann-index-unfold)
              ("t" . zk-luhmann-index-top))
  :custom
  (zk-luhmann-id-prefix "{")
  (zk-luhmann-id-postfix "}")
  (zk-luhmann-indent-index t))

Completion-at-point

To add completion at point for files with Luhmann-style IDs, evaluate the following:

(add-hook 'completion-at-point-functions
          #'zk-luhmann-completion-at-point 'append)