diff options
| author | Richard M. Stallman | 2003-09-19 14:35:40 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2003-09-19 14:35:40 +0000 |
| commit | dd418e06cf79dc99d91a7209599b9d691011b1b1 (patch) | |
| tree | 9b96c4f59f59b22d8ef6bb26f118e9ab5b6c411e /src | |
| parent | 0a2546d42d895d4c5227165081ed718a53e66a58 (diff) | |
| download | emacs-dd418e06cf79dc99d91a7209599b9d691011b1b1.tar.gz emacs-dd418e06cf79dc99d91a7209599b9d691011b1b1.zip | |
(Fprin1_to_string): Move the PRINTPREPARE later,
so that PRINTFINISH won't unbind Qinhibit_modification_hooks.
Diffstat (limited to 'src')
| -rw-r--r-- | src/print.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/src/print.c b/src/print.c index bbb491dc584..5f1506392c2 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -758,33 +758,42 @@ A printed representation of an object is text which describes that object. */) | |||
| 758 | (object, noescape) | 758 | (object, noescape) |
| 759 | Lisp_Object object, noescape; | 759 | Lisp_Object object, noescape; |
| 760 | { | 760 | { |
| 761 | PRINTDECLARE; | ||
| 762 | Lisp_Object printcharfun; | 761 | Lisp_Object printcharfun; |
| 763 | /* struct gcpro gcpro1, gcpro2; */ | 762 | /* struct gcpro gcpro1, gcpro2; */ |
| 764 | Lisp_Object save_deactivate_mark; | 763 | Lisp_Object save_deactivate_mark; |
| 765 | int count = specpdl_ptr - specpdl; | 764 | int count = specpdl_ptr - specpdl; |
| 765 | struct buffer *previous; | ||
| 766 | 766 | ||
| 767 | specbind (Qinhibit_modification_hooks, Qt); | 767 | specbind (Qinhibit_modification_hooks, Qt); |
| 768 | 768 | ||
| 769 | /* Save and restore this--we are altering a buffer | 769 | { |
| 770 | but we don't want to deactivate the mark just for that. | 770 | PRINTDECLARE; |
| 771 | No need for specbind, since errors deactivate the mark. */ | 771 | |
| 772 | save_deactivate_mark = Vdeactivate_mark; | 772 | /* Save and restore this--we are altering a buffer |
| 773 | /* GCPRO2 (object, save_deactivate_mark); */ | 773 | but we don't want to deactivate the mark just for that. |
| 774 | abort_on_gc++; | 774 | No need for specbind, since errors deactivate the mark. */ |
| 775 | save_deactivate_mark = Vdeactivate_mark; | ||
| 776 | /* GCPRO2 (object, save_deactivate_mark); */ | ||
| 777 | abort_on_gc++; | ||
| 778 | |||
| 779 | printcharfun = Vprin1_to_string_buffer; | ||
| 780 | PRINTPREPARE; | ||
| 781 | print (object, printcharfun, NILP (noescape)); | ||
| 782 | /* Make Vprin1_to_string_buffer be the default buffer after PRINTFINSH */ | ||
| 783 | PRINTFINISH; | ||
| 784 | } | ||
| 775 | 785 | ||
| 776 | printcharfun = Vprin1_to_string_buffer; | 786 | previous = current_buffer; |
| 777 | PRINTPREPARE; | ||
| 778 | print (object, printcharfun, NILP (noescape)); | ||
| 779 | /* Make Vprin1_to_string_buffer be the default buffer after PRINTFINSH */ | ||
| 780 | PRINTFINISH; | ||
| 781 | set_buffer_internal (XBUFFER (Vprin1_to_string_buffer)); | 787 | set_buffer_internal (XBUFFER (Vprin1_to_string_buffer)); |
| 782 | object = Fbuffer_string (); | 788 | object = Fbuffer_string (); |
| 783 | if (SBYTES (object) == SCHARS (object)) | 789 | if (SBYTES (object) == SCHARS (object)) |
| 784 | STRING_SET_UNIBYTE (object); | 790 | STRING_SET_UNIBYTE (object); |
| 785 | 791 | ||
| 792 | /* Note that this won't make prepare_to_modify_buffer call | ||
| 793 | ask-user-about-supersession-threat because this buffer | ||
| 794 | does not visit a file. */ | ||
| 786 | Ferase_buffer (); | 795 | Ferase_buffer (); |
| 787 | set_buffer_internal (old); | 796 | set_buffer_internal (previous); |
| 788 | 797 | ||
| 789 | Vdeactivate_mark = save_deactivate_mark; | 798 | Vdeactivate_mark = save_deactivate_mark; |
| 790 | /* UNGCPRO; */ | 799 | /* UNGCPRO; */ |