summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-10-06 08:35:08 +0300
committerThanos Apollo <[email protected]>2024-10-06 08:36:24 +0300
commit4f437a3b23090d2591eb36a26c146ff3595a6256 (patch)
tree417e875c5e38e3dec5b039e5b28525884e96e40b
parentab33f0564fb0fe189664e4fafc869975f9a65941 (diff)
parentfd1315830e3aedf5d7cedc8410ec4f4bc2b781f0 (diff)
Release version 0.4.4.0.4.4
* Add clear-history functions * Refactor review actions to use read-char-choice. This now allows for users to switch buffers during review sessions.
-rw-r--r--doc/gnosis.info154
-rw-r--r--doc/gnosis.org80
-rw-r--r--doc/gnosis.texi94
-rw-r--r--gnosis-dashboard.el83
-rw-r--r--gnosis.el72
5 files changed, 255 insertions, 228 deletions
diff --git a/doc/gnosis.info b/doc/gnosis.info
index b57f067..252fe79 100644
--- a/doc/gnosis.info
+++ b/doc/gnosis.info
@@ -1,4 +1,4 @@
-This is gnosis.info, produced by .texi2any-real version 7.1 from
+This is gnosis.info, produced by .texi2any-real version 7.1.1 from
gnosis.texi.
INFO-DIR-SECTION Emacs misc features
@@ -19,10 +19,15 @@ learning environment tailored to each specific topic/subject.
This manual is written for Gnosis version 0.4.2, released on 2024-09-5.
- • Official manual:
+ • Manual:
• <https://elpa.nongnu.org/nongnu/doc/gnosis.html>
+ • <https://thanosapollo.org/projects/gnosis/> (Mirror)
• Git repositories:
• <https://git.thanosapollo.org/gnosis>
+ • <https://codeberg.org/thanosapollo/emacs-gnosis> (Mirror)
+ •
+ <https://git.savannah.gnu.org/cgit/emacs/nongnu.git/?h=elpa/gnosis>
+ (Mirror)
* Menu:
@@ -32,8 +37,9 @@ This manual is written for Gnosis version 0.4.2, released on 2024-09-5.
* Customization::
* Gnosis Algorithm::
* Editing notes::
-* Sync between devices::
* Configuring Note Types::
+* Sync between devices::
+* Interactions with other software::
-- The Detailed Node Listing --
@@ -61,6 +67,10 @@ Configuring Note Types
* Custom Note Types::
* Development::
+Interactions with other software
+
+* emacs-no-littering::
+

File: gnosis.info, Node: Introduction, Next: Adding notes, Prev: Top, Up: Top
@@ -336,7 +346,7 @@ next interval value: 0 days (0), 1 day later (1), 2 days later (2), and
successful reviews, it's next review date will be on the same date.

-File: gnosis.info, Node: Editing notes, Next: Sync between devices, Prev: Gnosis Algorithm, Up: Top
+File: gnosis.info, Node: Editing notes, Next: Configuring Note Types, Prev: Gnosis Algorithm, Up: Top
6 Editing notes
***************
@@ -348,38 +358,9 @@ File: gnosis.info, Node: Editing notes, Next: Sync between devices, Prev: Gno
note you want to edit and press ‘e’

