bnbeckwith / writegood-mode

Minor mode for Emacs to improve English writing
http://bnbeckwith.com/code/writegood-mode.html
464 stars 32 forks source link

Fails to do check when enabled via add-hook #16

Closed powellb closed 4 years ago

powellb commented 7 years ago

I have added writegood-mode to a hook for LaTeX-mode:

(add-hook 'LaTeX-mode-hook 'writegood-mode))

When I open a latex file, writegood-mode is enabled; however, it doesn't highlight any of the trouble areas. If I execute writegood-mode, it disables writegood. If I execute again, writegood-mode is enabled and the highlighting works as normal.

Any idea why it wouldn't work when enabled via another mode-hook?

dangom commented 7 years ago

Not the author, but hooks work for me. If you try: (add-hook 'LaTeX-mode-hook 'writegood-turn-on), does it then work?

powellb commented 7 years ago

Thanks for the suggestion; however, writegood-turn-on is not one of its autoload functions, so it is not available after requiring the package. As such, nothing happens with the hook.

bnbeckwith commented 7 years ago

@powellb writegood-mode relies on font-lock-mode. Is it possible that other hooks are messing around with font-lock-mode?

I'll try more to see if I can narrow down the issue and get a resolution.

bnbeckwith commented 6 years ago

@powellb, did you ever find a resolution to this issue?

powellb commented 6 years ago

I did not. I simply enable the mode by hand when I am interested in using it.

On May 21, 2018, at 11:30 PM, Benjamin Beckwith notifications@github.com wrote:

@powellb, did you ever find a resolution to this issue?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

bnbeckwith commented 4 years ago

I'm closing this as I could not recreate the issue.

averter commented 4 years ago

Hello. I am experiencing exactly the same issue as @powellb . There is a similar issue reported here but I couldn't get it to work with an hook on the TeX-update-style-hook. I've also tried to deactivate other modes that provide highlighting (such as flyspell) but no joy so far... FYI, I am writing my auctex configuration below

;; TeXcount setup for AUCTeX
(use-package tex
  :ensure auctex :ensure reftex :ensure writegood-mode
  :defer t
  :bind ([f9] . toggle-between-matlab-mode-and-latex-mode)
  :hook (
     (LaTeX-mode . turn-on-reftex)
     (LaTeX-mode . flyspell-mode)
     (LaTeX-mode . visual-line-mode)
     (LaTeX-mode . turn-on-auto-fill)
     )
  :init
  (setq TeX-parse-self t)
  (defun toggle-between-matlab-mode-and-latex-mode ()
    (interactive)
    (cond ((eq major-mode 'matlab-mode) (latex-mode))
      ((eq major-mode 'latex-mode) (matlab-mode))))

  ;; PDF-LATEX+INKSCAPE
  (setq TeX-PDF-mode t) ;; Always use PDFLaTeX
  (setq reftex-external-file-finders
    '(("tex" . "kpsewhich -format=.tex %f")
      ("bib" . "kpsewhich -format=.bib %f")))
  :config
  (setq reftex-plug-into-AUCTeX t)
  (setq LaTeX-beamer-item-overlay-flag nil) ; avoid stupid overlay 
                        ; when calling itemize
  (add-to-list 'TeX-command-list
           (list "TeXcount" "texcount %s.tex" 'TeX-run-command nil t)))