kaorahi / howm

note-taking tool on Emacs
GNU General Public License v2.0
147 stars 11 forks source link

Menu stops displaying at line "How to remember:" #42

Closed rhstanton closed 1 month ago

rhstanton commented 2 months ago

When I press C-c , , to show the howm menu, the contents of the file 0000-00-00-00000.txt are interpreted and displayed in a menu buffer.

But not the whole file, I've just realized. The bottom of the menu buffer looks like this:

Format of schedule and todo (Please replace {} with []):
{2002-10-21}@1  schedule -- (shown in schedule part. @3 = "3 days schedule to 10-23")
{2002-10-21}+7  todo -- float up slowly from the date in 7 days
{2002-10-21}!7  deadline -- float up fast from 7 days before the date
{2002-10-21}-1  reminder -- float at the date and sink slowly one unit per 1 day
{2002-10-21}~30 defer -- float at the date and repeat sinking and floating with 30 days period
{2002-10-21}.   done -- sink forever
(Numbers after marks are default values.)

How to remember:
-- 
[Update Menu][Edit Menu]

The file on disk contains quite a lot after the "How to remember" line that doesn't get displayed. I think the file has the default contents, but just to be sure, here's what's in my file 0000-00-00-00000.txt after that line:

How to remember:
* Schedule at(@) the date
* Reminder sinks down(-).
* Todo floats up(+).
* Deadline needs attention!
* Defer waves(~) up and down.
* Done is the end(.).

-------------------------------------

Think of this menu as a "modal dialog" rather than a workspace. Typically, the commands listed in the menu apply to the buffer BEHIND the menu, not the menu buffer itself. In other words, they affect the buffer that was active before the menu appeared.

You can edit this menu itself.
>>> %Editing Menu%

= <<< %Editing Menu%
[Edit Menu] Hit RET on the left button to edit this menu.
[Update Menu] Hit RET on the left button to update this menu.
--------------------------------------------------------

*** Format of the menu file ***
(Please hit RET on [Edit Menu] and read the source file.)

== Basic format

As you see...

* [xxx] is button.
* %REMINDER (in small letters) is schedule and todo list.
* %RECENT (in small letters) is list of recent entries.
* %RANDOM (in small letters) is list of random entries.

You can arrange their places as you like.
Writing favorite files or goto links may be also convenient.
(ex) file:///etc/services   >>> wiki

== Shortcut

%"foo"[All]
This is displayed as foo[All], and the key "f" executes [All].
Exactly speaking, it executes the following sequence:
(1) move to closing ", (2) move to next underline, and (3) hit it.

%"bar%"
If you put % at the tail like this, the key "b" means "move cursor here".

== For lispers