-File: gnosis.info, Node: Sync between devices, Next: Configuring Note Types, Prev: Editing notes, Up: Top
-
-7 Sync between devices
-**********************
-
-Gnosis uses git to maintain data integrity and facilitate
-synchronization across devices.
-
- You will need to configure your remote manually.
-
- Example:
-
- cd ~/.emacs.d/gnosis # default location for gnosis
- git init # After completing your first review session, a git repo should have been initialized automatically.
- git remote add origin <remote_url>
- git push --set-upstream origin master
-
- You can interactively use ‘gnosis-vc-push’ & ‘gnosis-vc-pull’. As
-the name suggests, they rely on ‘vc’ to work properly.
-
- Depending on your setup, ‘vc’ might require an external package for
-the ssh passphrase dialog, such as ‘x11-ssh-askpass’.
-
- To automatically push changes after a review session, add this to
-your configuration:
- (setf gnosis-vc-auto-push t)
- (gnosis-vc-pull) ;; Run vc-pull for gnosis on startup
-
-
-File: gnosis.info, Node: Configuring Note Types, Prev: Sync between devices, Up: Top
+File: gnosis.info, Node: Configuring Note Types, Next: Sync between devices, Prev: Editing notes, Up: Top
-8 Configuring Note Types
+7 Configuring Note Types
************************
* Menu:
@@ -390,7 +371,7 @@ File: gnosis.info, Node: Configuring Note Types, Prev: Sync between devices,

File: gnosis.info, Node: Custom Note Types, Next: Development, Up: Configuring Note Types
-8.1 Custom Note Types
+7.1 Custom Note Types
=====================
Each gnosis note type has an _interactive_ function, named
@@ -418,7 +399,7 @@ prompted to enter anything for ‘extra’ & ‘images’.

