Skip to content

Commit

Permalink
Allow emoji tags (#156)
Browse files Browse the repository at this point in the history
This should fix #149.
  • Loading branch information
ahyatt authored Jul 21, 2024
1 parent d54ddd2 commit 8bf0145
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions doc/ekg.org
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ triples library is already installed.
- Use the global keymap in the note metadata region.
- Run tag hooks when a valid tag is typed, instead of relying on completion, which often doesn't work.
- Fix issue in =markdown-mode= where the beginning of the tag values was incorrectly read-only.
- Allow emojis as tags.
** Version 0.6.0
- Add tag and similar notes to the context when having LLMs add to or replace
notes. ~ekg-llm-default-instructions~ replaces the previous variable,
Expand Down
2 changes: 2 additions & 0 deletions doc/ekg.texi
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ Use the global keymap in the note metadata region.
Run tag hooks when a valid tag is typed, instead of relying on completion, which often doesn't work.
@item
Fix issue in @samp{markdown-mode} where the beginning of the tag values was incorrectly read-only.
@item
Allow emojis as tags.
@end itemize

@node Version 060
Expand Down
6 changes: 6 additions & 0 deletions ekg-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,12 @@
(ekg--convert-inline-tags-to-links note)
(should (equal (ekg-note-text note) "foo #[[ekg-tag:bar][bar]]"))))

(ert-deftest ekg-test-convert-emoji-tags-to-links ()
(let ((note (make-ekg-note :text "foo #[🦜]")))
(ekg--populate-inline-tags note)
(ekg--convert-inline-tags-to-links note)
(should (equal (ekg-note-text note) "foo #[[ekg-tag:🦜][🦜]]"))))

(provide 'ekg-test)

;;; ekg-test.el ends here
8 changes: 6 additions & 2 deletions ekg.el
Original file line number Diff line number Diff line change
Expand Up @@ -1065,11 +1065,15 @@ prefix."
tag
(concat (assoc-default (string-to-char tag-symbol)
ekg-inline-custom-tag-completion-symbols) "/" tag)))

(defconst ekg--nonlink-tag-regexp
(rx (seq (group-n 1 (or whitespace line-start ?: ?\( ?\[))
(group-n 2 (regexp (ekg--possible-inline-tags-prefix-regexp)))
(= 1 ?\[) (group-n 3 (not ?+) (one-or-more (any word ?/ ?_ ?- whitespace))) ?\]))
(= 1 ?\[) (group-n 3 (one-or-more (or (any ?/ ?_ ?-)
word
(any "🏻-🏿")
(char (128000 . 129750))
whitespace)))
?\]))
"Regexp for detecting inline tags that are not org links.")

(defun ekg--inline-tag-replace-with-org-link (prefix tag-identifier symbol)
Expand Down

0 comments on commit 8bf0145

Please sign in to comment.