* Changing company-mode settings while still running emacs
@ 2024-12-10 13:42 Heime via Users list for the GNU Emacs text editor
2024-12-11 2:08 ` Dmitry Gutov
0 siblings, 1 reply; 4+ messages in thread
From: Heime via Users list for the GNU Emacs text editor @ 2024-12-10 13:42 UTC (permalink / raw)
To: Heime via Users list for the GNU Emacs text editor
I am using
(add-hook 'after-init-hook 'global-company-mode)
to enable company-mode globally.
I would like the ability to change company-backends and other company
variable and apply them globally while still running emacs.
How can one do this?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Changing company-mode settings while still running emacs
2024-12-10 13:42 Changing company-mode settings while still running emacs Heime via Users list for the GNU Emacs text editor
@ 2024-12-11 2:08 ` Dmitry Gutov
2024-12-11 11:28 ` Heime via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Gutov @ 2024-12-11 2:08 UTC (permalink / raw)
To: Heime, Heime via Users list for the GNU Emacs text editor
On 10/12/2024 15:42, Heime via Users list for the GNU Emacs text editor
wrote:
> I would like the ability to change company-backends and other company
> variable and apply them globally while still running emacs.
M-x customize-variable
usually helps - like with most other options in Emacs (it has a "save"
button).
Or you can manipulate those values using Lisp. I'm guessing you're not
at that level (hence the question), so the Customize interface should be
the easier option.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Changing company-mode settings while still running emacs
2024-12-11 2:08 ` Dmitry Gutov
@ 2024-12-11 11:28 ` Heime via Users list for the GNU Emacs text editor
2024-12-12 2:32 ` Dmitry Gutov
0 siblings, 1 reply; 4+ messages in thread
From: Heime via Users list for the GNU Emacs text editor @ 2024-12-11 11:28 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: Heime via Users list for the GNU Emacs text editor
Sent with Proton Mail secure email.
On Wednesday, December 11th, 2024 at 2:08 PM, Dmitry Gutov <dmitry@gutov.dev> wrote:
> On 10/12/2024 15:42, Heime via Users list for the GNU Emacs text editor
> wrote:
>
> > I would like the ability to change company-backends and other company
> > variable and apply them globally while still running emacs.
>
>
> M-x customize-variable
>
> usually helps - like with most other options in Emacs (it has a "save"
> button).
>
> Or you can manipulate those values using Lisp. I'm guessing you're not
> at that level (hence the question), so the Customize interface should be
> the easier option.
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)) )
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Changing company-mode settings while still running emacs
2024-12-11 11:28 ` Heime via Users list for the GNU Emacs text editor
@ 2024-12-12 2:32 ` Dmitry Gutov
0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Gutov @ 2024-12-12 2:32 UTC (permalink / raw)
To: Heime; +Cc: Heime via Users list for the GNU Emacs text editor
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).
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-12-12 2:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-10 13:42 Changing company-mode settings while still running emacs Heime via Users list for the GNU Emacs text editor
2024-12-11 2:08 ` Dmitry Gutov
2024-12-11 11:28 ` Heime via Users list for the GNU Emacs text editor
2024-12-12 2:32 ` Dmitry Gutov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).