Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How I put my flashcards, newsfeed and even agenda in howm. Questions on how to improve this. #2

Open
artsi0m opened this issue Nov 3, 2023 · 6 comments

Comments

@artsi0m
Copy link

artsi0m commented Nov 3, 2023

What I did

At first: Thank you for creating this awesome package for emacs!

Link to mailing list was substituted to this GitHub issues page and so I am writing here.

That exact man who wrote Russian guide for howm also have youtube channel and made a video about putting everything into zettelkasten — https://www.youtube.com/watch?v=Bkhlehp1M6o

I have the same ideas before and here what i did:

1. At first I configured howm to use it with org mode

(use-package howm
  :init (setq howm-view-title-header "*")
  :if (string-match-p "kanamori" (system-name)))

I needed this step use with howm packages that initially was written for org, like org-drill
https://orgmode.org/worg/org-contrib/org-drill.html

2. Then I wrote functions that will create list of full file names.

I did it for org-drill, elfeed and agenda.
I use agenda tag, because for today org-timeblock cannot get time ranges from howm.

(defun my-elfeed-file-names-in-howm ()
  "Return list of absolute filenames of org-elfeed files in howm"
  (delete-dups
   (mapcar #'car (howm-grep "\:elfeed\:"
		      (howm-files-in-directory howm-directory)))))

(defun my-org-drill-file-names-in-howm ()
  "Return list of absolute filenames of org-drill files in howm"
  (delete-dups
   (mapcar #'car (howm-grep "\:drill\:"
			    (howm-files-in-directory howm-directory)))))

(defun my-org-agenda-file-names-in-howm()
  "Return list of absoulute filenames of files with :agenda: tag in howm"
  (delete-dups
   (mapcar #'car (howm-grep "\:agenda\:" (howm-files-in-directory howm-directory)))))

3. I changed init.el to point some variables to these filenames

(use-package org-drill
  :if (string-match-p "kanamori" (system-name))
  :config (setq org-drill-scope (my-org-drill-file-names-in-howm))
  :after howm)

(use-package elfeed-org
  :if (string-match-p "kanamori" (system-name))
  :ensure t
  :config
  (elfeed-org)
  (setq rmh-elfeed-org-files (my-elfeed-file-names-in-howm))
  :after howm)


(use-package org
  :if (string-match-p "kanamori" (system-name))
  :mode ("\\(\\.txt\\|\\.org\\|\\.howm\\)$" . org-mode)
  :custom
  (org-startup-folded nil)
  (org-agenda-files (my-org-agenda-file-names-in-howm))
  (org-format-latex-options
   '(:foreground default :background default :scale 1.7 :html-foreground "Black" :html-background "Transparent" :html-scale 1.0 :matchers
		 ("begin" "$1" "$" "$$" "\\(" "\\[")))
  (org-todo-keywords
   '((sequence "TODO(1)" "|" "DONE(2)" "FAIL(3)" "NGMI(4)" )))
  :after howm)

End result

Now i can put my flashcards inside my howm directory.
There are some benefits in putting flashcards from various sources and topics inside one giant deck:
https://borretti.me/article/effective-spaced-repetition#fun

Then only disadvantage I met for today is that sometimes I need to manually update variables like org-drill-scope by evaluating region in init.el or evaluating entire buffer. So there is room for improvement and you can tell me how I can do it better.

That is. Thank you for reading this.

@artsi0m
Copy link
Author

artsi0m commented Nov 3, 2023

Questions

So the question that I want to ask is: What should I do to dynamically update variables like org-drill-scope ?
For instance I want to create new list of files with flashcards after executing howm-menu or after finishing new note with :drill: tags in it.

Important notes

I do try to put everything that interest in howm, but I didn't try to learn every single thing in it with flascards.
It is just handy to use the same place for flashcards.

Also I wanted to note that I would like to use howm method of scheduling if adding timeranges would be possible.
Maybe I should try calfw and calfw-blocks

@kaorahi
Copy link
Owner

kaorahi commented Nov 4, 2023

Do you mean something like this?

(defadvice howm-menu (around my-hook activate)
  ad-do-it
  (my-update-org-drill-scope))

(defun my-update-org-drill-scope (...)
  ...)

For time ranges, you might find some hints here (in Japanese).
https://howm.osdn.jp/cgi-bin/hiki/hiki.cgi?DateFormat

@artsi0m
Copy link
Author

artsi0m commented Nov 4, 2023

Yes, thank you.

I thought about advices, but never used theme before, because I am an emacs lisp newbie. I will try to use them.

Thank you for sharing this page. I will try to learn something from translation of it.

@sirikid
Copy link

sirikid commented Nov 6, 2023

Do you mean something like this?

(defadvice howm-menu (around my-hook activate)
  ad-do-it
  (my-update-org-drill-scope))

(defun my-update-org-drill-scope (...)
  ...)

advice.el is an older obsolete API, nadvice.el should be used instead:

(define-advice howm-menu (:after (&rest _args))
  ...)

or

(advice-add 'howm-menu :after #'my-update-org-drill-scope)

(defun my-update-org-drill-scope (...)
  ...)

@artsi0m
Copy link
Author

artsi0m commented Nov 17, 2023

I wrote:

  • advice for elfeed-update to update list of files with :elfeed: tags on update of elfeed index
(define-advice elfeed-update (:before (&rest _args))
  (setq rmh-elfeed-org-files (my-elfeed-file-names-in-howm)))
  • advice for org-timeblock to update list of files with :agenda: tags on event of redrawing org-timeblock buffer
(define-advice org-timeblock-redraw-buffers (:before (&rest _args))
  (setq org-agenda-files (my-org-agenda-file-names-in-howm)))
  • same advice for org-agenda
(define-advice org-agenda (:before (&rest _args))
  (setq org-agenda-files (my-org-agenda-file-names-in-howm)))

@artsi0m
Copy link
Author

artsi0m commented Dec 12, 2023

image
I should note that org-drill package caused bug that hangs emacs and after recovering files I got this.
I will try to do something about it, but for now in the middle of the session I will just delete howm markup from first heading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants