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

Howm support #117

Closed
jabirali opened this issue Sep 4, 2024 · 9 comments
Closed

Howm support #117

jabirali opened this issue Sep 4, 2024 · 9 comments
Labels
documentation Improvements or additions to documentation

Comments

@jabirali
Copy link

jabirali commented Sep 4, 2024

First of all, thanks for creating the Modus themes :).

Recently, I've been enjoying using Howm. I'm not sure if you're familiar with it; it's a minor mode for managing a personal wiki in Emacs, which can be used together with any plaintext filetype (Org, Markdown, etc.). It has some pretty cool features, like the emphasis on "self-organization" of notes and the ability to create "comefrom links" (as opposed to the more traditional "goto links"). Documentation is available here.

Unfortunately, the Modus themes – and most other themes – don't currently theme the faces defined by Howm, and the defaults are IMO quite intense. For instance, here is a screenshot of the Howm note list when viewed using the modus-operandi-tinted theme:

Screenshot 2024-09-03 at 16 01 51

Perhaps the Modus themes could alter the faces used for Howm?

@protesilaos
Copy link
Owner

protesilaos commented Sep 5, 2024 via email

@jabirali
Copy link
Author

jabirali commented Sep 5, 2024

Thanks! I'd be happy to help out with this if needed :).

If you install Howm from MELPA, this is a minimal configuration (without integration with Org-mode etc.):

(use-package howm
  :bind
  ("<f12>" . howm-list-all)
  ("<C-f12>" . howm-create)
  :config
  (setq howm-directory "~/howm")
  (setq howm-home-directory howm-directory))

With this setup, if you press C-F12, It should create a new note as a txt file in the directory ~/howm. On top of the basic text-mode, it adds some highlighting if you type e.g. this in:

image
  • The note title is marked in howm-mode-title-face
  • Today's date is marked in howm-reminder-today-face. Both today's date and other dates are in addition marked in action-lock-face (here: underline), which is used for all Howm "links".
  • The "goto link" is marked in howm-mode-ref-face (this is used like a search-based "fuzzy link")
  • The "comefrom link" is in howm-mode-keyword-face (this is used kinda like a "tag" in practice)
  • The "wikilink" is marked in howm-mode-wiki-face (this is used like an "exact link" to a note)

If you then save the note, you can then with this setup press F12 to bring up the list of notes:

image
  • The filename is marked as howm-view-name-face

Then you can press "g this RET" to grep for "this" in the notes:

image
  • Each search hit is now marked in howm-view-hilit-face
  • When there are multiple hits in one file, the "filename" part of the note list is marked in howm-view-empty-face in the lines below (the dark area).

From my point of view, I think these are the most important faces.

But I haven't used Howm's GTD system, which uses a few more faces (the howm-reminder-* set of faces). Based on the manual, I think this example shows most of those faces – note that both the date (days to/from today) and the symbol after (the +-@!.~) seems to affect the faces used here.

image image

I hope this helps!

@protesilaos
Copy link
Owner

Can you please evaluate this and give it a try?

