From: Thien-Thi Nguyen <ttn@gnu.org>
To: david@adboyd.com (J. David Boyd)
Cc: help-gnu-emacs@gnu.org
Subject: Re: bash/readline emacs mode help
Date: Fri, 28 Jun 2013 12:30:09 +0200 [thread overview]
Message-ID: <87hagia5ou.fsf@zigzag.favinet> (raw)
In-Reply-To: <m9hihagj8mwg.fsf@W0144758.usac.mmm.com> (J. David Boyd's message of "Thu, 27 Jun 2013 13:49:03 -0400")
[-- Attachment #1.1: Type: text/plain, Size: 206 bytes --]
Tangentially, i find using Emacs for scripting (i.e., invoked with
‘--script’) is nicer if it has the ability to display stuff to stdout.
FWIW, here is a patch that adds ‘emacs-exit-messages’:
[-- Attachment #1.2: emacs-exit-messages.diff --]
[-- Type: text/x-diff, Size: 2265 bytes --]
commit da997204ccac1513452e801e974cf56895f15486
Author: Thien-Thi Nguyen <ttn@gnuvola.org>
Date: 2012-07-31 22:18:28 +0200
Add var ‘emacs-exit-messages’ and handle it during shutdown.
* emacs.c (shut_down_emacs): After resetting the tty, display
any strings specified by ‘emacs-exit-messages’ to stderr/stdout.
(syms_of_emacs Vemacs_exit_messages): New DEFVAR_LISP.
---
src/emacs.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/src/emacs.c b/src/emacs.c
index 13f6d11..6df4f12 100644
--- 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 = Fcar (Vemacs_exit_messages);
+ FILE *to = stderr;
+
+ if (CONSP (msg) && INTEGERP (Fcar (msg)))
+ {
+ if (1 == XINT (Fcar (msg)))
+ to = stdout;
+ msg = Fcdr (msg);
+ }
+ if (STRINGP (msg))
+ {
+ size_t expected = SBYTES (msg);
+ size_t actually = fwrite (SDATA (msg), 1, expected, to);
+
+ if (expected > actually)
+ abort ();
+ }
+ Vemacs_exit_messages = Fcdr (Vemacs_exit_messages);
+ }
+
stuff_buffered_input (stuff);
inhibit_sentinels = 1;
@@ -2314,6 +2338,14 @@ Before Emacs 24.1, the hook was not run in batch mode, i.e., if
`noninteractive' was non-nil. */);
Vkill_emacs_hook = 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 = 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. */);
[-- Attachment #1.3: Type: text/plain, Size: 172 bytes --]
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...
--
Thien-Thi Nguyen
GPG key: 4C807502
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
next prev parent reply other threads:[~2013-06-28 10:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-27 9:14 bash/readline emacs mode help C K Kashyap
2013-06-27 9:30 ` Teemu Likonen
2013-06-27 13:17 ` J. David Boyd
2013-06-27 13:24 ` J. David Boyd
[not found] ` <mailman.2565.1372339817.22516.help-gnu-emacs@gnu.org>
2013-06-27 15:27 ` Barry Margolin
2013-06-27 17:49 ` J. David Boyd
2013-06-28 10:30 ` Thien-Thi Nguyen [this message]
2013-06-29 16:05 ` C K Kashyap
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87hagia5ou.fsf@zigzag.favinet \
--to=ttn@gnu.org \
--cc=david@adboyd.com \
--cc=help-gnu-emacs@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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).