Display:
%here%howm-congrats-count ;; embed value of variable howm-congrats-count
%here%(howm-menu-search "search")
;; embed result of (...), that is, search "search" and embed matched lines
Functions must be registered for safety.
(setq howm-menu-allow (append '(foo bar) howm-menu-allow)) ;; allow foo, bar

Action:
%eval%(message (buffer-name))  ;; evaluate S expr
%call%find-file  ;; call function interactively
Both are evaluated in the previous buffer before raising menu.

== Hiding

'%' + '|' toggles invisibility
like this: visible%|invisible%|appear%|disappear  - until the end of line
(Newline is removed when the end of line is invisible.)

== Multiple menus

Links to %xxx% open "<< < %xxx%" with menu-mode: >>> %menu%
When you add new menu, [[%menu%]] may be more convenient because corresponding
entry is generated automatically.

%eval%(howm-menu-open "00000000-000000.txt")  -- open file with menu-mode
kaorahi commented 2 months ago

Thank you for the report, but I couldn't reproduce the issue. If possible, here's what works best for me:

  1. Download the source code of howm.
  2. Edit sample/dot.emacs if needed.
  3. Run make test (or emacs -Q -l sample/dot.emacs).
  4. Reproduce the issue. (You can ignore the sample notes' content.)
  5. Use M-x howm-bug-shot RET and share the output.

If the app works correctly, the part between How to remember: and = <<< %Editing Menu% should be displayed in the default menu. (The part below = <<< %Editing Menu% is another menu and it is not displayed.)

rhstanton commented 2 months ago

That works. So I assume it's an interaction with my other settings. I'll investigate.

rhstanton commented 2 months ago

Here's the culprit, from my init.el (actually it's just the second line):

(setq howm-view-title-header "*")
(setq howm-view-title-regexp "^[*=]\\( +\\(.*\\)\\|\\)$")

This allows me to use * instead of =, for better org-mode compatibility (but worse howm compatibility...)

Changing the list below "How to remember:" to start with - instead of * gets things working again.

jabirali commented 2 months ago
(setq howm-view-title-header "*")
(setq howm-view-title-regexp "^[*=]\\( +\\(.*\\)\\|\\)$")

This allows me to use * instead of =, for better org-mode compatibility (but worse howm compatibility...)

On my end, I have been satisfied with the Org compatibility setting howm-view-title-header without manually setting howm-view-title-regexp. (The latter should be updated automatically by Howm based on the former.)

Based on the format of the regexp: Is the point that you have existing notes in both Org and Howm formats, and want Howm to show titles from both?

rhstanton commented 2 months ago
(setq howm-view-title-header "*")
(setq howm-view-title-regexp "^[*=]\\( +\\(.*\\)\\|\\)$")

This allows me to use * instead of =, for better org-mode compatibility (but worse howm compatibility...)

On my end, I have been satisfied with the Org compatibility setting howm-view-title-header without manually setting howm-view-title-regexp. (The latter should be updated automatically by Howm based on the former.)

Based on the format of the regexp: Is the point that you have existing notes in both Org and Howm formats, and want Howm to show titles from both?

I think it dates back to when I was first testing howm when yes, that was the situation. Now all my notes are in org files, so it seems that indeed the regexp setting is no longer needed.

By the way, here's something that might be helpful for other howm/org org users. I don't want to have to add #+title: lines to my howm files, so I wrote a little function to use the first section header as the document header when exporting from org mode if there's no explicit title line:

; Use first section header as document title if one does not exist
(defun my-org-set-title-from-first-heading (backend)
  (unless (org-element-map (org-element-parse-buffer) 'keyword
            (lambda (kw)
              (string-equal (org-element-property :key kw) "TITLE"))
            nil t)
    (save-excursion
      (goto-char (point-min))
      (when (re-search-forward "^\\* \\(.+\\)" nil t)
        (let ((title (match-string 1)))
          (goto-char (point-min))
          (insert (format "#+TITLE: %s\n" title)))))))

(add-hook 'org-export-before-processing-hook #'my-org-set-title-from-first-heading)
rhstanton commented 2 months ago

On my end, I have been satisfied with the Org compatibility setting howm-view-title-header without manually setting howm-view-title-regexp.

By the way, the menu problem above still occurs if I only set howm-view-title-header

mmarshall540 commented 2 months ago

You can just edit the "0000-00-00-000000.txt" file to change the stars to dashes, or just remove those lines entirely. It's nice to customize it anyway, especially if you've already become familiar with the hints that it provides.

By the way, I wrote a couple of functions for changing the titles while preserving the files' mtimes, so that sorting doesn't change. Especially useful for transitioning between different title formats. (Which I might do yet again, since @kaorahi posted a link to the old "Howmm" Android app, which uses the default "=" title format.)

I'll post them in the thread about including titles in filenames, in case you're interested.

rhstanton commented 2 months ago

Thanks! Yes, changing all the stars to dashes (and the equals signs to stars) helps a lot.

kaorahi commented 1 month ago

I've merged some related commits. I'll close this issue soon if they seem OK. Thanks again for your comments.

Please let me know if there's anything else.