all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Sebastian Wiesner <lunaryorn@gmail.com>
To: Emacs-Devel devel <emacs-devel@gnu.org>
Subject: Inhibit "Wrote foo" from write-region
Date: Tue, 21 Jan 2014 13:32:02 +0100	[thread overview]
Message-ID: <m2r481o6rh.fsf@lunaryorn-air.fritz.box> (raw)

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
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	other threads:[~2014-01-21 12:32 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-21 12:32 Sebastian Wiesner [this message]
2014-01-21 12:38 ` Inhibit "Wrote foo" from write-region Sebastian Wiesner
2014-01-21 15:57   ` Eli Zaretskii
2014-01-21 16:31     ` Sebastian Wiesner
2014-01-21 16:47       ` Eli Zaretskii
2014-01-22 12:35         ` Sebastian Wiesner
2014-01-22 15:11           ` Stefan Monnier
2014-01-22 17:00             ` Sebastian Wiesner
     [not found]       ` <<834n4xgu3z.fsf@gnu.org>
2014-01-21 17:59         ` Drew Adams
2014-01-21 18:26           ` Eli Zaretskii
2014-01-22  8:05           ` Juri Linkov
2014-01-21 16:42 ` Tom Tromey
2014-01-22 12:37   ` Sebastian Wiesner
2014-01-22 15:09     ` Stefan Monnier
2014-01-22 17:08       ` Sebastian Wiesner
2014-01-22 19:20         ` Stefan Monnier
2014-01-23  9:35           ` Sebastian Wiesner
2014-01-23 13:50             ` Stefan Monnier
2014-01-23 14:24               ` Sebastian Wiesner
2014-01-23 15:18                 ` Stefan Monnier
2014-01-23 16:15                   ` Sebastian Wiesner
2014-01-23 16:29                 ` Eli Zaretskii
2014-01-23 17:31                   ` Sebastian Wiesner
2014-01-23 18:04                     ` Eli Zaretskii
2014-01-24 20:14                       ` Sebastian Wiesner
2014-01-23 16:25               ` Eli Zaretskii
2014-01-23 17:37                 ` Sebastian Wiesner
2014-01-23 18:07                   ` Eli Zaretskii
2014-01-24 13:34                     ` Johan Andersson
2014-01-24 13:48                       ` Stefan Monnier
2014-01-24 14:25                       ` Eli Zaretskii
     [not found] <"<m2r481o6rh.fsf"@lunaryorn-air.fritz.box>

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2r481o6rh.fsf@lunaryorn-air.fritz.box \
    --to=lunaryorn@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.