emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Package suggestion[nongnu]: Gnosis (γνῶσις)


From: Thanos Apollo
Subject: Re: Package suggestion[nongnu]: Gnosis (γνῶσις)
Date: Fri, 19 Jan 2024 16:45:35 +0200
User-agent: mu4e 1.10.6; emacs 29.1

Philip Kaludercic <philipk@posteo.net> writes:
>
> Here area few comments in form of a diff (this is NOT a patch):

[...]

Thank you for your suggestions, they've been really helpful.

I got confused and thought emacsql was included in nongnu elpa, but it's only
available only in nongnu-devel.

Is there any alternative that it's recommended instead of emacsql for a
package to interact with an sqlite databases? (Except triples)


I've refactored a couple important parts of gnosis to take into an
account future extensibility, even by 3rd party packages. Example:

(defvar gnosis-note-types '(MCQ Cloze Basic Double y-or-n)
  "Gnosis available note types.")
  
(defun gnosis-add-note (type)
  "Create note(s) as TYPE interactively."
  (interactive (list (completing-read "Type: " gnosis-note-types nil t)))
  (when gnosis-testing
    (unless (y-or-n-p "You are using a testing environment! Continue?")
      (error "Aborted")))
  (let ((func-name (intern (format "gnosis-add-note-%s" (downcase type)))))
    (if (fboundp func-name)
        (funcall func-name)
      (message "No such type."))))
      
(defun gnosis-review-note (id)
  "Start review for note with value of id ID."
  (when (gnosis-suspended-p id)
    (message "Suspended note with id: %s" id)
    (sit-for 0.3)) ;; this should only occur in testing/dev cases
  (let* ((type (gnosis-get 'type 'notes `(= id ,id)))
         (func-name (intern (format "gnosis-review-%s" (downcase type)))))
    (if (fboundp func-name)
        (progn
          (with-current-buffer (switch-to-buffer (get-buffer-create "*gnosis*"))
            (gnosis-mode)
            (funcall func-name id)))
      (error "Malformed note type: '%s'" type))))

Adding new note types should be a trivial task now.

I hadn't really used emacs without vertico and was unaware of how
different completing-read user interactions actually are. I will be
making adjustments for that wherever possible.


-- 
Thanos Apollo
https://thanosapollo.org

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]