Skip to content

Compatibility with org-modern #477

Open
@JulienMalka

Description

@JulienMalka

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"))))
     ```

Activity

JulienMalka

JulienMalka commented on Dec 4, 2024

@JulienMalka
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

alphapapa commented on Dec 5, 2024

@alphapapa
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.

self-assigned this
on Dec 5, 2024
minad

minad commented on Dec 5, 2024

@minad

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

JulienMalka commented on Dec 5, 2024

@JulienMalka
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

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @minad@alphapapa@JulienMalka

      Issue actions

        Compatibility with org-modern · Issue #477 · alphapapa/org-ql