[nixos] Update recommended method for disabling nixos-company-options

Per discussion in #13164, we have a standard, consistent technique for doing
this across any layer. Provided that `global-company-mode` is not set, this
works as expected to disable company without requiring custom variables.
This commit is contained in:
Benjamin Hipple 2020-01-25 18:47:22 -05:00 committed by Maximilian Wolff
parent 539e954227
commit 6781dfe157
No known key found for this signature in database
GPG Key ID: 2DD07025BFDBD89A
4 changed files with 15 additions and 38 deletions

View File

@ -2465,8 +2465,6 @@ Other:
function (thanks to Profpatsch)
- Associate nix-mode with .nix files (thanks to jpathy)
- Updated layer banner (thanks to kalium)
- Added option =nixos-enable-company= to toggle company auto-completion
(thanks to bhipple)
**** Nim
- Added key binding ~SPC m h h~ to show symbol documentation
(thanks to Valts Liepiņš)

View File

@ -28,12 +28,8 @@ add =nixos= to the existing =dotspacemacs-configuration-layers= list in this
file.
* Configuration
Toggle whether =company-nixos-options= completion is enabled (defaults to =t=).
#+BEGIN_SRC emacs-lisp
(setq-default dotspacemacs-configuration-layers
'((nixos :variables nixos-enable-company t)))
#+END_SRC
On some systems, =company-nixos-options= may be very slow. If this is the case,
see the section on disabling the [[https://github.com/syl20bnr/spacemacs/blob/develop/doc/DOCUMENTATION.org#disabling-layer-services-in-other-layers][disabling auto-complete]] for the =nixos= layer.
* Key bindings
** NixOS Options

View File

@ -1,14 +0,0 @@
;;; config.el --- NixOS Layer configuration File for Spacemacs
;;
;; Copyright (c) 2015-2020 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(defvar nixos-enable-company t
"Enable company completion via company-nixos-options")

View File

@ -10,26 +10,23 @@
;;; License: GPLv3
(defconst nixos-packages
'(company
(company-nixos-options :requires company)
flycheck
(helm-nixos-options :requires helm)
nix-mode
nixos-options))
'((company-nixos-options :requires company)
flycheck
(helm-nixos-options :requires helm)
nix-mode
nixos-options))
(defun nixos/post-init-company ()
(when nixos-enable-company
(let ((backends '(company-capf)))
(when (configuration-layer/package-used-p 'company-nixos-options)
(add-to-list 'backends 'company-nixos-options t))
(eval `(spacemacs|add-company-backends
:backends ,backends
:modes nix-mode)))))
(let ((backends '(company-capf)))
(when (configuration-layer/package-used-p 'company-nixos-options)
(add-to-list 'backends 'company-nixos-options t))
(eval `(spacemacs|add-company-backends
:backends ,backends
:modes nix-mode))))
(defun nixos/init-company-nixos-options ()
(use-package company-nixos-options
:if nixos-enable-company
:defer t))
(use-package company-nixos-options
:defer t))
(defun nixos/init-helm-nixos-options ()
(use-package helm-nixos-options