From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Ergus Newsgroups: gmane.emacs.help Subject: Re: About early-init right use. Date: Tue, 2 Apr 2019 18:55:22 +0200 Message-ID: <20190402165522.nsllny2i4bphy7xi@Ergus> References: <20190401235436.2cnhvuxzdj635hpn.ref@Ergus> <20190401235436.2cnhvuxzdj635hpn@Ergus> <20190402063900.GA24769@tuxteam.de> <421e6084-47e1-43d2-9436-1f82b406e730@default> <20190402154222.GA9550@tuxteam.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="36867"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: NeoMutt/20180716 Cc: help-gnu-emacs@gnu.org To: tomas@tuxteam.de Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Apr 02 18:57:44 2019 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hBMjH-0009TY-IP for geh-help-gnu-emacs@m.gmane.org; Tue, 02 Apr 2019 18:57:43 +0200 Original-Received: from localhost ([127.0.0.1]:59093 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBMjG-00071N-FV for geh-help-gnu-emacs@m.gmane.org; Tue, 02 Apr 2019 12:57:42 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:44241) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBMj3-00071H-IX for help-gnu-emacs@gnu.org; Tue, 02 Apr 2019 12:57:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hBMj2-0001NG-8m for help-gnu-emacs@gnu.org; Tue, 02 Apr 2019 12:57:29 -0400 Original-Received: from sonic317-53.consmr.mail.bf2.yahoo.com ([74.6.129.108]:37529) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hBMj1-0001LW-Kf for help-gnu-emacs@gnu.org; Tue, 02 Apr 2019 12:57:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1554224246; bh=IMABOl/xvTWGxGc1GDVTtkMVj332i2c2lVXOLkqDBSQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject; b=AhyEO6rjPKXoPGzLNW8j33wP02wtaQw0PoP2pwJnWcvXaz1dHQj/3YsECi+GnNWIaehQOk78cD2qWiOO3JBKtvY3po9e4WNSc7z1gE1gIF7WvD73Y064fMfbJu7NW14SJ5uK2i+Yz6Rl4rG86TJzaNU8IiWvGjQ4jqUo0OGenypMTn+FcE/LQS9Mtg1SCS5iIfd6eYC1cdfDS3QUAKC/7sK2bYegD5V4mx1uu0VmyBqXjvJMIE0gi10TlI+ABE8jM0G6eMdeLgDhy3JhGPYUt8QV6wRBwr9NYRA/m1Ez1TKEUn1tQUwWwsDsngXggovgp/3R+eMBe/MJ187aBasPlA== X-YMail-OSG: xhACwXUVM1m22mWw7SWPsJmClccVRUcFJeBU9GTFi6xbjcQ0c_gQuko.PaeRwvd kPSNhgicLCvRFWWf5BI1bT72qsL2Zz1_DgTlJ.UUAEDcFlgB0dPd8JQ5NeYr.jkqH05Gst.0U3T2 vDrb0hpIHPrIJmUlQj.ZXhAWS775bvtZg5fx0mi4k_hC0WcvdN0JnsgFm6qUZXP.oe_ZkMAwo3sz eq0zAtf8PwiLyRQv2iu35QJRyWo5P0lUhpF5nkQGoH7eqF2KlFGIIxS.uhcnQtD_mbwHphIXXyY6 tK0ZXqH_8abNb_WSo5WyBEumT75pRXm.E2DY_GcvD9g_GfjYJm4T9vzL1PBx_wGWfFJoXoC_Oy9C x_JyUCQhMG5WMGPsDkojPvjn563eP5AmG8d4L.noL8N7lyA8h3WZGUnCxvY2UOVeZkySYX.UfWP9 XVvGP0hBdh7tAf4q4AKqYrgpjG_rm.QvRwH76ROCBo5dX5OfKbJrViNZ0Gv5L8DC1SB.0mIkLWt0 7o7fjWFmH5UEQJ_35GP46i8_a2dKDjV8H6xFin4T4HFy9YOuiawsSRSGXK6QqiBzC29AcsrVgc44 yLTZKX8im6gSvaHek54C.sGenWlLrQDEA4vbX5qOhZMMyFeySQ26V0kagrdNocWcVH3rl1Tq11iX av4MP6zd4NQ6JGamsZ1T0yNEAluvfPFJyH4JPtKGBsMU3QNfTTUiJVPwfDjegISuWFw8uhcHZFtS chLtHfqI.QFj.eIaD2wYgpyyVXxb9Pyt4OD4ArNoVo8KFCbmAXN1D0XsRb0LSrCVyXVttE4Zkjs3 EwZP_gCPCpaeZaRvoKvRS0U93tpCl4rHKofcHh79QW Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic317.consmr.mail.bf2.yahoo.com with HTTP; Tue, 2 Apr 2019 16:57:26 +0000 Original-Received: from 2.152.205.184.dyn.user.ono.com (EHLO Ergus) ([2.152.205.184]) by smtp401.mail.ir2.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID d95a151323ebb7e6345949e02a7559f8; Tue, 02 Apr 2019 16:55:25 +0000 (UTC) Content-Disposition: inline In-Reply-To: <20190402154222.GA9550@tuxteam.de> X-Mailer: WebService/1.1.13212 hermes AHC/2.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 74.6.129.108 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:119833 Archived-At: I know the manual is pretty nice, but some good examples for the "things to put before the GUIs get initialized" is not a bad idea. I mixed some things I found here and there and mixed everything to optimize the startup time (as an experiment) ``` (defconst my/start-time (current-time)) (defvar file-name-handler-alist-old file-name-handler-alist) (setq file-name-handler-alist nil message-log-max 16384 gc-cons-threshold most-positive-fixnum ;; Defer Garbage collection gc-cons-percentage 1.0) (add-hook 'emacs-startup-hook `(lambda () (setq file-name-handler-alist file-name-handler-alist-old gc-cons-threshold 800000 gc-cons-percentage 0.1) (garbage-collect) (message "Load time %.06f" (float-time (time-since my/start-time)))) t) (tool-bar-mode -1) (menu-bar-mode -1) (scroll-bar-mode -1) (tooltip-mode -1) ;; Tool tip in the echo (flymake-mode -1) ;;__________________________________________________________ ;; For using Melpa and Elpa (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") ("melpa" . "https://melpa.org/packages/"))) (setq package-quickstart t) ;;-------------------- Some tricks-------------------------- (provide 'early-init) ;;; early-init.el ends here ``` In fact this, mixed with the use-package :bind :commands and so on reduced my loading time from ~2 to ~0.9 seconds. But I think this is a little bit too much for the early init and some of the options doesn't really produce any improvement, so they should go in the init.el But I wanted to have a "stronger" argument about what to put and what not. On Tue, Apr 02, 2019 at 05:42:22PM +0200, tomas@tuxteam.de wrote: >On Tue, Apr 02, 2019 at 07:21:30AM -0700, Drew Adams wrote: >> > from the 27.0.50 manual (Node "Customization > Init File > >> > Early Init File"): >> > >> > This file is loaded before the >> > package system and GUI is initialized, so in it you can customize >> > variables that affect frame appearance as well as the package >> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> > initialization process... >> > >> > the early init file is read before the GUI is initialized, >> > so customizations related to GUI features will not work reliably >> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> > in ‘early-init.el’. >> >> Seems a bit contradictory wrt "variables that affect frame >> appearance". What variables are we talking about, if they >> are not "related to GUI features"? > >Hm. I read it differently: putting things in early-init.el gives you >the chance to do things /before/ GUI and frame-appearance things are >initialized. Thus it gives you the power to fix things, but also >to break things. > >Put it another way: you almost never want to put anything into >early-init.el -- unless you have the hunch that you need to change >something before GUIs get initialized (e.g. to let them "see" a >different variable value). > >Or more TL;DR you better know why you are in there ;-D > >Cheers >-- tomás