Mercurial > emacs
comparison src/print.c @ 52538:ecd666ee0ea1
(Fprin1_to_string): Move the PRINTPREPARE later,
so that PRINTFINISH won't unbind Qinhibit_modification_hooks.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 19 Sep 2003 14:35:40 +0000 |
parents | 695cf19ef79e |
children | 1679881ea880 |
comparison
equal
deleted
inserted
replaced
52537:ab6a470dc45f | 52538:ecd666ee0ea1 |
---|---|
756 | 756 |
757 A printed representation of an object is text which describes that object. */) | 757 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 | 775 save_deactivate_mark = Vdeactivate_mark; |
776 printcharfun = Vprin1_to_string_buffer; | 776 /* GCPRO2 (object, save_deactivate_mark); */ |
777 PRINTPREPARE; | 777 abort_on_gc++; |
778 print (object, printcharfun, NILP (noescape)); | 778 |
779 /* Make Vprin1_to_string_buffer be the default buffer after PRINTFINSH */ | 779 printcharfun = Vprin1_to_string_buffer; |
780 PRINTFINISH; | 780 PRINTPREPARE; |
781 print (object, printcharfun, NILP (noescape)); | |
782 /* Make Vprin1_to_string_buffer be the default buffer after PRINTFINSH */ | |
783 PRINTFINISH; | |
784 } | |
785 | |
786 previous = current_buffer; | |
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; */ |
791 | 800 |
792 abort_on_gc--; | 801 abort_on_gc--; |