Configuration not working after restart or open a new buffer, must manually reload

What happened?

I tried to customize latex mode and lsp mode. I want to disable flymake and auto pair for backtick in latex mode and prevent completion for space latex lsp. However, my configuration doesn’t work after I restart emacs or open a new tex file. They only work after I manually run doom/reload.

What did you expect to happen?

Disable flymake, auto pair backtick, and no completion for space in latex mode

Steps to reproduce

Here is the what I put in my config.el

(use-package! latex
           :config
           (message ">>>>>>>>>>running latex configuration")
           (flymake-mode -1)
           (sp-local-pair 'LaTeX-mode "`" nil :actions :rem)
           )

(after! lsp
  (advice-add #'lsp-completion--looking-back-trigger-characterp
              :filter-args
              (lambda (r) (seq-remove (lambda (it) (equal it " ")) r))
              '((name . --filter-spaces)))
  )

System information

generated Oct 01, 2023 16:15:01 system MacOS 14.0 Darwin 23.0.0 arm64 ns emacs 29.1 ~/.config/emacs/ doom 3.0.0-pre PROFILE=_@0 grafted, HEAD → master, origin/master, origin/HEAD 3983fba5 2023-09-20 21:01:55 +0200 ~/.config/doom/ shell /bin/zsh features ACL GLIB GMP GNUTLS JPEG JSON LIBXML2 MODULES NOTIFY KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER ZLIB traits gui server-running envvar-file custom-file custom magit-todos-insert-after package-selected-packages modules :config use-package :completion company vertico :ui doom doom-dashboard (emoji +unicode) hl-todo indent-guides modeline nav-flash ophints (popup +defaults) tabs treemacs unicode (vc-gutter +pretty) vi-tilde-fringe workspaces :editor (evil +everywhere) file-templates fold snippets :emacs dired electric undo vc :term vterm :checkers grammar :tools ein (eval +overlay) lookup lsp magit pdf tree-sitter :os macos :lang coq emacs-lisp (haskell +lsp) (latex +lsp) markdown (org +journal +jupyter +pretty +roam2) python (rust +lsp) sh :config (default +bindings +smartparens) packages (org-roam-ui) (org-fragtog) (langtool-ignore-fonts) (powerthesaurus) unpin org-roam elpa org-journal langtool-ignore-fonts langtool

Running (flymake-mode -1) in your config doesn’t make sense; it’s a minor mode that runs when certain major modes activate, which happens after your config is evaluated. Try (add-hook! latex-mode (flymake-mode -1)).

It still doesn’t work.