2

Currenty I am on LaTeX-mode-hook and added following line global-hl-todo-mode into .emacs file to use hl-todo. On its readme it says:

To highlight keywords turn on hl-todo-mode in individual buffers or use the the global variant global-hl-todo-mode.

My setup:

; L A T E X ;
(setq LaTeX-item-indent 0)
(add-hook 'LaTeX-mode-hook 'turn-on-auto-fill)
(add-hook 'LaTeX-mode-hook 'hl-todo-mode)
(require 'tex)

(add-hook 'LaTeX-mode-hook (lambda ()
  (TeX-global-PDF-mode t)
  (global-hl-todo-mode t)  ; <= added here
  ))

(global-hl-todo-mode 1) ; <= added bottom of the page

When I open emacs -nw file.tex, I need to disable and than re-enable global-hl-todo-mode in order to use it. Is there any way to fix this issue?

Please note that, this was working perfectly fine in python-mode.

2

I had a similar problem with AUCTeX and fic-mode. It's caused by the style-hooks executed by AUCTeX after loading the file. You can enable your minor mode in the TeX-update-style-hook, see. this TeX stackexchange question.

1
  • Adding (add-hook 'TeX-update-style-hook 'hl-todo-mode) solved my problem. – alper May 28 '20 at 14:34
1

The question is: do you want hl-todo-mode to be turned on for every mode that is allowed by hl-todo-include-mode (by default that is prog-mode and text-mode) except for the excluded modes in hl-todo-exclude-mode (by default, org-mode)? OR you just want it turned on for LaTeX-mode?

If the former, then add

(global-hl-todo-mode)

in your init file (.emacs or .emacs.d/init.el).

If you only want it for LaTeX-mode, then add

(add-hook 'LaTeX-mode-hook #'hl-todo-mode)

to your init file.

EDIT in response to the OP's comment:

Something else is interfering. Try with emacs -q -l minimal.el where minimal.el does the following:

(add-to-list `load-path "/path/to/hl-todo-mode.el")
(load-library "hl-todo-mode")
(global-hl-todo-mode)

and then open a tex file and type TODO: it should be properly fontified with the following text properties (which you can check with C-u C-x = while your cursor is on that word):

  face                 (:inherit hl-todo :foreground "#cc9393")
  fontified            t

Assuming that that is the case (as it is in my tests), there is something in your init file that breaks this: bisect through it to determine what is doing the breakage.

1
  • I want hl-todo-mode to be turned on for every mode. Currently I am only using LaTeX-mode, python-mode and markdown-mode. I have added (global-hl-todo-mode) but it did not work on the LaTeX-mode. I have to disable and re-enable to make it work. – alper May 25 '20 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.