um-mode is the featurep and filename, no more CLI hook
This commit is contained in:
parent
808eaeef00
commit
64840e1a92
1 changed files with 8 additions and 40 deletions
|
|
@ -1,13 +1,13 @@
|
|||
;;; um.el --- An Ultralight database for Markdown composition. -*- lexical-binding: t -*-
|
||||
;;; um-mode.el --- An Ultralight database for Markdown composition. -*- lexical-binding: t -*-
|
||||
|
||||
;; by bth
|
||||
;; Version: 0.1
|
||||
;; Version: 0.2
|
||||
|
||||
;; Um is an ultralight database design and emacs toolkit for organizing writing
|
||||
;; into larger compositions. It consists of two parts:
|
||||
;;
|
||||
;; 1. Elisp for functionality within emacs.
|
||||
;; 2. Go for the commandline interface.
|
||||
;; 1. `um' commandline interface: https://git.bth.moi/bth/um
|
||||
;; 2. `um-mode' and `um-minor-mode' within emacs: https://git.bth.moi/bth/um-mode
|
||||
;;
|
||||
;; This is somewhat like org-roam, except without any database dependency. (And
|
||||
;; it assumes Markdown rather than org, which I don't care for.)
|
||||
|
|
@ -57,12 +57,6 @@
|
|||
:group 'um
|
||||
)
|
||||
|
||||
(defcustom um-date-separator "-"
|
||||
"Seperator used in date strings, used by `um--date-format' and `um--date-re'."
|
||||
:type '(string)
|
||||
:group 'um
|
||||
)
|
||||
|
||||
;; NOTE: regexp-opt wraps the whole expression in (), so I can't omit the -.
|
||||
(defcustom um-locale-re (regexp-opt '(
|
||||
"- home"
|
||||
|
|
@ -74,21 +68,17 @@
|
|||
:group 'um
|
||||
)
|
||||
|
||||
(defconst um--date-format (concat "%Y" um-date-separator "%m" um-date-separator "%d")
|
||||
"Format passed to `format-time-string' when creating
|
||||
`um--header'. ISO8601 with a custom `um-date-separator'.")
|
||||
|
||||
(defconst um--date-re (rx
|
||||
line-start
|
||||
(literal ": ")
|
||||
(group (repeat 4 digit)
|
||||
(literal um-date-separator)
|
||||
(literal ".")
|
||||
(repeat 1 2 digit)
|
||||
(literal um-date-separator)
|
||||
(literal ".")
|
||||
(repeat 1 2 digit))
|
||||
line-end
|
||||
)
|
||||
"um date regexp. built from `um-date-separator'."
|
||||
"um date regexp."
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
|
@ -347,28 +337,6 @@ Prefix arg prompts for the directory instead.
|
|||
(ispell-buffer)
|
||||
))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; CLI
|
||||
|
||||
(defun um--header (filename &optional tags)
|
||||
"Create a header composed of:
|
||||
|
||||
# filename
|
||||
: date
|
||||
+ tags
|
||||
|
||||
"
|
||||
(with-temp-buffer (insert
|
||||
(format "# %s\n: %s%s" filename (format-time-string um--date-format) um--header-end))
|
||||
(when tags
|
||||
(forward-line -1)
|
||||
(dolist (tag (split-string tags ","))
|
||||
(insert (format "+ %s\n"
|
||||
(if (equal "+" tag)
|
||||
(cadr (split-string filename "\\."))
|
||||
tag)))))
|
||||
(buffer-string)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; um-minor-mode
|
||||
;;
|
||||
|
|
@ -640,7 +608,7 @@ A negative prefix argument moves it backward.
|
|||
(cursor-intangible-mode)
|
||||
(read-only-mode))
|
||||
|
||||
(provide 'um)
|
||||
(provide 'um-mode)
|
||||
|
||||
;; Local Variables:
|
||||
;; outline-regexp: ";;;+ [^;]+"
|
||||
Loading…
Reference in a new issue