# HG changeset patch # User Richard M. Stallman # Date 768817762 0 # Node ID a1b7f72e0ea22d6380cf4ef3835151f763662a58 # Parent 5a10d0a7c8a1a5426737e5a6fc2451b6b4e3546c (save_excursion_restore): Don't run activate-mark-hook if mark position is unchanged. diff -r 5a10d0a7c8a1 -r a1b7f72e0ea2 src/editfns.c --- a/src/editfns.c Fri May 13 08:22:50 1994 +0000 +++ b/src/editfns.c Fri May 13 08:29:22 1994 +0000 @@ -295,7 +295,7 @@ save_excursion_restore (info) register Lisp_Object info; { - register Lisp_Object tem, tem1; + register Lisp_Object tem, tem1, omark, nmark; tem = Fmarker_buffer (Fcar (info)); /* If buffer being returned to is now deleted, avoid error */ @@ -309,7 +309,9 @@ Fgoto_char (tem); unchain_marker (tem); tem = Fcar (Fcdr (info)); + omark = Fmarker_position (current_buffer->mark); Fset_marker (current_buffer->mark, tem, Fcurrent_buffer ()); + nmark = Fmarker_position (tem); unchain_marker (tem); tem = Fcdr (Fcdr (info)); #if 0 /* We used to make the current buffer visible in the selected window @@ -326,8 +328,14 @@ current_buffer->mark_active = Fcdr (tem); if (!NILP (Vrun_hooks)) { + /* If mark is active now, and either was not active + or was at a different place, run the activate hook. */ if (! NILP (current_buffer->mark_active)) - call1 (Vrun_hooks, intern ("activate-mark-hook")); + { + if (! EQ (omark, nmark)) + call1 (Vrun_hooks, intern ("activate-mark-hook")); + } + /* If mark has ceased to be active, run deactivate hook. */ else if (! NILP (tem1)) call1 (Vrun_hooks, intern ("deactivate-mark-hook")); }