From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kaushal Modi Newsgroups: gmane.emacs.help Subject: Re: use-package Date: Tue, 03 May 2016 14:01:07 +0000 Message-ID: References: <874magv15u.fsf@mat.ucm.es> <87d1p38ll6.fsf@mat.ucm.es> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1462284138 4496 80.91.229.3 (3 May 2016 14:02:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 3 May 2016 14:02:18 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 03 16:02:17 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1axau1-0007IP-8n for geh-help-gnu-emacs@m.gmane.org; Tue, 03 May 2016 16:02:17 +0200 Original-Received: from localhost ([::1]:41500 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1axatx-0007Rm-Cu for geh-help-gnu-emacs@m.gmane.org; Tue, 03 May 2016 10:02:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33811) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1axatZ-00079B-Nt for help-gnu-emacs@gnu.org; Tue, 03 May 2016 10:01:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1axatN-00072e-7V for help-gnu-emacs@gnu.org; Tue, 03 May 2016 10:01:44 -0400 Original-Received: from mail-oi0-x231.google.com ([2607:f8b0:4003:c06::231]:35636) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1axatL-0006wN-Tb for help-gnu-emacs@gnu.org; Tue, 03 May 2016 10:01:37 -0400 Original-Received: by mail-oi0-x231.google.com with SMTP id x19so26227603oix.2 for ; Tue, 03 May 2016 07:01:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=PYNNG6xZGabLR05HsDTQoBKhpBWiZHOrnkDix+8qmuE=; b=IAgxZIe+n0wyqJyl7gB3UBdi/AGgBa0W4KfPQM2M6mHr5K6ZZG4uljFYgIeWV/y89b J69sKPX6km29CCsdH9r9oEREydz4hzqL0BzbmMDeKbDejo4K6JaHRIkatuWs+Zl+KuX0 duTuasqqHfkCtyxP/paJhr2Zu2B88hPk9+JsNPJMTNIhLh9YUVW+4ER+0539BuOlX0iZ np0/Ub1YP0hV7p+P7DPqGL6pmWCXpRApOguiu1LrIdP8IH2kxxTCqMs95PrO/c/8JXDP ibJlL48kJdNIUrCsynWH4X8V39kqkF0OvVStLHHlyJIXB5Gtq7TS/iYrMpyWDcU/mXcq Q3NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=PYNNG6xZGabLR05HsDTQoBKhpBWiZHOrnkDix+8qmuE=; b=UNvjAmWMwXh8d46peZ2FlQGtreetadst/qWl5Y9zFX/1WjMHtIekbcZCcv3sxTfAGK iJrZITtfysq4SEWV6kVSMrCIze/Osv1UTbAEBcEiYeSs1A1QxilxbfwTiu6Khom05S9g KEE8W9qYWWlP2vee9rJxycThTtAHx4URqW5iK+ZlAIiilLmzzu5YTJj1Su2u5V9/3BGG U79NbMi+hDrew6VH++BZhobYJEeYIdisSoYQVO8YXJKUDa6YXgwYW9o4mVIB8zBVYaWU mD5o2l5/qoTeT6NFVJMQylmmAMlWOleGLr4qi2Fh/NGUKPrc6PNeGhq/IBENiK59UwZB 7ftw== X-Gm-Message-State: AOPr4FXLw42dLrAQWiv7eIbjPQY+1uwPirisj2J0eV73GMToPNqGTUmWjcq/KMWCLn3IqW2ETazTqevu+IbKfw== X-Received: by 10.157.6.80 with SMTP id 74mr1270250otn.164.1462284077705; Tue, 03 May 2016 07:01:17 -0700 (PDT) In-Reply-To: <87d1p38ll6.fsf@mat.ucm.es> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4003:c06::231 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:109865 Archived-At: > > Thanks. Just one question, for example my emacs_keys file contains stuff > like > > (defun some-funny functions () > ) > (global-set-key [(f1)] 'save-buffer) > (global-set-key [(f2)] 'some-funny-function) > > (provide 'emacs_keys) > > So using > > - use-package is possible? > Yes. Assuming that your emacs_keys.el is already in the load-path (i.e. you are able to successfully do (require 'emacs_keys), you can do instead (use-package emacs_keys) - and if so: would it shorten startup? > Most likely, not. use-package speeds up startup times by delaying the loading the packages that you can afford to.. for example, you do not need to load org-mode until you are in a buffer with org-mode major mode or you call one of the commands like org-agenda that autoloads org-mode. So if you load org-mode using use-package and its ":defer t" or ":commands (...)" or similar load-deferring options, you will see an improvement in the startup time. use-package, very broadly put, is syntax sugar, a very elaborate macro, in a good way. To understand what it does, type the below, place cursor after the closing parenthesis and do M-x pp-macroexpand-last-sexp. (use-package org-mode) Now do the same with (use-package org-mode :defer t) And once again do it with (use-package org-mode :mode ("\\.org\\'" . org-mode)) Study the raw elisp that all of the 3 macros above expand to and understand them. That, in conjunction with reading the documentation on https://github.com/jwiegley/use-package will make you understand what use-package exactly does and how it saves you startup time. If it helps, you can also go through few of my setup-*.el files here ( https://github.com/kaushalmodi/.emacs.d/tree/master/setup-files ) and see how I use use-package for various packages. You can ignore the :config and :init blocks in my use-package blocks and focus only on blocks like :defer, :mode, :commands, :bind, etc which help me speedup my emacs startup. -- -- Kaushal Modi