help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing company-mode settings while still running emacs


From: Dmitry Gutov
Subject: Re: Changing company-mode settings while still running emacs
Date: Thu, 12 Dec 2024 04:32:31 +0200
User-agent: Mozilla Thunderbird

On 11/12/2024 13:28, Heime wrote:
I want to do it with lisp.  Have made this interactive function to
set up the company-backends, but instead of applying the changes
locally, I want to apply them globally.

(defun companiol-backends-kntlr (actm-seqr)

   (interactive
     (let* ( (cseq '("company-dabbrev"
                     "company-dabbrev-code"
                     "company-keywords"
                     "company-capf"
                     "company-yasnippet"
                     "company-files"))

             (backends-seltr
                 (completing-read-multiple "Backends: " cseq nil t)))

       (list (mapcar #'intern backends-seltr))))

     (setq company-backends actm-seqr)

     ;; Refresh company-mode to apply the changes
     (when (bound-and-true-p company-mode)
       (company-mode -1) (company-mode 1)) )

No need to re-enable the mode to have the new value picked up. As long as there's no buffer-local value (set up by yourself or your "distribution" such as Doom or Spacemacs), that should work right away, at least if there is no current completion session (to simplify, no popup visible).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]