From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.emacs.help Subject: Re: bash/readline emacs mode help Date: Fri, 28 Jun 2013 12:30:09 +0200 Message-ID: <87hagia5ou.fsf@zigzag.favinet> References: <87hagjgatk.fsf@mithlond.arda> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Trace: ger.gmane.org 1372415288 18150 80.91.229.3 (28 Jun 2013 10:28:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 28 Jun 2013 10:28:08 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: david@adboyd.com (J. David Boyd) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jun 28 12:28:08 2013 Return-path: Envelope-to: geh-help-gnu-emacs@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 1UsVuR-0006MC-Ls for geh-help-gnu-emacs@m.gmane.org; Fri, 28 Jun 2013 12:28:07 +0200 Original-Received: from localhost ([::1]:34778 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsVuR-0006Fx-6m for geh-help-gnu-emacs@m.gmane.org; Fri, 28 Jun 2013 06:28:07 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59043) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsVuF-0006Fj-KH for help-gnu-emacs@gnu.org; Fri, 28 Jun 2013 06:27:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UsVuD-0003Eq-J8 for help-gnu-emacs@gnu.org; Fri, 28 Jun 2013 06:27:55 -0400 Original-Received: from smtp207.alice.it ([82.57.200.103]:33417) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsVuD-0003Ed-8o for help-gnu-emacs@gnu.org; Fri, 28 Jun 2013 06:27:53 -0400 Original-Received: from zigzag.favinet (79.21.64.44) by smtp207.alice.it (8.6.060.15) id 51CD440B0008966E; Fri, 28 Jun 2013 12:27:50 +0200 Original-Received: from ttn by zigzag.favinet with local (Exim 4.72) (envelope-from ) id 1UsVwe-0004S2-5U; Fri, 28 Jun 2013 12:30:24 +0200 In-Reply-To: (J. David Boyd's message of "Thu, 27 Jun 2013 13:49:03 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 82.57.200.103 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:91811 Archived-At: --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Tangentially, i find using Emacs for scripting (i.e., invoked with =E2=80=98--script=E2=80=99) is nicer if it has the ability to display stuff= to stdout. FWIW, here is a patch that adds =E2=80=98emacs-exit-messages=E2=80=99: --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: inline; filename=emacs-exit-messages.diff Content-Transfer-Encoding: quoted-printable commit da997204ccac1513452e801e974cf56895f15486 Author: Thien-Thi Nguyen Date: 2012-07-31 22:18:28 +0200 Add var =E2=80=98emacs-exit-messages=E2=80=99 and handle it during shut= down. * emacs.c (shut_down_emacs): After resetting the tty, display any strings specified by =E2=80=98emacs-exit-messages=E2=80=99 to stder= r/stdout. (syms_of_emacs Vemacs_exit_messages): New DEFVAR_LISP. =2D-- src/emacs.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/emacs.c b/src/emacs.c index 13f6d11..6df4f12 100644 =2D-- a/src/emacs.c +++ b/src/emacs.c @@ -1920,6 +1920,30 @@ shut_down_emacs (int sig, Lisp_Object stuff) reset_all_sys_modes (); #endif + /* If there are any messages, display them now. + Silently ignore ill-formed data, which is a latent bug. */ + while (CONSP (Vemacs_exit_messages)) + { + Lisp_Object msg =3D Fcar (Vemacs_exit_messages); + FILE *to =3D stderr; + + if (CONSP (msg) && INTEGERP (Fcar (msg))) + { + if (1 =3D=3D XINT (Fcar (msg))) + to =3D stdout; + msg =3D Fcdr (msg); + } + if (STRINGP (msg)) + { + size_t expected =3D SBYTES (msg); + size_t actually =3D fwrite (SDATA (msg), 1, expected, to); + + if (expected > actually) + abort (); + } + Vemacs_exit_messages =3D Fcdr (Vemacs_exit_messages); + } + stuff_buffered_input (stuff); inhibit_sentinels =3D 1; @@ -2314,6 +2338,14 @@ Before Emacs 24.1, the hook was not run in batch mod= e, i.e., if `noninteractive' was non-nil. */); Vkill_emacs_hook =3D Qnil; + DEFVAR_LISP ("emacs-exit-messages", Vemacs_exit_messages, + doc: /* List of strings to display to stderr at exit. +These are output as-is, so you need to include a newline. +Each element may also have form (FD . STRING), where FD is +a small integer: 1 for standard output, 2 for standard error. +All other FD values are taken as 2. */); + Vemacs_exit_messages =3D Qnil; + DEFVAR_LISP ("path-separator", Vpath_separator, doc: /* String containing the character that separates directories= in search paths, such as PATH and other similar environment variables. */); --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable It was written a while back, so i'd love to learn that is is obsoleted since then by some workalike feature. But if not... =2D-=20 Thien-Thi Nguyen GPG key: 4C807502 --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAlHNZbkACgkQZwMiJEyAdQJBlgCfWTitZZbwq1vhjFAOuoTo/wxF LoEAniQE+AUkQkKSmbjoUEPIBs2d3DPM =p6Ub -----END PGP SIGNATURE----- --==-=-=--