(defun my-modus-themes-faces (&rest _)
  (modus-themes-with-colors
    (custom-set-faces
     `(action-lock-face ((,c :inherit button)))
     `(howm-mode-keyword-face (( )))
     `(howm-mode-ref-face ((,c :inherit link)))
     `(howm-mode-title-face ((,c :inherit modus-themes-heading-0)))
     `(howm-mode-wiki-face ((,c :inherit link)))
     `(howm-reminder-deadline-face ((,c :foreground ,date-deadline)))
     `(howm-reminder-late-deadline-face ((,c :inherit bold :foreground ,date-deadline)))
     `(howm-reminder-defer-face ((,c :foreground ,date-scheduled)))
     `(howm-reminder-scheduled-face ((,c :foreground ,date-scheduled)))
     `(howm-reminder-done-face ((,c :foreground ,prose-done)))
     `(howm-reminder-todo-face ((,c :foreground ,prose-todo)))
     `(howm-reminder-normal-face ((,c :foreground ,date-common)))
     `(howm-reminder-today-face ((,c :inherit bold :foreground ,date-common)))
     `(howm-reminder-tomorrow-face ((,c :inherit bold :foreground ,date-scheduled)))
     `(howm-simulate-todo-mode-line-face ((,c :inherit bold)))
     `(howm-view-empty-face (( )))
     `(howm-view-hilit-face ((,c :inherit match)))
     `(howm-view-name-face ((,c :inherit bold)))
     `(iigrep-counts-face1 ((,c :foreground ,rainbow-1)))
     `(iigrep-counts-face2 ((,c :foreground ,rainbow-2)))
     `(iigrep-counts-face3 ((,c :foreground ,rainbow-3)))
     `(iigrep-counts-face4 ((,c :foreground ,rainbow-4)))
     `(iigrep-counts-face5 ((,c :foreground ,rainbow-5))))))

(add-hook 'enable-theme-functions #'my-modus-themes-faces)

@jabirali
Copy link
Author

jabirali commented Sep 5, 2024

Thanks for the quick response and the code!

I tested it now with the same example files as above. Here are a few different screenshots using different Modus variants (this time in GUI to check that no terminal quirks interfere):

Screenshot 2024-09-05 at 12 17 37 Screenshot 2024-09-05 at 12 16 48 Screenshot 2024-09-05 at 12 18 00 Screenshot 2024-09-05 at 12 18 09

Some comments:

  • The core features I use now look excellent – it's much more consistent with the highlighting used in e.g. Org-mode, and the new colors are much easier on the eyes.
  • In "comefrom links", there is a "gap" between the <<< and the name. However, C-u C-x = reveals that this gap is simply not fontified by howm-mode. I'm not sure if the best course of action is to keep the current highlighting and report this as an issue upstream in howm-mode, or to use a different howm-mode-keyword-face.
  • It seems the underline below the reminder faces are all shown in blue rather than matching the text it underlines. (Presumably due to the order in which howm-mode applies faces?) It might be nicer to either change the underline color to match the text or disable them in this context.
  • I didn't show the "grep" above, but that looks great now.

EDIT:
Regarding the comefrom links: It actually appears to be fontified correct after all, as the <<< and following keyword are indeed two independent "buttons". I didn't notice this until now, but their behavior when clicked is slightly different: Clicking the <<< symbol searches for other notes with the same comefrom link, whereas clicking on the keyword also includes any other note that link to the samekeyword (i.e. "sibling notes").

@protesilaos
Copy link
Owner

protesilaos commented Sep 8, 2024 via email

protesilaos added a commit that referenced this issue Sep 8, 2024
This is in response to the question raised by Jabir Ali Ouassou in issue 117:
<#117>.
@jabirali
Copy link
Author

jabirali commented Sep 8, 2024

Though I think it is worth asking the maintainer
about this.

@kaorahi: Above, we have had a discussion about adding support for Howm to the Modus themes, such that consistent colors and faces are used to fontify Howm buffers as are used for e.g. Org-mode and Markdown-mode. Prot has made a nice suggestion above for how to set it up (and added it to the newest version of the docs), see my last post above for some screenshots of how the current version looks.

Perhaps you have some input or insights to add, regarding how to best theme Howm-mode?

For example, what might be the best way to handle reminder faces, which currently inherit a blue underline from the action-lock face (which are now themed as normal links)?

@kaorahi
Copy link

kaorahi commented Sep 8, 2024

Thanks for another modernization!

Unfortunately, I'm not really the type of person who cares much about aesthetics, and I don't have enough ability or interest to give useful feedback on this. That said, users would definitely appreciate it if you suggest a better color scheme.

It seems we need the following patch to modify the underline style in reminders (not well tested).

https://github.com/kaorahi/howm/tree/modus117_underline

(setq howm-reminder-action-lock-face nil)  ;; use default action-lock face
(setq howm-reminder-action-lock-face '(:underline nil))  ;; no underline
(setq howm-reminder-action-lock-face '(:underline t))  ;; inherit reminder color

Personally, I prefer using the action-lock color for all action-lock underlines, even in reminders, but I know my aesthetic sense is broken. :p

@kaorahi
Copy link

kaorahi commented Sep 8, 2024

Is howm-menu-key-face missing?
https://github.com/kaorahi/howm/blob/69445111403cf4b99b8912392130411df7f91d77/howm-vars.el#L1123

To remove the underlines in reminders, how about simply appending :underline nil?

     `(howm-reminder-deadline-face ((,c :foreground ,date-deadline :underline nil)))

If this is enough, we don't need the dirty patch in my previous post.

@jabirali
Copy link
Author

jabirali commented Sep 9, 2024

@kaorahi: Thanks a lot for chiming in! :)

Based on your feedback, I have now updated @protesilaos suggestion as follows:

  • Added a suggestion for howm-menu-key-face (which seems to be used for keybinding hints in the menu);
  • Set :underline nil in the reminder faces as suggested (so that you don't need to patch this into Howm itself);
  • Fixed a typo in the face name used for scheduled events (schedule vs. scheduled).

The revised code is then:

(defun my-modus-themes-faces (&rest _)
  (modus-themes-with-colors
    (custom-set-faces
     `(action-lock-face ((,c :inherit button)))
     `(howm-menu-key-face ((,c :inherit help-key-binding)))
     `(howm-mode-keyword-face (( )))
     `(howm-mode-ref-face ((,c :inherit link)))
     `(howm-mode-title-face ((,c :inherit modus-themes-heading-0)))
     `(howm-mode-wiki-face ((,c :inherit link)))
     `(howm-reminder-deadline-face ((,c :foreground ,date-deadline :underline nil)))
     `(howm-reminder-late-deadline-face ((,c :inherit bold :foreground ,date-deadline :underline nil)))
     `(howm-reminder-defer-face ((,c :foreground ,date-scheduled :underline nil)))
     `(howm-reminder-schedule-face ((,c :foreground ,date-scheduled :underline nil)))
     `(howm-reminder-done-face ((,c :foreground ,prose-done :underline nil)))
     `(howm-reminder-todo-face ((,c :foreground ,prose-todo :underline nil)))
     `(howm-reminder-normal-face ((,c :foreground ,date-common :underline nil)))
     `(howm-reminder-today-face ((,c :inherit bold :foreground ,date-common :underline nil)))
     `(howm-reminder-tomorrow-face ((,c :inherit bold :foreground ,date-scheduled :underline nil)))
     `(howm-simulate-todo-mode-line-face ((,c :inherit bold)))
     `(howm-view-empty-face (( )))
     `(howm-view-hilit-face ((,c :inherit match)))
     `(howm-view-name-face ((,c :inherit bold)))
     `(iigrep-counts-face1 ((,c :foreground ,rainbow-1)))
     `(iigrep-counts-face2 ((,c :foreground ,rainbow-2)))
     `(iigrep-counts-face3 ((,c :foreground ,rainbow-3)))
     `(iigrep-counts-face4 ((,c :foreground ,rainbow-4)))
     `(iigrep-counts-face5 ((,c :foreground ,rainbow-5))))))

(add-hook 'enable-theme-functions #'my-modus-themes-faces)

Here are two example screenshots showing that the howm-menu now renders well (including the keybinding hints):
Screenshot 2024-09-09 at 14 12 49Screenshot 2024-09-09 at 14 13 04
Here are some more examples showing that the reminder faces now don't have the blue line (which I personally prefer):
Screenshot 2024-09-09 at 14 20 19Screenshot 2024-09-09 at 14 20 30
From my point of view, I think this looks perfect :)

@protesilaos protesilaos added the documentation Improvements or additions to documentation label Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants