nobiot/md-roam

[Bug] Agenda C-c C-t binding throwing error with md-roam

wakatara opened this issue · 15 comments

I downgraded to 28.2 recently and reinstalled md-roam. It seems to be working fine, but whenever I try to use the C-c C-t binding in agenda to mark a task as changed, I am receiving the following error. It only happens if md-roam is loaded and active:

apply: Wrong number of arguments: ((t) nil "Used in `org-roam-node-open' to avoid error.
invalid-regexp \"Invalid regular expression\"." (if (md-roam--markdown-file-p (buffer-file-name (buffer-base-buffer))) (progn t))), 1

I am unsure if this has something to do with org-roam-node-open conflicting with the keybind for agenda but I do not think so, and as noted, it only happens if md-roam is installed and active.

OS: OSX 13.2
Emacs: 28.2 Railwaycat homebrew
md-roam: installed via straight

nb: I do have org-super-agenda loaded as well, but the above error occurs both when it is active and when it is not.

How do I reproduce this error? I don’t use Org-agenda but I just added an Org file in org-roam-directory to the agenda, called org-agenda, and showed “Global list of TODO items”. C-c t is undefined on my end (I think this is default). Pressing “t” calls org-agenda-todo and can cycle the TODO status with no problem. md-roam-mode is active in my end.

Apologies, I typo-ed. That should have read C-c C-t. It is, as far as I know, the default binding to bring up task completion in org-agenda. on a TODO item in the agenda (I just checked my keymaps and don't see anything that would change that... and really, org-agenda is the bomb. It runs my life... try it!... =] ).

So, for me, it normally pops up the following when I trigger it on a TODO item (see the bottom minibuffer in the screen - almost everything folded here):

Screenshot 2023-02-13 at 9 23 14 PM

So, from there, I'd normally trigger one of the letter to change its state or mark something DONE or KILL and close it out.

What command is bound to C-c C-t? On my end it’s org-agenda-todo and the same as “t”, and I don’t get the menu in minibuffer. I have no problem with this command.

I think if you have fast-key access built for the TODOS you get the minibuffer, a la the org-agenda manual

I am guessing adding this will reproduce the error on your side (from my config)

  (setq org-todo-keywords '((type "TODO(t@/!)" "WIP (w@/!)" "FUP (@/!)" "GAVE(g@/!)" "|" "DONE(d@/!)" "KILL(k@/!)")))

C-c C-t (org-todo)

Rotate the TODO state of the current item among

,-> (unmarked) -> TODO -> DONE --.
'--------------------------------'
If TODO keywords have fast access keys (see Fast access to TODO states), prompt for a TODO keyword through the fast selection interface; this is the default behavior
when org-use-fast-todo-selection is non-nil.
The same state changing can also be done “remotely” from the agenda buffer with the t command key (see Commands > in the Agenda Buffer).

I tried your org-todo-keywords. No error in the agenda when changing the state...

I am going to be really happy when I figure out which package I am using that's interfering with the mojo on md-roam. 8-/ (I'm assuming it's not some sort of weird mac or straight thing... ).

(and thank you very much for trying to reproduce the bug. I do appreciate the help -- and the plugin!! -- I'll try my end disabling everything but key stuff and see what happens.).

I'm having the exact same problem. The problem will go a way if I disable md-roam-mode in Org agenda mode. How can I do that in config.el?

@KengChiChang Phew... ok, so I'm not insane... that is some comfort.

Can you list your OS and emacs and org-mode version and such?

As well, since @nobiot is not able to reproduce it, we probably need to puzzle out what packages we may have in common that may be causing the conflict (I doubt it's an org-mode configuration variable but curious as to what you may think.).

Can you paste the whole backtrace, please? Turn on toggle-debug-on-error and hit the error; you should get a more detailed error message and “call stack”

Of course! (I have to admit I am still figuring out how to get emacs to do things like debugs to run errors down to ground.).

This is what I get when I have that on and what shows up in the Backtrace minibuffer:

Debugger entered--Lisp error: (wrong-number-of-arguments ((t) nil "Used in `org-roam-node-open' to avoid error.\ninval..." (if (md-roam--markdown-file-p (buffer-file-name (buffer-base-buffer))) (progn t))) 1)
  md-roam-do-not-show-context(agenda)
  apply(md-roam-do-not-show-context agenda)
  org-show-context(agenda)
  org-agenda-todo(nil)
  funcall-interactively(org-agenda-todo nil)
  call-interactively(org-agenda-todo nil nil)
  command-execute(org-agenda-todo)

I should point out that I am only altering tasks that are org-mode TODOs of various state.

lemme know if you need me to do anything more on this front!

I'm on M1 Mac 12.6 (Monterey), Emacs 28.2 jimeh/emacs-builds, Org 9.6, Org-Roam 74422df, md-roam from straight.

Here's my backtrace

Debugger entered--Lisp error: (wrong-number-of-arguments (0 . 0) 1)
  md-roam-do-not-show-context(agenda)
  apply(md-roam-do-not-show-context agenda)
  org-show-context(agenda)
  org-agenda-todo(nil)
  funcall-interactively(org-agenda-todo nil)
  command-execute(org-agenda-todo)

I still can't reproduce the issue, but by the looks of the backtrace, 9ccd8fe should fix the issue. Please test and let me know.

Woo! Just did a straight-pull packcage on it and it definitely fixed my issue. Yeyyyy! Thank you so much!!!

Works like a charm. Thanks so much!

Thank you both for confirming.