Commit cdaa87fd authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(PRINTPREPARE): Handle marker that points nowhere.

parent 7cf2444d
...@@ -141,26 +141,30 @@ glyph_to_str_cpy (glyphs, str) ...@@ -141,26 +141,30 @@ glyph_to_str_cpy (glyphs, str)
Lisp_Object original; Lisp_Object original;
*/ */
#define PRINTPREPARE \ #define PRINTPREPARE \
original = printcharfun; \ original = printcharfun; \
if (NILP (printcharfun)) printcharfun = Qt; \ if (NILP (printcharfun)) printcharfun = Qt; \
if (XTYPE (printcharfun) == Lisp_Buffer) \ if (XTYPE (printcharfun) == Lisp_Buffer) \
{ if (XBUFFER (printcharfun) != current_buffer) Fset_buffer (printcharfun); \ { if (XBUFFER (printcharfun) != current_buffer) \
printcharfun = Qnil;}\ Fset_buffer (printcharfun); \
if (XTYPE (printcharfun) == Lisp_Marker) \ printcharfun = Qnil;} \
{ if (XMARKER (original)->buffer != current_buffer) \ if (XTYPE (printcharfun) == Lisp_Marker) \
set_buffer_internal (XMARKER (original)->buffer); \ { if (!(XMARKER (original)->buffer)) \
old_point = point; \ error ("Marker does not point anywhere"); \
SET_PT (marker_position (printcharfun)); \ if (XMARKER (original)->buffer != current_buffer) \
start_point = point; \ set_buffer_internal (XMARKER (original)->buffer); \
old_point = point; \
SET_PT (marker_position (printcharfun)); \
start_point = point; \
printcharfun = Qnil;} printcharfun = Qnil;}
#define PRINTFINISH \ #define PRINTFINISH \
if (XTYPE (original) == Lisp_Marker) \ if (XTYPE (original) == Lisp_Marker) \
Fset_marker (original, make_number (point), Qnil); \ Fset_marker (original, make_number (point), Qnil); \
if (old_point >= 0) \ if (old_point >= 0) \
SET_PT ((old_point >= start_point ? point - start_point : 0) + old_point); \ SET_PT (old_point + (old_point >= start_point \
if (old != current_buffer) \ ? point - start_point : 0)); \
if (old != current_buffer) \
set_buffer_internal (old) set_buffer_internal (old)
#define PRINTCHAR(ch) printchar (ch, printcharfun) #define PRINTCHAR(ch) printchar (ch, printcharfun)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment