2

I would like to prevent Emacs from reporting on everyting that is being loaded at startup in the minibuffer. This is because it seems to pause when telling me which files are being loaded that I have specified myself in my init file.

I have byte-compiled the files that I load from my init file, but the minibuffer still gives me the same message and waits for ~3 seconds per loaded file.

I already use many (inhibit startup-* t) style commands in my init file, so that emacs is faster at startup and I don't get the GNU start screen etc., but I cannot find an equivalent for the minibuffer.

I have found mini-buffer-message and minibuffer-massage-timeout, with the option to set how long messages appear for, which sounds great, but I only want this action (i.e. := zero!) for the startup process, I want the messages otherwise.

Something similar to this might be an idea, but it isn't meant for the Emacs GUI, rather terminal use of eLisp, as far as I can understand.

3
  • "This is because it seems to pause when telling me..." No, it doesn't pause (unless you have your own code that causes that). And the time to print the messages is negligible. (But that doesn't imply that you need to see the messages. ;-))
    – Drew
    Dec 12, 2015 at 16:29
  • @Drew - I haven't added any code myelf... could it be in the file that is beign loaded somehow? Or do even compiled files require ~3 seconds to be read?? I think not! :) With this in mind, and if we assume everything that is done at startup is printed to the minibuffer (which appears to be the case), then Emacs is doing nothing while I am reading that the file is loading/was loaded. Which assumption is false? How can I hide those messages? Not seeing them might be enough to make me forget this problem!
    – n1k31t4
    Dec 12, 2015 at 17:02
  • If it could be something in the file (which maaybe really takes seconds to do/read), maybe you can spot it in this case: indent-guide.el
    – n1k31t4
    Dec 12, 2015 at 17:04

1 Answer 1

1

The most straightforward solution is to pass t to load as its third argument, i.e.

(load "my-file" nil t)

From the documentation for load:

(load FILE &optional NOERROR NOMESSAGE NOSUFFIX MUST-SUFFIX)

Execute a file of Lisp code named FILE.

[...]

If optional second arg NOERROR is non-nil, report no error if FILE doesn't exist. Print messages at start and end of loading unless optional third arg NOMESSAGE is non-nil (but `force-load-messages' overrides that).

A better solution (in my opinion) would be to use require instead of load, assuming the file in question has a provide statement (typically at the very end of the file). For the file you specified in your comment (indent-guide.el), the syntax would be:

(require 'indent-guide)

This will load the specified file (and suppress the loading messages automatically), but only if the file isn't already loaded.

2
  • That's great - I am ashamed not to have known that about load. Why do you say require is a better solution?
    – n1k31t4
    Dec 13, 2015 at 14:08
  • 1
    Mainly because require supports more complicated loading patterns than load. The most common case is if you want to load files A and B, and both depend on file C. In this case, files A and B should be using require to load C, or else the code in C will be executed twice. If C contains only definitions, this isn't a problem, but otherwise it could be. If your init file is simple enough, I guess you don't need to care, but if you're anything like me, your init file won't stay that simple for long. Dec 13, 2015 at 17:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.