From c94d21ccb3adadfbdb6c0287fb92f2e6babfa249 Mon Sep 17 00:00:00 2001 From: Andrew Hyatt Date: Sat, 20 Jul 2024 23:34:34 -0400 Subject: [PATCH] Fix issue where tags fields values first character was read-only (#151) * Fix issue where tags fields values first character was read-only * Add documentation about fix --- Eldev | 1 + doc/ekg.org | 2 ++ doc/ekg.texi | 10 ++++++++++ ekg-test.el | 28 ++++++++++++++++++++++++++++ ekg.el | 2 +- 5 files changed, 42 insertions(+), 1 deletion(-) diff --git a/Eldev b/Eldev index f84034d..8a7dc8f 100644 --- a/Eldev +++ b/Eldev @@ -2,3 +2,4 @@ (eldev-use-package-archive 'gnu-elpa) (eldev-use-plugin 'maintainer) +(eldev-add-extra-dependencies 'test '(:package markdown-mode :archive melpa)) diff --git a/doc/ekg.org b/doc/ekg.org index 817df8a..8c45069 100644 --- a/doc/ekg.org +++ b/doc/ekg.org @@ -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, diff --git a/doc/ekg.texi b/doc/ekg.texi index 426f617..aac380b 100644 --- a/doc/ekg.texi +++ b/doc/ekg.texi @@ -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. @@ -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. @@ -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 diff --git a/ekg-test.el b/ekg-test.el index 3477824..f6e9e38 100644 --- a/ekg-test.el +++ b/ekg-test.el @@ -25,6 +25,7 @@ (require 'ert) (require 'ert-x) (require 'org) +(require 'markdown-mode) (require 'ekg-test-utils) (ekg-deftest ekg-test-note-lifecycle () @@ -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") diff --git a/ekg.el b/ekg.el index b2b288e..210f537 100644 --- a/ekg.el +++ b/ekg.el @@ -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))))