Skip to content

Commit

Permalink
Fix issue where tags fields values first character was read-only (#151)
Browse files Browse the repository at this point in the history
* Fix issue where tags fields values first character was read-only

* Add documentation about fix
  • Loading branch information
ahyatt authored Jul 21, 2024
1 parent f92d6c9 commit c94d21c
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 1 deletion.
1 change: 1 addition & 0 deletions Eldev
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

(eldev-use-package-archive 'gnu-elpa)
(eldev-use-plugin 'maintainer)
(eldev-add-extra-dependencies 'test '(:package markdown-mode :archive melpa))
2 changes: 2 additions & 0 deletions doc/ekg.org
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ triples library is already installed.
(require 'ekg)
#+end_src
* Changelog
** Version 0.7.0
- Fix issue in =markdown-mode= where the beginning of the tag values was incorrectly read-only.
** 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
10 changes: 10 additions & 0 deletions doc/ekg.texi
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Installation
Changelog
* Version 0.7.0: Version 070.
* Version 0.6.0: Version 060.
* Version 0.5.1: Version 051.
* Version 0.5: Version 05.
Expand Down Expand Up @@ -198,6 +199,7 @@ triples library is already installed.
@chapter Changelog

@menu
* Version 0.7.0: Version 070.
* Version 0.6.0: Version 060.
* Version 0.5.1: Version 051.
* Version 0.5: Version 05.
Expand All @@ -213,6 +215,14 @@ triples library is already installed.
* Version 0.2: Version 02.
@end menu

@node Version 070
@section Version 0.7.0

@itemize
@item
Fix issue in @samp{markdown-mode} where the beginning of the tag values was incorrectly read-only.
@end itemize

@node Version 060
@section Version 0.6.0

Expand Down
28 changes: 28 additions & 0 deletions ekg-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
(require 'ert)
(require 'ert-x)
(require 'org)
(require 'markdown-mode)
(require 'ekg-test-utils)

(ekg-deftest ekg-test-note-lifecycle ()
Expand Down Expand Up @@ -316,6 +317,33 @@
(should (= (overlay-end o) (+ 1 (length "Tags: test\n"))))
(should (= (point) (overlay-end o))))))

(ekg-deftest ekg-test-metadata-read-only ()
(dolist (mode '(org-mode markdown-mode text-mode))
(let ((ekg-capture-default-mode mode))
(cl-loop for i from 1 to 10
do
(ekg-capture)
;; TODO(ahyatt) Find out why this is necessary to reproduce bad
;; behavior.
(funcall mode)
(goto-char i)
(cond
((= i 1)
(ert-info
((format "%s: Inserting text at position %d in beginning of the line should be allowed."
mode i))
(insert "foo")))
((> i (length "Tags: "))
(ert-info
((format "%s: Inserting text at position %d in the field value should be allowed."
mode i))
(insert "foo")))
(t (ert-info
((format "%s: Inserting text at position %d in the tag field name should not be allowed."
mode i))
(should-error (insert "foo")))))
(kill-buffer)))))

(ekg-deftest ekg-test-draft ()
(ekg-capture :tags '("test"))
(insert "foo")
Expand Down
2 changes: 1 addition & 1 deletion ekg.el
Original file line number Diff line number Diff line change
Expand Up @@ -1237,7 +1237,7 @@ This will be displayed at the top of the note buffer."
(format "%s%s%s"
(concat
(propertize (concat property ":") 'face 'bold 'read-only read-only)
(propertize " " 'read-only read-only 'rear-nonsticky t))
(propertize " " 'read-only nil 'rear-nonsticky t))
value
(propertize "\n" 'read-only read-only 'rear-nonsticky t))))

Expand Down

0 comments on commit c94d21c

Please sign in to comment.