[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Inhibit "Wrote foo" from write-region

From: Sebastian Wiesner
Subject: Inhibit "Wrote foo" from write-region
Date: Tue, 21 Jan 2014 13:32:02 +0100
User-agent: mu4e; emacs


I'm writing a tool for non-interactive package installation.  Think of
it as apt-get for ELPA packages, e.g. you can point it do a directory
and then install packages from the command line.

It generally works fine, but the *huge* amount of output produced by
package.el is a major nuisance currently.  Even installing trivial
packages results in a lot of "Compiling …", "Extracting…",
etc. messages, which provide no real value to the user.

Following the old Unix philosophy of "no news is good news", I'm trying
to reduce the output, by catching it in a separate buffer, and only
printing it an error was signalled.

By let-binding "standard-output", and monkey-patching Emacs, I managed
to get rid of most messages, but one kind of messages so far has
resisted any attempt to get rid of it: The "Wrote foo" messages of

By default, write-region these messages for every file it's called with.
For individual calls to write-region, this behaviour can be inhibited by
passing a symbol as VISIT argument, e.g. (write-region "Hello world" nil
"foo" 'no-message), however package.el, url.el and other involved
packages do not make general use of this.  For instance,
"package--write-file-no-coding" is defined as follows:

(defun package--write-file-no-coding (file-name)
  (let ((buffer-file-coding-system 'no-conversion))
    (write-region (point-min) (point-max) file-name)))

As you can see, it doesn't pass something for VISIT, and thus
"write-region" emits a "Wrote foo" for *every* file contained in a
package.  Try that with a package with many files, such as Org or Helm.
It spills the terminal with literally dozens of these pointless

Wrote /Users/swiesner/.cask/.cask/
Wrote /Users/swiesner/.cask/.cask/
Wrote /Users/swiesner/.cask/.cask/
Wrote /Users/swiesner/.cask/.cask/

Unfortunately, "write-region" does not seem to provide a way to
generally inhibit this message.  I looked at the C source: It calls
"message_with_string", which in turn directly "fprintf"s to stderr in a
non-interactive session.

Do I miss something?  If not, how could I silence "write-region"?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]