diff options
| author | Richard M. Stallman | 1996-11-02 00:00:20 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-11-02 00:00:20 +0000 |
| commit | 09eddb56985c3ebb9752d7333592273949c4ac21 (patch) | |
| tree | f2ca9d3196be64df6a53392f33ced3e2c4dfce83 /src | |
| parent | de40ed8931a4579d429ad47094116acd1a5b2217 (diff) | |
| download | emacs-09eddb56985c3ebb9752d7333592273949c4ac21.tar.gz emacs-09eddb56985c3ebb9752d7333592273949c4ac21.zip | |
(printchar, strout): Do QUIT for echo area output.
(PRINTFULLP): New macro.
(print): Exit if PRINTFULLP.
When printing a symbol, don't save a pointer to the name.
(PRINTFINISH): Null out print_buffer after freeing it.
Diffstat (limited to 'src')
| -rw-r--r-- | src/print.c | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/src/print.c b/src/print.c index bb4725a5ae7..518f0205761 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -200,7 +200,11 @@ glyph_to_str_cpy (glyphs, str) | |||
| 200 | #define PRINTFINISH \ | 200 | #define PRINTFINISH \ |
| 201 | if (NILP (printcharfun)) \ | 201 | if (NILP (printcharfun)) \ |
| 202 | insert (print_buffer, print_buffer_pos); \ | 202 | insert (print_buffer, print_buffer_pos); \ |
| 203 | if (print_buffer) free (print_buffer); \ | 203 | if (print_buffer) \ |
| 204 | { \ | ||
| 205 | free (print_buffer); \ | ||
| 206 | print_buffer = 0; \ | ||
| 207 | } \ | ||
| 204 | if (MARKERP (original)) \ | 208 | if (MARKERP (original)) \ |
| 205 | Fset_marker (original, make_number (PT), Qnil); \ | 209 | Fset_marker (original, make_number (PT), Qnil); \ |
| 206 | if (old_point >= 0) \ | 210 | if (old_point >= 0) \ |
| @@ -212,7 +216,14 @@ glyph_to_str_cpy (glyphs, str) | |||
| 212 | 216 | ||
| 213 | #define PRINTCHAR(ch) printchar (ch, printcharfun) | 217 | #define PRINTCHAR(ch) printchar (ch, printcharfun) |
| 214 | 218 | ||
| 215 | /* Index of first unused element of FRAME_MESSAGE_BUF(mini_frame). */ | 219 | /* Nonzero if there is no room to print any more characters |
| 220 | so print might as well return right away. */ | ||
| 221 | |||
| 222 | #define PRINTFULLP() \ | ||
| 223 | (EQ (printcharfun, Qt) && !noninteractive \ | ||
| 224 | && printbufidx >= FRAME_WIDTH (XFRAME (WINDOW_FRAME (XWINDOW (minibuf_window))))) | ||
| 225 | |||
| 226 | /* Index of first unused element of FRAME_MESSAGE_BUF (mini_frame). */ | ||
| 216 | static int printbufidx; | 227 | static int printbufidx; |
| 217 | 228 | ||
| 218 | static void | 229 | static void |
| @@ -242,6 +253,8 @@ printchar (ch, fun) | |||
| 242 | FRAME_PTR mini_frame | 253 | FRAME_PTR mini_frame |
| 243 | = XFRAME (WINDOW_FRAME (XWINDOW (minibuf_window))); | 254 | = XFRAME (WINDOW_FRAME (XWINDOW (minibuf_window))); |
| 244 | 255 | ||
| 256 | QUIT; | ||
| 257 | |||
| 245 | if (noninteractive) | 258 | if (noninteractive) |
| 246 | { | 259 | { |
| 247 | putchar (ch); | 260 | putchar (ch); |
| @@ -306,6 +319,8 @@ strout (ptr, size, printcharfun) | |||
| 306 | FRAME_PTR mini_frame | 319 | FRAME_PTR mini_frame |
| 307 | = XFRAME (WINDOW_FRAME (XWINDOW (minibuf_window))); | 320 | = XFRAME (WINDOW_FRAME (XWINDOW (minibuf_window))); |
| 308 | 321 | ||
| 322 | QUIT; | ||
| 323 | |||
| 309 | i = size >= 0 ? size : strlen (ptr); | 324 | i = size >= 0 ? size : strlen (ptr); |
| 310 | #ifdef MAX_PRINT_CHARS | 325 | #ifdef MAX_PRINT_CHARS |
| 311 | if (max_print) | 326 | if (max_print) |
| @@ -841,6 +856,8 @@ print (obj, printcharfun, escapeflag) | |||
| 841 | char buf[30]; | 856 | char buf[30]; |
| 842 | 857 | ||
| 843 | QUIT; | 858 | QUIT; |
| 859 | if (PRINTFULLP ()) | ||
| 860 | return; | ||
| 844 | 861 | ||
| 845 | #if 1 /* I'm not sure this is really worth doing. */ | 862 | #if 1 /* I'm not sure this is really worth doing. */ |
| 846 | /* Detect circularities and truncate them. | 863 | /* Detect circularities and truncate them. |
| @@ -956,6 +973,7 @@ print (obj, printcharfun, escapeflag) | |||
| 956 | register unsigned char *p = XSYMBOL (obj)->name->data; | 973 | register unsigned char *p = XSYMBOL (obj)->name->data; |
| 957 | register unsigned char *end = p + XSYMBOL (obj)->name->size; | 974 | register unsigned char *end = p + XSYMBOL (obj)->name->size; |
| 958 | register unsigned char c; | 975 | register unsigned char c; |
| 976 | int i; | ||
| 959 | 977 | ||
| 960 | if (p != end && (*p == '-' || *p == '+')) p++; | 978 | if (p != end && (*p == '-' || *p == '+')) p++; |
| 961 | if (p == end) | 979 | if (p == end) |
| @@ -1000,16 +1018,18 @@ print (obj, printcharfun, escapeflag) | |||
| 1000 | PRINTCHAR (':'); | 1018 | PRINTCHAR (':'); |
| 1001 | } | 1019 | } |
| 1002 | 1020 | ||
| 1003 | p = XSYMBOL (obj)->name->data; | 1021 | for (i = 0; i < XSYMBOL (obj)->name->size; i++) |
| 1004 | while (p != end) | ||
| 1005 | { | 1022 | { |
| 1006 | QUIT; | 1023 | QUIT; |
| 1007 | c = *p++; | 1024 | c = XSYMBOL (obj)->name->data[i]; |
| 1025 | |||
| 1008 | if (escapeflag) | 1026 | if (escapeflag) |
| 1009 | { | 1027 | { |
| 1010 | if (c == '\"' || c == '\\' || c == '\'' || c == ';' || c == '#' || | 1028 | if (c == '\"' || c == '\\' || c == '\'' |
| 1011 | c == '(' || c == ')' || c == ',' || c =='.' || c == '`' || | 1029 | || c == ';' || c == '#' || c == '(' || c == ')' |
| 1012 | c == '[' || c == ']' || c == '?' || c <= 040 || confusing) | 1030 | || c == ',' || c =='.' || c == '`' |
| 1031 | || c == '[' || c == ']' || c == '?' || c <= 040 | ||
| 1032 | || confusing) | ||
| 1013 | PRINTCHAR ('\\'), confusing = 0; | 1033 | PRINTCHAR ('\\'), confusing = 0; |
| 1014 | } | 1034 | } |
| 1015 | PRINTCHAR (c); | 1035 | PRINTCHAR (c); |