Mercurial > emacs
comparison src/editfns.c @ 7485:a1b7f72e0ea2
(save_excursion_restore): Don't run activate-mark-hook
if mark position is unchanged.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 13 May 1994 08:29:22 +0000 |
parents | cd81dba38a49 |
children | 9fa47d36798a |
comparison
equal
deleted
inserted
replaced
7484:5a10d0a7c8a1 | 7485:a1b7f72e0ea2 |
---|---|
293 | 293 |
294 Lisp_Object | 294 Lisp_Object |
295 save_excursion_restore (info) | 295 save_excursion_restore (info) |
296 register Lisp_Object info; | 296 register Lisp_Object info; |
297 { | 297 { |
298 register Lisp_Object tem, tem1; | 298 register Lisp_Object tem, tem1, omark, nmark; |
299 | 299 |
300 tem = Fmarker_buffer (Fcar (info)); | 300 tem = Fmarker_buffer (Fcar (info)); |
301 /* If buffer being returned to is now deleted, avoid error */ | 301 /* If buffer being returned to is now deleted, avoid error */ |
302 /* Otherwise could get error here while unwinding to top level | 302 /* Otherwise could get error here while unwinding to top level |
303 and crash */ | 303 and crash */ |
307 Fset_buffer (tem); | 307 Fset_buffer (tem); |
308 tem = Fcar (info); | 308 tem = Fcar (info); |
309 Fgoto_char (tem); | 309 Fgoto_char (tem); |
310 unchain_marker (tem); | 310 unchain_marker (tem); |
311 tem = Fcar (Fcdr (info)); | 311 tem = Fcar (Fcdr (info)); |
312 omark = Fmarker_position (current_buffer->mark); | |
312 Fset_marker (current_buffer->mark, tem, Fcurrent_buffer ()); | 313 Fset_marker (current_buffer->mark, tem, Fcurrent_buffer ()); |
314 nmark = Fmarker_position (tem); | |
313 unchain_marker (tem); | 315 unchain_marker (tem); |
314 tem = Fcdr (Fcdr (info)); | 316 tem = Fcdr (Fcdr (info)); |
315 #if 0 /* We used to make the current buffer visible in the selected window | 317 #if 0 /* We used to make the current buffer visible in the selected window |
316 if that was true previously. That avoids some anomalies. | 318 if that was true previously. That avoids some anomalies. |
317 But it creates others, and it wasn't documented, and it is simpler | 319 But it creates others, and it wasn't documented, and it is simpler |
324 | 326 |
325 tem1 = current_buffer->mark_active; | 327 tem1 = current_buffer->mark_active; |
326 current_buffer->mark_active = Fcdr (tem); | 328 current_buffer->mark_active = Fcdr (tem); |
327 if (!NILP (Vrun_hooks)) | 329 if (!NILP (Vrun_hooks)) |
328 { | 330 { |
331 /* If mark is active now, and either was not active | |
332 or was at a different place, run the activate hook. */ | |
329 if (! NILP (current_buffer->mark_active)) | 333 if (! NILP (current_buffer->mark_active)) |
330 call1 (Vrun_hooks, intern ("activate-mark-hook")); | 334 { |
335 if (! EQ (omark, nmark)) | |
336 call1 (Vrun_hooks, intern ("activate-mark-hook")); | |
337 } | |
338 /* If mark has ceased to be active, run deactivate hook. */ | |
331 else if (! NILP (tem1)) | 339 else if (! NILP (tem1)) |
332 call1 (Vrun_hooks, intern ("deactivate-mark-hook")); | 340 call1 (Vrun_hooks, intern ("deactivate-mark-hook")); |
333 } | 341 } |
334 return Qnil; | 342 return Qnil; |
335 } | 343 } |