From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: phillip.lord@russet.org.uk (Phillip Lord) Newsgroups: gmane.emacs.devel Subject: Re: Adding streams for standard out and standard err Date: Thu, 21 Jul 2016 19:52:58 +0100 Message-ID: <87k2ge3jsl.fsf@russet.org.uk> References: <87oa5sexis.fsf@russet.org.uk> <83eg6nysug.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1469129274 18855 80.91.229.3 (21 Jul 2016 19:27:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 21 Jul 2016 19:27:54 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jul 21 21:27:45 2016 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 1bQJdH-0005Nd-5k for ged-emacs-devel@m.gmane.org; Thu, 21 Jul 2016 21:27:43 +0200 Original-Received: from localhost ([::1]:43204 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQJdG-0002Es-Hj for ged-emacs-devel@m.gmane.org; Thu, 21 Jul 2016 15:27:42 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50821) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQJ5m-00009o-FD for emacs-devel@gnu.org; Thu, 21 Jul 2016 14:53:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQJ5l-0006af-Ev for emacs-devel@gnu.org; Thu, 21 Jul 2016 14:53:06 -0400 Original-Received: from cloud103.planethippo.com ([31.216.48.48]:34410) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQJ5h-0006Zp-5L; Thu, 21 Jul 2016 14:53:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=russet.org.uk; s=default; h=Content-Type:MIME-Version:Message-ID: In-Reply-To:Date:References:Subject:Cc:To:From; bh=1tqzKKF7sEJa3jDQNX4vcmn7vF+ByDSYZVsYxnbdSC8=; b=1nt6+NOA9jsBw240mSMJZsu7KI fnYWHywVWABkp7cbfc7TdqwCs3X2o/9Aa7lLJcebVRr6KDksXJEc6eXO9XQlJL0SMijfCFjFE0qti +L4hmK51om5hSZPMBfVxATc4x4DNutEJ6vWZyXDHl8kTWIftJj8Gkb8KI8hduZ45A4dj2t+8TpSyp efYdTku60RN+qXfGsePRb5rOxiEevA85BZ2YNgB7wTylbeKJ1IsKYN8+GvI5OXQDRnWreoAcs7ZlD 6oqee2oudS27TkvGG+s8vStHT6SAsrjkf5C8rtqXGtKVSHO0Jd43C8c+eGmWQKKh1LGu2uBT9eZkE JiP+GzIA==; Original-Received: from cpc1-benw10-2-0-cust373.gate.cable.virginm.net ([77.98.219.118]:52610 helo=russet.org.uk) by cloud103.planethippo.com with esmtpsa (TLSv1.2:DHE-RSA-AES128-SHA:128) (Exim 4.86_1) (envelope-from ) id 1bQJ5f-0010dc-R3; Thu, 21 Jul 2016 19:52:59 +0100 In-Reply-To: <83eg6nysug.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 21 Jul 2016 17:21:43 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.95 (gnu/linux) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cloud103.planethippo.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - russet.org.uk X-Get-Message-Sender-Via: cloud103.planethippo.com: authenticated_id: phillip.lord@russet.org.uk X-Authenticated-Sender: cloud103.planethippo.com: phillip.lord@russet.org.uk X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 31.216.48.48 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:205987 Archived-At: Eli Zaretskii writes: >> From: phillip.lord@russet.org.uk (Phillip Lord) >> Date: Wed, 20 Jul 2016 23:48:43 +0100 >> >> For a while I've wanted Emacs to have the ability to write to standard >> out, and/or standard err, when not running in batch. Mostly, I've wanted >> for debugging, as it involves touching no buffers at all. > > Can we take a step back and talk about the need and the use cases? Mostly debugging, I think. For example, I find debugging the undo code very taxing. Using GDB is hard because the debug code gets called so often (I admit to being barely competent at using GDB). Logging to a buffer touches other buffers. Logging to a variable works, but you can only see the value of the variable when all is done. Dumping to stdout, while interacting with a live emacs would give me an independent channel to getting output, as well as post-hoc debugging. > Here're some thoughts related to this: > > . We already have (append-to-file START END FILENAME), which can be > used to write a buffer or a string to a file. FILENAME can be > "/dev/stderr" on Posix platforms, for example, or it can be a real > file name. We do, and I am grateful that you pointed this out to me. But append-to-file also writes to the mini-buffer. This makes interactive use difficult, or painful. Of course, this could be fixed. Still, (append-to-file (print buffer-undo-list) nil "/dev/stderr") seems clunky compared to: (print buffer-undo-list 'stdout) > . On TTY frames, writing to standard streams can end up on the > screen, in which case it will mess up the display. Yep. I would imagine that debugging to standard out will not become popular as a tool for debugging TTY display. > . On GUI frames, writing to standard streams can end up in some > unpredictable place on the system, or even in the bitbucket, > depending on what window system, desktop, and window manager are > installed. On some systems, standard streams have invalid file > descriptors in GUI sessions. It can also end up in some entirely predictable place, which is enough. > So this proposed functionality sounds (a) not really necessary, and > (b) somewhat unreliable/dangerous. If you have specific use cases > where the existing functionality doesn't fit the bill, and the issues > mentioned above are non-issues, please describe those use cases. I think it has no problems that append-to-file does not not have, and is neater, more concise and it's use is clearer. Probably adding a stdin stream would be good also; still, that's a separate issue. Phil