diff options
| author | Kim F. Storm | 2003-11-23 21:29:45 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2003-11-23 21:29:45 +0000 |
| commit | 6a1ff3ba09aca7f30b132ad65973506cf0416b53 (patch) | |
| tree | 0423777fb4a86c63f7c5251d30b0960268b86850 | |
| parent | 9ac5747987e4df08683ce2af46c8a7d09744dbd7 (diff) | |
| download | emacs-6a1ff3ba09aca7f30b132ad65973506cf0416b53.tar.gz emacs-6a1ff3ba09aca7f30b132ad65973506cf0416b53.zip | |
(Fredirect_debugging_output): New defun.
(syms_of_print): Defsubr it.
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/print.c | 34 |
2 files changed, 40 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index c353ab7a52b..fac85f28b3d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,8 +1,13 @@ | |||
| 1 | 2003-11-23 Kim F. Storm <storm@cua.dk> | ||
| 2 | |||
| 3 | * print.c (Fredirect_debugging_output): New defun. | ||
| 4 | (syms_of_print): Defsubr it. | ||
| 5 | |||
| 1 | 2003-11-22 Luc Teirlinck <teirllm@auburn.edu> | 6 | 2003-11-22 Luc Teirlinck <teirllm@auburn.edu> |
| 2 | 7 | ||
| 3 | * fns.c (Fset_char_table_parent): Doc fix. | 8 | * fns.c (Fset_char_table_parent): Doc fix. |
| 4 | 9 | ||
| 5 | 2003-11-23 Kim F. Storm <storm@cua.dk> | 10 | 2003-11-22 Kim F. Storm <storm@cua.dk> |
| 6 | 11 | ||
| 7 | * dispnew.c (buffer_posn_from_coords): Return actual row/column | 12 | * dispnew.c (buffer_posn_from_coords): Return actual row/column |
| 8 | for glyph clicked on, rather than (unused) pixel positions. | 13 | for glyph clicked on, rather than (unused) pixel positions. |
diff --git a/src/print.c b/src/print.c index 5f1506392c2..719fb8fd21a 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -911,6 +911,39 @@ to make it write to the debugging output. */) | |||
| 911 | return character; | 911 | return character; |
| 912 | } | 912 | } |
| 913 | 913 | ||
| 914 | FILE *initial_stderr_stream = NULL; | ||
| 915 | |||
| 916 | DEFUN ("redirect-debugging-output", Fredirect_debugging_output, Sredirect_debugging_output, | ||
| 917 | 1, 2, | ||
| 918 | "FDebug output file: \nP", | ||
| 919 | doc: /* Redirect debugging output (stderr stream) to file FILE. | ||
| 920 | If FILE is nil, reset target to the initial stderr stream. | ||
| 921 | Optional arg APPEND non-nil (interactively, with prefix arg) means | ||
| 922 | append to existing target file. */) | ||
| 923 | (file, append) | ||
| 924 | Lisp_Object file, append; | ||
| 925 | { | ||
| 926 | if (initial_stderr_stream != NULL) | ||
| 927 | fclose(stderr); | ||
| 928 | stderr = initial_stderr_stream; | ||
| 929 | initial_stderr_stream = NULL; | ||
| 930 | |||
| 931 | if (STRINGP (file)) | ||
| 932 | { | ||
| 933 | file = Fexpand_file_name (file, Qnil); | ||
| 934 | initial_stderr_stream = stderr; | ||
| 935 | stderr = fopen(SDATA (file), NILP (append) ? "w" : "a"); | ||
| 936 | if (stderr == NULL) | ||
| 937 | { | ||
| 938 | stderr = initial_stderr_stream; | ||
| 939 | initial_stderr_stream = NULL; | ||
| 940 | report_file_error ("Cannot open debugging output stream", | ||
| 941 | Fcons (file, Qnil)); | ||
| 942 | } | ||
| 943 | } | ||
| 944 | return Qnil; | ||
| 945 | } | ||
| 946 | |||
| 914 | /* This is the interface for debugging printing. */ | 947 | /* This is the interface for debugging printing. */ |
| 915 | 948 | ||
| 916 | void | 949 | void |
| @@ -2164,6 +2197,7 @@ that need to be recorded in the table. */); | |||
| 2164 | defsubr (&Sterpri); | 2197 | defsubr (&Sterpri); |
| 2165 | defsubr (&Swrite_char); | 2198 | defsubr (&Swrite_char); |
| 2166 | defsubr (&Sexternal_debugging_output); | 2199 | defsubr (&Sexternal_debugging_output); |
| 2200 | defsubr (&Sredirect_debugging_output); | ||
| 2167 | 2201 | ||
| 2168 | Qexternal_debugging_output = intern ("external-debugging-output"); | 2202 | Qexternal_debugging_output = intern ("external-debugging-output"); |
| 2169 | staticpro (&Qexternal_debugging_output); | 2203 | staticpro (&Qexternal_debugging_output); |