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

Compatibility with org-modern #477

Open
JulienMalka opened this issue Dec 4, 2024 · 4 comments
Open

Compatibility with org-modern #477

JulienMalka opened this issue Dec 4, 2024 · 4 comments

Comments

@JulienMalka
Copy link

Hello,
I know that this has been discussed before, but it looks like org-ql is not compatible with the org-modern package. For some reason, org-agenda-custom-commands using org-ql-block doesn't have the right styling for TODO keywords, although the styling for the tags is correct.
I join here a screenshot of the problem and a reproducer.

1733342582-wayshot

(require 'package)
(require 'use-package)

;; Add MELPA for packages
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)

;; Make sure we install updated org from the repositories
(assq-delete-all 'org package--builtins)
(assq-delete-all 'org package--builtin-versions)


(use-package org-ql 
 :ensure t)

(use-package org
  :custom
  ;; Tell Org where to find all my stuff
  (org-directory "~/dev/org")
  (org-agenda-files '("~/dev/todos/test.org"))

  ;; My main custom agenda view
  (org-agenda-custom-commands
   '(("c" "Primary agenda view"
      (
       (org-ql-block '(and
		(todo "TODO")
		(tags "inbox")))

        (tags-todo "inbox"
        	((org-agenda-prefix-format "  %?-12t% s")
                (org-agenda-overriding-header "Inbox"))))))))


(use-package org-modern
  ;;:hook ((org-mode . org-modern-mode)
  ;;       (org-agenda-finalize . org-modern-agenda))
  :ensure t
  :config
  (global-org-modern-mode)
  :custom
  (org-modern-star 'replace)
  ;; Set manually to match leuven-theme
  (org-modern-todo-faces
   `(("TODO" :background "#DBEDFF" :foreground "#333333")
     ("NEXT" :background "#FFC8C8" :foreground "#333333")
     ("HOLD" :background "#F6FECD" :foreground "#333333")
     ("DONE" :background "#D5F1CF" :foreground "#333333"))))
     ```
@JulienMalka
Copy link
Author

Not knowing exactly who is in a better position to address this, I've opened a sister issue here minad/org-modern#245

@alphapapa
Copy link
Owner

The issue is probably one of having the appropriate text property on the line. You can see in #455 where I recently removed text properties from the to-do keyword because it was sometimes picking up other properties from the buffer applied by other modes, which caused incorrect appearance in org-ql-view buffers. So basically, what needs to be done is:

  1. Identify the text property and values used by org-modern to recognize the to-do keyword. This can usually be done with C-u C-x = on the lines in the agenda, comparing the ones that appear as desired and the ones that don't.
  2. Add code in org-ql-view--format-element to set that property and value accordingly.

It should be a relatively simple fix. If you have time to investigate step 1, that would help. My time to work on Emacs stuff lately has been limited.

@minad
Copy link

minad commented Dec 5, 2024

The properties are org-not-done-regexp and org-todo-regexp. These regexps are used by the Org agenda. See https://github.com/minad/org-modern/blob/87df4997da28cb9335dc4f0224e9bcedb595e425/org-modern.el#L902-L903. Org-modern had an old bug, back then when it didn't use these properties. It tried to use some buffer local variables, but Ihor explained that this quite obviously cannot work if the agenda is aggregated from multiple files with different keywords.

@JulienMalka
Copy link
Author

Yes I can confirm that those two properties are indeed not present with org-ql.

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

No branches or pull requests

3 participants