From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Kost Subject: [PATCH 4/5] gnu: emacs: Simplify "guix-emacs.el". Date: Sat, 18 Feb 2017 12:21:44 +0300 Message-ID: <20170218092145.28459-5-alezost@gmail.com> References: <20170218092145.28459-1-alezost@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47442) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cf1DU-0004rP-Bi for guix-devel@gnu.org; Sat, 18 Feb 2017 04:22:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cf1DT-0000dF-5l for guix-devel@gnu.org; Sat, 18 Feb 2017 04:22:08 -0500 Received: from mail-lf0-x244.google.com ([2a00:1450:4010:c07::244]:34377) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cf1DS-0000c4-UY for guix-devel@gnu.org; Sat, 18 Feb 2017 04:22:07 -0500 Received: by mail-lf0-x244.google.com with SMTP id q89so5399037lfi.1 for ; Sat, 18 Feb 2017 01:22:06 -0800 (PST) Received: from localhost.localdomain ([217.107.194.130]) by smtp.gmail.com with ESMTPSA id a138sm3242010lfb.2.2017.02.18.01.22.04 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Feb 2017 01:22:04 -0800 (PST) In-Reply-To: <20170218092145.28459-1-alezost@gmail.com> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org * gnu/packages/aux-files/emacs/guix-emacs.el: Do not try to require 'guix-profiles'. Do not call 'guix-emacs-autoload-packages' in the top level. (guix-package-enable-at-startup): Remove. This variable can't be set by a user since this file is loaded before user config. (guix-emacs-autoload-packages): Use 'guix-read-package-profile' instead of 'guix-profile-prompt' in interactive clause (it was renamed in Emacs-Guix). * gnu/packages/emacs.scm (emacs)[arguments]: Call 'guix-emacs-autoload-packages' in "site-start.el" after requiring 'guix-emacs'. --- gnu/packages/aux-files/emacs/guix-emacs.el | 21 +++++---------------- gnu/packages/emacs.scm | 4 +++- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/gnu/packages/aux-files/emacs/guix-emacs.el b/gnu/packages/aux-files/emacs/guix-emacs.el index 099261a..2bbd639 100644 --- a/gnu/packages/aux-files/emacs/guix-emacs.el +++ b/gnu/packages/aux-files/emacs/guix-emacs.el @@ -1,6 +1,6 @@ ;;; guix-emacs.el --- Emacs packages installed with Guix -;; Copyright © 2014, 2015, 2016 Alex Kost +;; Copyright © 2014, 2015, 2016, 2017 Alex Kost ;; This file is part of GNU Guix. @@ -19,22 +19,14 @@ ;;; Commentary: -;; This file provides auxiliary code for working with Emacs packages +;; This file provides auxiliary code to autoload Emacs packages ;; installed with Guix. ;;; Code: (require 'cl-lib) -(unless (require 'guix-profiles nil t) - (defvar guix-user-profile (expand-file-name "~/.guix-profile"))) -(defcustom guix-package-enable-at-startup t - "If non-nil, activate Emacs packages installed in a user profile. -Set this variable to nil before requiring `guix-emacs' file to -avoid loading autoloads of Emacs packages installed in -`guix-user-profile'." - :type 'boolean - :group 'guix) +(defvar guix-user-profile (expand-file-name "~/.guix-profile")) (defvar guix-emacs-autoloads nil "List of the last loaded Emacs autoloads.") @@ -92,8 +84,8 @@ profiles. 'Autoload' means add directories with Emacs packages to `load-path' and load 'autoloads' files matching `guix-emacs-autoloads-regexp'." - (interactive (list (if (fboundp 'guix-profile-prompt) - (funcall 'guix-profile-prompt) + (interactive (list (if (fboundp 'guix-read-package-profile) + (funcall 'guix-read-package-profile) guix-user-profile))) (let ((profiles (or profiles (list "/run/current-system/profile" @@ -115,9 +107,6 @@ profiles. (setq guix-emacs-autoloads (append new-autoloads guix-emacs-autoloads)))))))) -(when guix-package-enable-at-startup - (guix-emacs-autoload-packages)) - (provide 'guix-emacs) ;;; guix-emacs.el ends here diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm index 51a579a..94ca52a 100644 --- a/gnu/packages/emacs.scm +++ b/gnu/packages/emacs.scm @@ -144,7 +144,9 @@ (string-append lisp-dir "/guix-emacs.el")) (with-output-to-file (string-append lisp-dir "/site-start.el") (lambda () - (display "(require 'guix-emacs nil t)"))) + (display + (string-append "(when (require 'guix-emacs nil t)\n" + " (guix-emacs-autoload-packages))\n")))) #t)))))) (inputs `(("gnutls" ,gnutls) -- 2.10.2