reorg minor mode
This commit is contained in:
parent
d6769ed6e5
commit
4bff412198
1 changed files with 52 additions and 62 deletions
114
um.el
114
um.el
|
|
@ -67,24 +67,6 @@
|
||||||
:group 'um
|
:group 'um
|
||||||
)
|
)
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
;;; faces
|
|
||||||
|
|
||||||
;; TODO: doesn't currently respect um-date-format:
|
|
||||||
(defconst um-date-re (rx
|
|
||||||
line-start
|
|
||||||
(literal ": ")
|
|
||||||
(group (repeat 4 digit)
|
|
||||||
(literal um-date-separator)
|
|
||||||
(repeat 1 2 digit)
|
|
||||||
(literal um-date-separator)
|
|
||||||
(repeat 1 2 digit))
|
|
||||||
line-end
|
|
||||||
)
|
|
||||||
"um date regexp. built from `um-date-separator'. NOTE: currently assumes
|
|
||||||
ISO8601."
|
|
||||||
)
|
|
||||||
|
|
||||||
;; NOTE: regexp-opt wraps the whole expression in (), so I can't omit the -.
|
;; NOTE: regexp-opt wraps the whole expression in (), so I can't omit the -.
|
||||||
(defcustom um-locale-re (regexp-opt '(
|
(defcustom um-locale-re (regexp-opt '(
|
||||||
"- home"
|
"- home"
|
||||||
|
|
@ -96,50 +78,6 @@ ISO8601."
|
||||||
:group 'um
|
:group 'um
|
||||||
)
|
)
|
||||||
|
|
||||||
(defconst um-tag-regexp "^\\+ \\([[:alpha:]\\_\\-]+\\)$"
|
|
||||||
"um tag regexp. Allows hypens and underscores within the tag.")
|
|
||||||
|
|
||||||
(defface font-lock-um-date-face
|
|
||||||
`((((type tty) (class mono)))
|
|
||||||
(t (
|
|
||||||
:inherit shadow
|
|
||||||
)))
|
|
||||||
"um date face"
|
|
||||||
:group 'um
|
|
||||||
)
|
|
||||||
|
|
||||||
(defface font-lock-um-locale-face
|
|
||||||
`((((type tty) (class mono)))
|
|
||||||
(t (
|
|
||||||
:inherit shadow
|
|
||||||
)))
|
|
||||||
"um locale face"
|
|
||||||
:group 'um
|
|
||||||
)
|
|
||||||
|
|
||||||
(defface font-lock-um-tag-face
|
|
||||||
`((((type tty) (class mono)))
|
|
||||||
(t (
|
|
||||||
:inherit shadow
|
|
||||||
)))
|
|
||||||
"um tag face"
|
|
||||||
:group 'um
|
|
||||||
)
|
|
||||||
|
|
||||||
(font-lock-add-keywords 'markdown-mode
|
|
||||||
`(
|
|
||||||
(,um-date-re 1 'font-lock-um-date-face)
|
|
||||||
(,um-locale-re 0 'font-lock-um-locale-face)
|
|
||||||
(,um-tag-regexp 1 'font-lock-um-tag-face)
|
|
||||||
))
|
|
||||||
|
|
||||||
(defvar um-minor-mode-keywords
|
|
||||||
`(
|
|
||||||
(,um-date-re 1 'font-lock-um-date-face)
|
|
||||||
(,um-locale-re 0 'font-lock-um-locale-face)
|
|
||||||
(,um-tag-regexp 1 'font-lock-um-tag-face)
|
|
||||||
))
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;; find-file-at-point
|
;;; find-file-at-point
|
||||||
|
|
||||||
|
|
@ -387,6 +325,58 @@ A tag with a value of \"+\" is rendered as the descriptor portion of the filenam
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;; um-minor-mode : under markdown-mode
|
;;; um-minor-mode : under markdown-mode
|
||||||
|
|
||||||
|
;; TODO: doesn't currently respect um-date-format:
|
||||||
|
(defconst um-date-re (rx
|
||||||
|
line-start
|
||||||
|
(literal ": ")
|
||||||
|
(group (repeat 4 digit)
|
||||||
|
(literal um-date-separator)
|
||||||
|
(repeat 1 2 digit)
|
||||||
|
(literal um-date-separator)
|
||||||
|
(repeat 1 2 digit))
|
||||||
|
line-end
|
||||||
|
)
|
||||||
|
"um date regexp. built from `um-date-separator'. NOTE: currently assumes
|
||||||
|
ISO8601."
|
||||||
|
)
|
||||||
|
|
||||||
|
(defconst um-tag-regexp "^\\+ \\([[:alpha:]\\_\\-]+\\)$"
|
||||||
|
"um tag regexp. Allows hypens and underscores within the tag.")
|
||||||
|
|
||||||
|
(defface font-lock-um-date-face
|
||||||
|
`((((type tty) (class mono)))
|
||||||
|
(t (
|
||||||
|
:inherit shadow
|
||||||
|
)))
|
||||||
|
"um date face"
|
||||||
|
:group 'um
|
||||||
|
)
|
||||||
|
|
||||||
|
(defface font-lock-um-locale-face
|
||||||
|
`((((type tty) (class mono)))
|
||||||
|
(t (
|
||||||
|
:inherit shadow
|
||||||
|
)))
|
||||||
|
"um locale face"
|
||||||
|
:group 'um
|
||||||
|
)
|
||||||
|
|
||||||
|
(defface font-lock-um-tag-face
|
||||||
|
`((((type tty) (class mono)))
|
||||||
|
(t (
|
||||||
|
:inherit shadow
|
||||||
|
)))
|
||||||
|
"um tag face"
|
||||||
|
:group 'um
|
||||||
|
)
|
||||||
|
|
||||||
|
(defvar um-minor-mode-keywords
|
||||||
|
`(
|
||||||
|
(,um-date-re 1 'font-lock-um-date-face)
|
||||||
|
(,um-locale-re 0 'font-lock-um-locale-face)
|
||||||
|
(,um-tag-regexp 1 'font-lock-um-tag-face)
|
||||||
|
))
|
||||||
|
|
||||||
(defvar-keymap um-minor-mode-map
|
(defvar-keymap um-minor-mode-map
|
||||||
:doc "Keymap for `um-minor-mode'."
|
:doc "Keymap for `um-minor-mode'."
|
||||||
"M-s t" #'um-tag-grep
|
"M-s t" #'um-tag-grep
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue