aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/print.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/print.c b/src/print.c
index 933544467ca..6ac2b25745d 100644
--- a/src/print.c
+++ b/src/print.c
@@ -727,6 +727,15 @@ DEFUN ("error-message-string", Ferror_message_string, Serror_message_string,
727 Lisp_Object original, printcharfun, value; 727 Lisp_Object original, printcharfun, value;
728 struct gcpro gcpro1; 728 struct gcpro gcpro1;
729 729
730 /* If OBJ is (error STRING), just return STRING.
731 That is not only faster, it also avoids the need to allocate
732 space here when the error is due to memory full. */
733 if (CONSP (obj) && EQ (XCONS (obj)->car, Qerror)
734 && CONSP (XCONS (obj)->cdr)
735 && STRINGP (XCONS (XCONS (obj)->cdr)->car)
736 && NILP (XCONS (XCONS (obj)->cdr)->cdr))
737 return XCONS (XCONS (obj)->cdr)->car;
738
730 print_error_message (obj, Vprin1_to_string_buffer, NULL); 739 print_error_message (obj, Vprin1_to_string_buffer, NULL);
731 740
732 set_buffer_internal (XBUFFER (Vprin1_to_string_buffer)); 741 set_buffer_internal (XBUFFER (Vprin1_to_string_buffer));