I use desktop session. Every time I restart my TODOS won't appear unless I kill the buffer and open it again.

(setq desktop-save-mode t
      desktop-save t
      desktop-save-buffer t
      desktop-saved-frameset t
      desktop-restore-frames t
      tab-bar-mode t
      tab-bar-show 1)

;; TODOS: This don't show up on unless I kill the buffer and open it.
(add-hook 'prog-mode-hook 'my/keywords)
(defun my/keywords ()
"My Font Lock Keywords."
        nil '(("\\<\\(\\(FIX\\(ME\\)?\\|TODO 1\\|BUG\\):\\)" 1  'org-mode-line-clock-overrun t)
                                ("\\(README:\\)" 1 '(face nil display "📗"))
                                ("\\<\\(\\(TIP\\):\\)" 1  '(:background "#99c3ff" :foreground "black") t)
                                ("\\<\\(\\(TODO 2\\|TODOS\\):\\)" 1  '(:background "#5f875f" :foreground "white") t)
                                ("\\<\\(\\(HACK\\):\\)" 1  font-lock-warning-face prepend)
                                ("\\<\\(\\(INFO\\):\\)" 1  '(:background "#2563EB" :foreground "white") t)
                                ("\\<\\(\\(WARN\\|WARNING\\):\\)" 1  '(:background "#ff9933" :foreground "black") t)
                                ("===\\(|? \\(.*\\) |?\\)===" 1  '(:background "" :foreground "#57a5e5") t)
                                ("\\(\\(│\\|╭\\|╰\\).*$\\)" 1  '(:background "" :foreground "#57a5e5") t)
                                ("\\<\\(\\(TODO\\|FUTURE\\):\\)" 1  '(:background "#404040" :foreground "white") t)

  • Do you mean buffers that are automatically reopened by Emacs when you start it, using "desktop save"? Is there a specific place in your init file where you load the desktop? If so, make sure your hook is installed before the desktop is loaded. Sep 11, 2022 at 20:55
  • @Lindydancer Thanks, looks like you solved it :D . So, by the looks of it hooks need to come before. What I ended up doing is moved my desktop session stuff to the end of the init.el which solved it. If you want to answer with something along the lines of "add hooks before desktop.." I will choose it as best answer. Thanks
    – ritchie
    Sep 12, 2022 at 23:41


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.