File: gnosis.info, Node: Development, Prev: Custom Note Types, Up: Configuring Note Types
-8.2 Development
+7.2 Development
===============
To make development and customization easier, gnosis comes with
@@ -428,30 +409,87 @@ for testing.
To exit the testing environment, rerun ‘M-x gnosis-test-start’ and
then enter ‘n’ (no) at the prompt "Start development env?"
+
+File: gnosis.info, Node: Sync between devices, Next: Interactions with other software, Prev: Configuring Note Types, Up: Top
+
+8 Sync between devices
+**********************
+
+Gnosis uses git to maintain data integrity and facilitate
+synchronization across devices.
+
+ You will need to configure your remote manually.
+
+ Example:
+
+ cd ~/.emacs.d/gnosis # default location for gnosis, no-littering is ~/.emacs.d/var/gnosis
+ git init # After completing your first review session, a git repo should have been initialized automatically.
+ git remote add origin <remote_url>
+ git push --set-upstream origin master
+
+ You can interactively use ‘gnosis-vc-push’ & ‘gnosis-vc-pull’. As
+the name suggests, they rely on ‘vc’ to work properly.
+
+ Depending on your setup, ‘vc’ might require an external package for
+the ssh passphrase dialog, such as ‘x11-ssh-askpass’.
+
+ To automatically push changes after a review session, add this to
+your configuration:
+ (setf gnosis-vc-auto-push t)
+ (gnosis-vc-pull) ;; Run vc-pull for gnosis on startup
+
+
+File: gnosis.info, Node: Interactions with other software, Prev: Sync between devices, Up: Top
+
+9 Interactions with other software
+**********************************
+
+* Menu:
+
+* emacs-no-littering::
+
+
+File: gnosis.info, Node: emacs-no-littering, Up: Interactions with other software
+
+9.1 emacs-no-littering
+======================
+
+If you are a user of emacs-no-littering
+(https://github.com/emacscollective/no-littering), you can theme Gnosis
+to fit its standards by adding the following snippet to your
+configuration:
+
+ (setq gnosis-dir (no-littering-expand-var-file-name "gnosis/"))
+
+ This sets ‘gnosis-dir’ to ‘~/.emacs.d/var/gnosis’, in line with the
+folders of other packages.
+

Tag Table:
-Node: Top250
-Node: Introduction1341
-Node: Adding notes2354
-Node: Note Types2765
-Node: Cloze2983
-Node: MC-Cloze (Under development)4145
-Node: MCQ5133
-Node: Basic Type5571
-Node: Double5847
-Node: y-or-n6113
-Node: Customization6515
-Node: Image size6700
-Node: Typos | String Comparison6986
-Node: Gnosis Algorithm7761
-Node: Anagnosis Event8408
-Node: Proto9149
-Node: Editing notes9916
-Node: Sync between devices10308
-Node: Configuring Note Types11335
-Node: Custom Note Types11525
-Node: Development12735
+Node: Top252
+Node: Introduction1674
+Node: Adding notes2687
+Node: Note Types3098
+Node: Cloze3316
+Node: MC-Cloze (Under development)4478
+Node: MCQ5466
+Node: Basic Type5904
+Node: Double6180
+Node: y-or-n6446
+Node: Customization6848
+Node: Image size7033
+Node: Typos | String Comparison7319
+Node: Gnosis Algorithm8094
+Node: Anagnosis Event8741
+Node: Proto9482
+Node: Editing notes10249
+Node: Configuring Note Types10643
+Node: Custom Note Types10855
+Node: Development12065
+Node: Sync between devices12484
+Node: Interactions with other software13569
+Node: emacs-no-littering13774

End Tag Table
diff --git a/doc/gnosis.org b/doc/gnosis.org
index 9d0efb9..c912ca6 100644
--- a/doc/gnosis.org
+++ b/doc/gnosis.org
@@ -4,8 +4,8 @@
#+language: en
#+options: ':t toc:nil author:t email:t num:t
#+startup: content
-#+macro: stable-version 0.4.2
-#+macro: release-date 2024-09-5
+#+macro: stable-version 0.4.4
+#+macro: release-date 2024-10-06
#+macro: file @@texinfo:@file{@@$1@@texinfo:}@@
#+macro: space @@texinfo:@: @@
#+macro: kbd @@texinfo:@kbd{@@$1@@texinfo:}@@
@@ -30,10 +30,13 @@ learning environment tailored to each specific topic/subject.
#+texinfo: @noindent
This manual is written for Gnosis version {{{stable-version}}}, released on {{{release-date}}}.
-+ Official manual:
++ Manual:
+ <https://elpa.nongnu.org/nongnu/doc/gnosis.html>
+ + <https://thanosapollo.org/projects/gnosis/> (Mirror)
+ Git repositories:
+ <https://git.thanosapollo.org/gnosis>
+ + <https://codeberg.org/thanosapollo/emacs-gnosis> (Mirror)
+ + <https://git.savannah.gnu.org/cgit/emacs/nongnu.git/?h=elpa/gnosis> (Mirror)
#+texinfo: @insertcopying
@@ -185,7 +188,6 @@ difference of at most one character edit.
To demonstrate, 'example' and 'examples' will be recognized as
similar, considering that the latter involves just one additional
character."
-
* Gnosis Algorithm
Each gnosis note has a gnosis score, which is a list of 3 values,
@@ -238,35 +240,6 @@ it's next review date will be on the same date.
+ You can edit a note after review by pressing ~e~
+ Open =gnosis-dashboard= with =M-x gnosis-dashboard=, find the note you want to edit and press ~e~
-* Sync between devices
-
-Gnosis uses git to maintain data integrity and facilitate
-synchronization across devices.
-
-You will need to configure your remote manually.
-
-Example:
-
-#+begin_src bash
- cd ~/.emacs.d/gnosis # default location for gnosis
- git init # After completing your first review session, a git repo should have been initialized automatically.
- git remote add origin <remote_url>
- git push --set-upstream origin master
-#+end_src
-
-
-You can interactively use =gnosis-vc-push= & =gnosis-vc-pull=. As the
-name suggests, they rely on =vc= to work properly.
-
-Depending on your setup, =vc= might require an external package for
-the ssh passphrase dialog, such as ~x11-ssh-askpass~.
-
-To automatically push changes after a review session, add this to your configuration:
-#+begin_src emacs-lisp
-(setf gnosis-vc-auto-push t)
-(gnosis-vc-pull) ;; Run vc-pull for gnosis on startup
-#+end_src
-
* Configuring Note Types
** Custom Note Types
Each gnosis note type has an /interactive/ function, named
@@ -300,3 +273,44 @@ testing.
To exit the testing environment, rerun =M-x gnosis-test-start= and
then enter =n= (no) at the prompt "Start development env?"
+
+* Sync between devices
+
+Gnosis uses git to maintain data integrity and facilitate
+synchronization across devices.
+
+You will need to configure your remote manually.
+
+Example:
+
+#+begin_src bash
+ cd ~/.emacs.d/gnosis # default location for gnosis, no-littering is ~/.emacs.d/var/gnosis
+ git init # After completing your first review session, a git repo should have been initialized automatically.
+ git remote add origin <remote_url>
+ git push --set-upstream origin master
+#+end_src
+
+
+You can interactively use =gnosis-vc-push= & =gnosis-vc-pull=. As the
+name suggests, they rely on =vc= to work properly.
+
+Depending on your setup, =vc= might require an external package for
+the ssh passphrase dialog, such as ~x11-ssh-askpass~.
+
+To automatically push changes after a review session, add this to your configuration:
+#+begin_src emacs-lisp
+(setf gnosis-vc-auto-push t)
+(gnosis-vc-pull) ;; Run vc-pull for gnosis on startup
+#+end_src
+
+* Interactions with other software
+** emacs-no-littering
+
+If you are a user of [[https://github.com/emacscollective/no-littering][emacs-no-littering]], you can theme Gnosis to fit
+its standards by adding the following snippet to your configuration:
+
+#+begin_src emacs-lisp
+(setq gnosis-dir (no-littering-expand-var-file-name "gnosis/"))
+#+end_src
+
+This sets =gnosis-dir= to =~/.emacs.d/var/gnosis=, in line with the folders of other packages.
diff --git a/doc/gnosis.texi b/doc/gnosis.texi
index e5cc81f..4816566 100644
--- a/doc/gnosis.texi
+++ b/doc/gnosis.texi
@@ -35,16 +35,22 @@ This manual is written for Gnosis version 0.4.2, released on 2024-09-5.
@itemize
@item
-Official manual:
+Manual:
@itemize
@item
@uref{https://elpa.nongnu.org/nongnu/doc/gnosis.html}
+@item
+@uref{https://thanosapollo.org/projects/gnosis/} (Mirror)
@end itemize
@item
Git repositories:
@itemize
@item
@uref{https://git.thanosapollo.org/gnosis}
+@item
+@uref{https://codeberg.org/thanosapollo/emacs-gnosis} (Mirror)
+@item
+@uref{https://git.savannah.gnu.org/cgit/emacs/nongnu.git/?h=elpa/gnosis} (Mirror)
@end itemize
@end itemize
@@ -59,8 +65,9 @@ Git repositories:
* Customization::
* Gnosis Algorithm::
* Editing notes::
-* Sync between devices::
* Configuring Note Types::
+* Sync between devices::
+* Interactions with other software::
@detailmenu
--- The Detailed Node Listing ---
@@ -89,6 +96,10 @@ Configuring Note Types
* Custom Note Types::
* Development::
+Interactions with other software
+
+* emacs-no-littering::
+
@end detailmenu
@end menu
@@ -350,36 +361,6 @@ Open @samp{gnosis-dashboard} with @samp{M-x gnosis-dashboard}, find the note you
@end itemize
@end itemize
-@node Sync between devices
-@chapter Sync between devices
-
-Gnosis uses git to maintain data integrity and facilitate
-synchronization across devices.
-
-You will need to configure your remote manually.
-
-Example:
-
-@example
-cd ~/.emacs.d/gnosis # default location for gnosis
-git init # After completing your first review session, a git repo should have been initialized automatically.
-git remote add origin <remote_url>
-git push --set-upstream origin master
-@end example
-
-
-You can interactively use @samp{gnosis-vc-push} & @samp{gnosis-vc-pull}. As the
-name suggests, they rely on @samp{vc} to work properly.
-
-Depending on your setup, @samp{vc} might require an external package for
-the ssh passphrase dialog, such as @code{x11-ssh-askpass}.
-
-To automatically push changes after a review session, add this to your configuration:
-@lisp
-(setf gnosis-vc-auto-push t)
-(gnosis-vc-pull) ;; Run vc-pull for gnosis on startup
-@end lisp
-
@node Configuring Note Types
@chapter Configuring Note Types
@@ -425,4 +406,53 @@ testing.
To exit the testing environment, rerun @samp{M-x gnosis-test-start} and
then enter @samp{n} (no) at the prompt ``Start development env?''
+@node Sync between devices
+@chapter Sync between devices
+
+Gnosis uses git to maintain data integrity and facilitate
+synchronization across devices.
+
+You will need to configure your remote manually.
+
+Example:
+
+@example
+cd ~/.emacs.d/gnosis # default location for gnosis, no-littering is ~/.emacs.d/var/gnosis
+git init # After completing your first review session, a git repo should have been initialized automatically.
+git remote add origin <remote_url>
+git push --set-upstream origin master
+@end example
+
+
+You can interactively use @samp{gnosis-vc-push} & @samp{gnosis-vc-pull}. As the
+name suggests, they rely on @samp{vc} to work properly.
+
+Depending on your setup, @samp{vc} might require an external package for
+the ssh passphrase dialog, such as @code{x11-ssh-askpass}.
+
+To automatically push changes after a review session, add this to your configuration:
+@lisp
+(setf gnosis-vc-auto-push t)
+(gnosis-vc-pull) ;; Run vc-pull for gnosis on startup
+@end lisp
+
+@node Interactions with other software
+@chapter Interactions with other software
+
+@menu
+* emacs-no-littering::
+@end menu
+
+@node emacs-no-littering
+@section emacs-no-littering
+
+If you are a user of @uref{https://github.com/emacscollective/no-littering, emacs-no-littering}, you can theme Gnosis to fit
+its standards by adding the following snippet to your configuration:
+
+@lisp
+(setq gnosis-dir (no-littering-expand-var-file-name "gnosis/"))
+@end lisp
+
+This sets @samp{gnosis-dir} to @samp{~/.emacs.d/var/gnosis}, in line with the folders of other packages.
+
@bye
diff --git a/gnosis-dashboard.el b/gnosis-dashboard.el
index 23a04f7..a4332cd 100644
--- a/gnosis-dashboard.el
+++ b/gnosis-dashboard.el
@@ -62,6 +62,8 @@
(defvar gnosis-dashboard-note-ids nil
"Store note ids for dashboard.")
+(defvar gnosis-dashboard-buffer-name "*Gnosis Dashboard*")
+
(defvar gnosis-dashboard-search-value nil
"Store search value.")
@@ -143,63 +145,6 @@ Skips days where no note was reviewed."
do (setq total (+ total entry)))
(/ total (max (length (remove 0 entries)) 1))))
-;; TODO: Add more conds & faces
-(defun gnosis-dashboard--graph-propertize (string num)
- "Propertize STRING depending on the NUM of reviews."
- (cond ((= num 0)
- (propertize string 'face 'shadow))
- ((> num 0)
- (propertize string 'face 'font-lock-constant-face))))
-
-(defun gnosis-dashboard--add-padding (str-length)
- "Add padding for STR-LENGTH."
- (let ((padding (/ (- (window-width) str-length) 2)))
- (make-string padding ?\s)))
-
-(defun gnosis-dashboard-reviews-graph (dates &optional )
- "Insert graph for month DATES.
-
-Optionally, use when using multiple months."
- (let ((count 0)
- (row 0)
- (start-column (current-column))
- (end-column nil))
- (cl-loop for day in dates
- when (= count 0)
- do (let ((current-column (current-column)))
- (and (< (move-to-column start-column) start-column)
- ;; Add spaces to reach start-column.
- (insert (make-string (- start-column current-column) ?\s))))
- (insert " ")
- do (end-of-line)
- (insert (gnosis-dashboard--graph-propertize (format "[%s] " (if (= day 0) "-" "x")) day))
- (cl-incf count)
- when (= count 7)
- do
- (setq end-column (current-column))
- (setq count 0)
- (insert " ")
- (cl-incf row)
- (end-of-line)
- (when (and (/= (forward-line 1) 0) (eobp))
- (insert "\n")
- (forward-line 0)))
- (insert (make-string (- end-column (current-column)) ?\s))
- (insert " ")))
-;; TODO: Refactor this!
-(defun gnosis-dashboard-month-overview (&optional num)
- "Insert review graph for MONTHS."
- (gnosis-insert-separator)
- (let* ((point (point))
- (month (car (calendar-current-date))))
- (insert (gnosis-dashboard--add-padding (min (* (max num 1) 50) (window-width))))
- (while (<= month (+ (car (calendar-current-date)) num))
- ;; (insert (format "%d" month))
- (gnosis-dashboard-reviews-graph (gnosis-dashboard-month-reviews month))
- (goto-char point)
- (end-of-line)
- (cl-incf month))))
-
(defun gnosis-dashboard-output-note (id)
"Output contents for note with ID, formatted for gnosis dashboard."
(cl-loop for item in (append (gnosis-select '[main options answer tags type] 'notes `(= id ,id) t)
@@ -251,8 +196,8 @@ Optionally, use when using multiple months."
(defun gnosis-dashboard-output-notes (note-ids)
"Return NOTE-IDS contents on gnosis dashboard."
(cl-assert (listp note-ids) t "`note-ids' must be a list of note ids.")
- (pop-to-buffer-same-window "*gnosis-dashboard*")
- (gnosis-dashboard-mode)
+ (pop-to-buffer-same-window gnosis-dashboard-buffer-name)
+ (gnosis-dashboard-enable-mode)
(gnosis-dashboard-notes-mode)
(setf tabulated-list-format `[("Main" ,(/ (window-width) 4) t)
("Options" ,(/ (window-width) 6) t)
@@ -333,8 +278,8 @@ Optionally, use when using multiple months."
(defun gnosis-dashboard-output-tags (&optional tags)
"Format gnosis dashboard with output of TAGS."
(let ((tags (or tags (gnosis-get-tags--unique))))
- (pop-to-buffer-same-window "*gnosis-dashboard*")
- (gnosis-dashboard-mode)
+ (pop-to-buffer-same-window gnosis-dashboard-buffer-name)
+ (gnosis-dashboard-enable-mode)
(gnosis-dashboard-tags-mode)
(setf gnosis-dashboard--current '(:type 'tags))
(setq tabulated-list-format [("Name" 35 t)
@@ -369,8 +314,8 @@ Optionally, use when using multiple months."
(defun gnosis-dashboard-output-decks ()
"Return deck contents for gnosis dashboard."
- (pop-to-buffer-same-window "*gnosis-dashboard*")
- (gnosis-dashboard-mode)
+ (pop-to-buffer-same-window gnosis-dashboard-buffer-name)
+ (gnosis-dashboard-enable-mode)
(gnosis-dashboard-decks-mode)
(setq tabulated-list-format [("Name" 15 t)
("Total Notes" 10 gnosis-dashboard-sort-total-notes)])
@@ -435,11 +380,19 @@ When called with called with a prefix, unsuspend all notes of deck."
(define-derived-mode gnosis-dashboard-mode tabulated-list-mode "Gnosis Dashboard"
"Major mode for displaying Gnosis dashboard."
:keymap gnosis-dashboard-mode-map
+ :interactive nil
(setq tabulated-list-padding 2
tabulated-list-sort-key nil
gnosis-dashboard--selected-ids nil)
(display-line-numbers-mode 0))
+(defun gnosis-dashboard-enable-mode ()
+ "Enable `gnosis-dashboard-mode'.
+
+This should only be enabled in a gnosis dashboard buffer."
+ (when (string= (buffer-name) gnosis-dashboard-buffer-name)
+ (gnosis-dashboard-mode)))
+
(cl-defun gnosis-dashboard--search (&optional dashboard-type (note-ids nil))
"Display gnosis dashboard.
@@ -544,7 +497,7 @@ DASHBOARD-TYPE: either 'Notes' or 'Decks' to display the respective dashboard."
"Test function to create an editable field and a search button."
(interactive)
(delete-other-windows)
- (let ((buffer-name "*Gnosis Dashboard*")
+ (let ((buffer-name gnosis-dashboard-buffer-name)
(due-notes (gnosis-review-get-due-notes)))
(when (get-buffer buffer-name)
(kill-buffer buffer-name)) ;; Kill the existing buffer if it exists
@@ -593,7 +546,7 @@ DASHBOARD-TYPE: either 'Notes' or 'Decks' to display the respective dashboard."
(widget-setup))
(pop-to-buffer-same-window buffer)
(goto-char (point-min))
- (gnosis-dashboard-mode)
+ (gnosis-dashboard-enable-mode)
(gnosis-dashboard-menu))))
(provide 'gnosis-dashboard)
diff --git a/gnosis.el b/gnosis.el
index 9b71a76..c2dbb5b 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -5,7 +5,7 @@
;; Author: Thanos Apollo <[email protected]>
;; Keywords: extensions
;; URL: https://thanosapollo.org/projects/gnosis
-;; Version: 0.4.4-dev
+;; Version: 0.4.4
;; Package-Requires: ((emacs "27.2") (emacsql "4.0.1") (compat "29.1.4.2") (transient "0.7.2"))
@@ -115,19 +115,6 @@ When nil, the image will be displayed at its original size."
:type 'integer
:group 'gnosis)
-(defcustom gnosis-review-keybindings
- '((?n . "next")
- (?o . "override")
- (?s . "suspend")
- (?e . "edit")
- (?q . "quit"))
- "List of action bindings for `gnosis-review-actions'.
-
-Each element should be a list of a single character (the key),
-a string describing the action."
- :type '(alist :key-type character :value-type string)
- :group 'gnosis)
-
(defvar gnosis-images-dir (expand-file-name "images" gnosis-dir)
"Gnosis images directory.")
@@ -1193,7 +1180,8 @@ Valid cloze formats include:
(defun gnosis-cloze-extract-answers (nested-lst)
"Extract cloze answers for string clozes inside the NESTED-LST.
-This function should be used in combination with `gnosis-cloze-extract-answers'."
+This function should be used in combination with
+`gnosis-cloze-extract-contents'."
(mapcar (lambda (lst)
(mapcar (lambda (str)
(replace-regexp-in-string "::\\(.*\\)" "" str))
@@ -1203,7 +1191,8 @@ This function should be used in combination with `gnosis-cloze-extract-answers'.
(defun gnosis-cloze-extract-hints (nested-lst)
"Extract cloze hints for string clozes inside the NESTED-LST.
-This function should be used in combination with `gnosis-cloze-extract-answers'."
+This function should be used in combination with
+`gnosis-cloze-extract-contents'."
(mapcar (lambda (lst)
(mapcar (lambda (str)
(when (string-match "::\\(.*\\)" str)
@@ -1693,13 +1682,19 @@ If NEW? is non-nil, increment new notes log by 1."
(gnosis-update 'activity-log `(= reviewed-total ,inc-total) `(= date ',date))
(and new? (gnosis-update 'activity-log `(= reviewed-new ,inc-new) `(= date ',date)))))
+(defun gnosis-history-clear ()
+ "Delete all activity log entries."
+ (interactive)
+ (when (y-or-n-p "Delete all activity log?")
+ (emacsql gnosis-db [:delete :from activity-log])))
+
(defun gnosis-review-note (id)
"Start review for note with value of id ID, if note is unsuspended.
DATE: Date to log the note review on the activity-log."
(when (gnosis-suspended-p id)
(message "Suspended note with id: %s" id)
- (sit-for 0.3)) ;; this should only occur in testing/dev cases
+ (sit-for 0.3)) ;; this should only occur in testing
(let* ((type (gnosis-get 'type 'notes `(= id ,id)))
(func-name (intern (format "gnosis-review-%s" (downcase type)))))
(if (fboundp func-name)
@@ -1794,13 +1789,6 @@ be called with new SUCCESS value plus NOTE & NOTE-COUNT."
(gnosis-display-next-review note success)
(gnosis-review-actions success note note-count))
-(defun gnosis-validate-actions-keys ()
- "Ensure all actions in `gnosis-review-actions-keys` are valid."
- (let ((valid-actions '("next" "override" "suspend" "edit" "quit")))
- (dolist (entry gnosis-review-keybindings)
- (cl-assert (member (cdr entry) valid-actions) nil
- "Invalid action: %s" (cdr entry)))))
-
(defun gnosis-review-actions (success note note-count)
"Specify action during review of note.
@@ -1809,18 +1797,21 @@ NOTE: Note ID
NOTE-COUNT: Total notes reviewed
To customize the keybindings, adjust `gnosis-review-keybindings'."
- (gnosis-validate-actions-keys)
- (let* ((choices (mapcar (lambda (pair)
- (list (car pair) (cdr pair)))
- gnosis-review-keybindings))
- (choice (car (read-multiple-choice "Note actions" choices)))
- (action (alist-get choice gnosis-review-keybindings)))
- (pcase action
- ("next" (gnosis-review-result note success))
- ("override" (gnosis-review-action--override success note note-count))
- ("suspend" (gnosis-review-action--suspend success note note-count))
- ("edit" (gnosis-review-action--edit success note note-count))
- ("quit" (gnosis-review-action--quit success note)))))
+ (let* ((choice
+ (read-char-choice
+ (format "Action: %sext gnosis, %sverride result, %suspend note, %sdit note, %suit review session"
+ (propertize "n" 'face 'match)
+ (propertize "o" 'face 'match)
+ (propertize "s" 'face 'match)
+ (propertize "e" 'face 'match)
+ (propertize "q" 'face 'match))
+ '(?n ?o ?s ?e ?q))))
+ (pcase choice
+ (?n (gnosis-review-result note success))
+ (?o (gnosis-review-action--override success note note-count))
+ (?s (gnosis-review-action--suspend success note note-count))
+ (?e (gnosis-review-action--edit success note note-count))
+ (?q (gnosis-review-action--quit success note)))))
(defun gnosis-review-session (notes &optional due note-count)
"Start review session for NOTES.
@@ -2544,7 +2535,7 @@ If STRING-SECTION is nil, apply FACE to the entire STRING."
:question "Which one is the capital of Greece?"
:choices '("Athens" "Sparta" "Rome" "Berlin")
:correct-answer 1
- :extra "Athens (Αθήνα) is the largest city of Greece & one of the world's oldest cities, with it's recorded history spanning over 3,500 years."
+ :extra "Athens (Ἀθήνα) is the largest city of Greece & one of the world's oldest cities, with it's recorded history spanning over 3,500 years."
:tags note-tags)
(gnosis-add-note--cloze :deck deck-name
:note "GNU Emacs is an extensible editor created by {{c1::Richard}} {{c1::Stallman}} in {{c2::1984::year}}"
@@ -2580,10 +2571,11 @@ If STRING-SECTION is nil, apply FACE to the entire STRING."
:group 'gnosis
:lighter nil
(setq gnosis-due-notes-total (length (gnosis-review-get-due-notes)))
- (if gnosis-modeline-mode
+ (if (and gnosis-modeline-mode gnosis-due-notes-total)
(progn
- (add-to-list 'global-mode-string '(:eval
- (format " G:%d" gnosis-due-notes-total)))
+ (add-to-list 'global-mode-string
+ '(:eval
+ (format " G:%d" gnosis-due-notes-total) 'face 'warning))
(force-mode-line-update))
(setq global-mode-string
(seq-remove (lambda (item)