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

Priorities are not shown as intended in org-agenda #1

Closed
yantar92 opened this issue Mar 4, 2018 · 14 comments
Closed

Priorities are not shown as intended in org-agenda #1

yantar92 opened this issue Mar 4, 2018 · 14 comments
Assignees

Comments

@yantar92
Copy link

yantar92 commented Mar 4, 2018

Following the discussion in reddit, the priorities are still shown as [#A], [#B], and [#C] if the agenda is opened at the time when the file from org-agenda-files is not yet open and contains #+SETUPFILE.

The recepie for emacs -Q (Org mode 8.2.10):

  1. Create an empty ~/tmp/1.setup
  2. Create the file ~/tmp/6.org with the following content:
#+SETUPFILE: ~/tmp/1.setup

* TODO [#A] check |- (alphapapa/org-super-agenda: Supercharge your Org daily/weekly agenda by grouping items) :BOOKMARK:
:PROPERTIES:
:CREATED: [2018-02-28 Wed 08:18]
:Source: https://github.com/alphapapa/org-super-agenda/
:END:
* TODO report clock report alignment problem when "|" is in the task name
:PROPERTIES:
:CREATED: [2018-02-28 Wed 20:28]
:END:
:LOGBOOK:
CLOCK: [2018-02-28 Wed 20:28]--[2018-02-28 Wed 20:29] =>  0:01
:END:


  1. Insert the following into scratch:
(eval-and-compile
  (require 'package)
  (setq package-archives '(("MELPA" . "http://melpa.org/packages/")
			   ("ELPA" . "http://tromey.com/elpa/")
			   ("gnu"  . "http://elpa.gnu.org/packages/")
			   ("SC"   . "http://joseito.republika.pl/sunrise-commander/")
                           ("org" . "http://orgmode.org/elpa/")
                           )
	load-prefer-newer t
	package-user-dir "~/.emacs.d/elpa"
	package--init-file-ensured t
	package-enable-at-startup nil)
  (unless (file-directory-p package-user-dir)
    (make-directory package-user-dir t))
  (setq load-path (append load-path '("~/.emacs.d/site-lisp/")))
  (setq load-path (append load-path (directory-files "~/.emacs.d/site-lisp/" t "^[^.]" t)))
  (setq load-path (append load-path (directory-files package-user-dir t "^[^.]" t)))
  (package-initialize))

(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))
(eval-when-compile
  (require 'use-package))
(use-package diminish :ensure t)
(require 'bind-key)


(use-package org-fancy-priorities
  :ensure t
  :hook 
  (org-mode . org-fancy-priorities-mode)
  :config
  (setq org-fancy-priorities-list '("⚡" "⬆" "⬇" "☕")))

(use-package org
  :mode ("\\.org$" . org-mode)
  :demand t
  :init
  (setq org-agenda-files '("~/tmp/6.org"))
)

  1. M-x eval-buffer
  2. M-x org-agenda "t"

The priority is still shown as [#A]. Note, that everything is fine if #+SETUPFILE is not there. The recepie also works when setup file is not empty (my real case).

@yantar92 yantar92 changed the title Priorities are not shown as intendet in org-agenda Priorities are not shown as intended in org-agenda Mar 4, 2018
@harrybournis harrybournis self-assigned this Mar 4, 2018
@CeleritasCelery
Copy link

I implemented something similar to "fancy priorities" using prettify-symbols-mode but abandoned it because of this issue. I would pick this up in heartbeat if this could be resolved!

@yantar92
Copy link
Author

yantar92 commented Mar 7, 2018

I am also using prettify-symbols-mode. It just did not make sense to post org related bug there (it is likely to be caused by org itself).
This project is implemented for org-mode specifically at least.

If you want some dirty workaround - you can use something like:

(defun yant/fontify-agenda ()
  "Make sure that every line of agenda is forced to be fontified."
  (interactive)
  (require 'org-agenda)
  (when (equal major-mode 'org-agenda-mode)
    (beginning-of-buffer)
    (let ((previtem)
	  (curitem t))
      (while (not (equal previtem curitem))
	(setq previtem curitem)	
	(setq curitem (line-number-at-pos))
        (org-agenda-next-item 1)
	(org-agenda-show)))
    (delete-other-windows)
    (org-agenda-redo)
    (beginning-of-buffer)
    (org-agenda-next-item 1)))
(define-advice org-agenda (:after (&rest args) update-agenda-fonts)
  "Force update of the agenda fonts to make pretty-symbols-mode work in agenda."
  (yant/fontify-agenda))

@harrybournis
Copy link
Owner

I also think that its an issue with org mode, and I was just working on a dirty fix like the one you posted. I am also still testing the approach of using overlays, which are buffer-dependent instead of text-dependent, but I still have to find a way to update them without using font-lock.

@harrybournis
Copy link
Owner

Fixed in c6541f5. It also fixes #2.

Sorry for taking so long the last weeks have been busy. I solved it using overlays and it seems to be working. @yantar92 do you think you can test it on your setup just to be safe? It's on the fix-agenda branch. If you can't do it I will merge it in a few days anyway.

@yantar92
Copy link
Author

Works for me. Thank you!

@ChauhanT
Copy link

Hi, I am also facing this issue. I have only begun using emacs and can't get it to work no matter where and how I try to hook fancy priorities and org agenda. Any tips? Also, sorry if this is not the place to ask, I would be happy to delete this and move it to the right forum. Cheers!

@harrybournis
Copy link
Owner

@ChauhanT i tried it with latest Emacs (27.1) and latest org mode version (9.4.4) and it works fine. if you are using spacemacs or some other emacs distribution make sure it is not shipping an older (possibly broken as it has been known to happen) version of org mode.

you can try Μ-x org-version to see what version you have installed. If it is older I suggest you install the latest org mode version through the official repo. Just follow the instructions to add the repo to your package archive list, then run M-x list-packages, find org and install it.

@smalltimer
Copy link

@harrybournis Thank you for responding! I just checked the version numbers: I'm on emacs version 27.1 (Debian backports), and org mode version 9.5. But it is doom emacs and not vanilla. The relevant excerpt from my config.el is below, in case you might want to have a look and I'm doing something blatantly moronic.

;; org
(after! org
  (setq-default major-mode 'org-mode)
  (setq!
   org-agenda-skip-deadline-if-done t
   org-agenda-skip-scheduled-if-done t
   org-agenda-skip-timestamp-if-done t

   org-directory "~/Dropbox/Notes/"

   org-todo-keywords '((sequence "TODO(t)" "DONE(d!)"))

   org-startup-folded 'content

   org-priority-highest '?A
   org-priority-lowest  '?D
   org-priority-default '?D
   org-priority-start-cycle-with-default t
   org-priority-faces '((?A :foreground "#F54768")
                        (?B :foreground "#F5C747")
                        (?C :foreground "#62A6EB")
                        (?D :foreground "#A0A0A0"))
   )
)

;; org-fancy-priorities
(after! org-fancy-priorities
  (setq!
   org-fancy-priorities-list
   '("🅐" "🅑" "🅒" "🅓")
   ;; '("!!!" " !!" "  !" "zzz")
   ))

;; org-agenda
(after! org-agenda
  (setq!
   org-agenda-files (directory-files-recursively "~/Dropbox/Notes/" "\\.org$")

   org-agenda-prefix-format
   '((agenda . "%i  %?-12t% s")
     (todo   . "%i  ")
     (tags   . "%i  ")
     (search . "%i  "))
   org-agenda-todo-keyword-format ""))

@harrybournis
Copy link
Owner

@smalltimer i installed doom emacs and the issue was that org-fancy-priorities was never hooked to start when org mode was enabled. When you want a mode to start when another mode does then you add a hook. Try this and let me know if it works so I can update the documentation with a section on doom emacs since a lot of people seem to be using it:

(add-hook! 'org-mode-hook 'org-fancy-priorities-mode)
(add-hook! 'org-agenda-mode-hook 'org-fancy-priorities-mode)
(after! org-fancy-priorities
  (setq! org-fancy-priorities-list '("🅐" "🅑" "🅒" "🅓")))

@smalltimer
Copy link

smalltimer commented Feb 26, 2021

@harrybournis Thank you very much for going through all that trouble!

I tried, but it did not work. I put the hooks between the (after! org ...) and (after! org-fancy-priorities ...) blocks. My reasoning was that the hooks need org-mode to be initialised before they will make sense.

Also, in doom.d/init.el did you use the +pretty flag for the :tools org module? This seems to turn on org-bullets and, of course, org-fancy-priorities.

@harrybournis
Copy link
Owner

@smalltimer I am not sure about org-bullets, but i don't think org-fancy-priorities is included by default in doom emacs. I did not make any adjstments except the ones I sent you for ~/.doom.d/config.el and you also need to add the package in ~/.doom.d/packages.el like this:

(package! org-fancy-priorities)

I think this is what is missing. in order to verify if a package is installed you should try M-x and writing its name. At the very least you should see the function that enables the mode.

@smalltimer
Copy link

smalltimer commented Feb 26, 2021

@harrybournis Yes, I have that in the ~/.doom.d/packages.el. I followed along with this tutorial before adding more customisation. I think it's a strange interaction between org-agenda and fancy-priorities because in the .org buffers I can see the priorities very nicely (symbols as well as faces).

In the agenda view, however, I can only see the symbols for files which have been visited. So in the agenda mode: 1. I can see the symbols but not the faces for today and all future days. 2. Neither the symbols nor the faces (I can only see [#A] etc.) for all days in the past if the .org files containing the todo have not been visited. Curiously, once I visit the file where this todo from the past was created, I can see its symbol (no face still).

@harrybournis
Copy link
Owner

@smalltimer ok please open another issue, call it "org agenda not working in doom emacs" or something and post any configuration you have so I can replicate the issue and find a fix

@smalltimer
Copy link

@harrybournis Nice one, thank you for being so active and helpful. I'll do it today.

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

No branches or pull requests

5 participants