unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Dmitry Gutov <dmitry@gutov.dev>
To: Heime <heimeborgia@protonmail.com>
Cc: Heime via Users list for the GNU Emacs text editor
	<help-gnu-emacs@gnu.org>
Subject: Re: Changing company-mode settings while still running emacs
Date: Thu, 12 Dec 2024 04:32:31 +0200	[thread overview]
Message-ID: <855dc0d0-dea9-4ef7-a25f-273823268704@gutov.dev> (raw)
In-Reply-To: <7ScaWnsN7LxWEzAMgHpn61X5Banhsg3FSWB214hzmmd62clELxffrQqK9tPWcepVOeJzVQQ573F9nj9CQgpNbym6Hex1zvC5XfLWTcN8wg4=@protonmail.com>

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	other threads:[~2024-12-12  2:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=855dc0d0-dea9-4ef7-a25f-273823268704@gutov.dev \
    --to=dmitry@gutov.dev \
    --cc=heimeborgia@protonmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).