From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sebastian Wiesner Newsgroups: gmane.emacs.devel Subject: Inhibit "Wrote foo" from write-region Date: Tue, 21 Jan 2014 13:32:02 +0100 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1390307531 20139 80.91.229.3 (21 Jan 2014 12:32:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 21 Jan 2014 12:32:11 +0000 (UTC) To: Emacs-Devel devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jan 21 13:32:18 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1W5aV8-0005cI-3N for ged-emacs-devel@m.gmane.org; Tue, 21 Jan 2014 13:32:18 +0100 Original-Received: from localhost ([::1]:57883 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5aV7-00066R-FU for ged-emacs-devel@m.gmane.org; Tue, 21 Jan 2014 07:32:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45182) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5aUy-00066E-Qy for emacs-devel@gnu.org; Tue, 21 Jan 2014 07:32:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W5aUw-0007tO-4h for emacs-devel@gnu.org; Tue, 21 Jan 2014 07:32:08 -0500 Original-Received: from mail-bk0-x231.google.com ([2a00:1450:4008:c01::231]:52989) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5aUv-0007tD-Tw for emacs-devel@gnu.org; Tue, 21 Jan 2014 07:32:06 -0500 Original-Received: by mail-bk0-f49.google.com with SMTP id v15so883961bkz.22 for ; Tue, 21 Jan 2014 04:32:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=user-agent:from:to:subject:date:message-id:mime-version :content-type:content-transfer-encoding; bh=rlAeRSyfmfpF1XGAgsEkM/BU7TRsFx0rwM4Y9fnCpG8=; b=WevteNkyPujDc04vTT/9sSwBZvk+Gz70wl9eOEGmVIxpFNnCqqgZJe7pScsuD02BLD hzxodsrfCz+8resIl+Bky0p7Fg9JMOeDJ16mXPTJ+x4NSa8VvOfb/6x2pa6tvbgkDkff YqwOSQrxFa+MRXpI+CPnfT3bz0mgNrrjmWQtU3gcNGEZ7dCy46DgaIVCEomXdk+hRl0u yGapDtnVGn2NZXf2PzKiTAO9rf8gaaVq4/wNHXtBHE8FkiyszI2+kFuBH/YpP78B+qcX zVys+5naeLLJHIb6opOMllhjjI+D1RFLpnDUwpn85WW9qnacRkbINIDlZXN/KB5ACsIW iiGg== X-Received: by 10.204.127.142 with SMTP id g14mr102867bks.122.1390307524816; Tue, 21 Jan 2014 04:32:04 -0800 (PST) Original-Received: from lunaryorn-air.fritz.box ([2001:a60:13a5:1:8170:498e:1618:c993]) by mx.google.com with ESMTPSA id bf8sm3782222bkb.14.2014.01.21.04.32.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Jan 2014 04:32:04 -0800 (PST) User-agent: mu4e 0.9.9.6pre2; emacs 24.3.50.1 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4008:c01::231 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:168821 Archived-At: 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"?