emacs-devel
[Top][All Lists]
Advanced

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

Re: Inhibit "Wrote foo" from write-region


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

address@hidden writes:

> Hello,
>
> 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

Monkey-patching "message"… sorry

> 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
> "write-region".
>
> 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
> messages:
>
> Wrote /Users/swiesner/.cask/.cask/24.3.50.1/elpa/archives/gnu/archive-contents
> Wrote 
> /Users/swiesner/.cask/.cask/24.3.50.1/elpa/archives/melpa/archive-contents
> Wrote 
> /Users/swiesner/.cask/.cask/24.3.50.1/elpa/helm-20140120.2307/helm-net.el
> Wrote 
> /Users/swiesner/.cask/.cask/24.3.50.1/elpa/helm-20140120.2307/helm-ring.el
> Wrote 
> /Users/swiesner/.cask/.cask/24.3.50.1/elpa/helm-20140120.2307/helm-command.el
>
>
> 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]