diff options
| author | Gerd Moellmann | 2001-05-16 16:07:20 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-05-16 16:07:20 +0000 |
| commit | 460e6bae47b1b320de89c3048a27bee38556d6ab (patch) | |
| tree | f8e1d33a3a96a9e5f2a78661452e487f5ba4b923 /src | |
| parent | 99c78ce82daf26c50509225aecd4ef1945b04f95 (diff) | |
| download | emacs-460e6bae47b1b320de89c3048a27bee38556d6ab.tar.gz emacs-460e6bae47b1b320de89c3048a27bee38556d6ab.zip | |
(signal_before_change, signal_after_change): Consider a
local change hook which changes the buffer.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/insdel.c | 43 |
2 files changed, 40 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 8cb01fff9bc..f0fe97c97a6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,4 +1,7 @@ | |||
| 1 | 2001-05-14 Dave Love <fx@gnu.org> | 1 | 2001-05-16 Dave Love <fx@gnu.org> |
| 2 | |||
| 3 | * insdel.c (signal_before_change, signal_after_change): Consider a | ||
| 4 | local change hook which changes the buffer. | ||
| 2 | 5 | ||
| 3 | * process.c (read_process_output): Don't call signal_after_change | 6 | * process.c (read_process_output): Don't call signal_after_change |
| 4 | and update_compositions after insert_from_string_before_markers. | 7 | and update_compositions after insert_from_string_before_markers. |
diff --git a/src/insdel.c b/src/insdel.c index 7ea1181703b..99576218b4b 100644 --- a/src/insdel.c +++ b/src/insdel.c | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | /* Buffer insertion/deletion and gap motion for GNU Emacs. | 1 | /* Buffer insertion/deletion and gap motion for GNU Emacs. |
| 2 | Copyright (C) 1985, 86,93,94,95,97,98, 1999, 2000 Free Software Foundation, Inc. | 2 | Copyright (C) 1985, 86,93,94,95,97,98, 1999, 2000, 2001 |
| 3 | Free Software Foundation, Inc. | ||
| 3 | 4 | ||
| 4 | This file is part of GNU Emacs. | 5 | This file is part of GNU Emacs. |
| 5 | 6 | ||
| @@ -1901,6 +1902,8 @@ signal_before_change (start_int, end_int, preserve_ptr) | |||
| 1901 | Lisp_Object before_change_functions; | 1902 | Lisp_Object before_change_functions; |
| 1902 | Lisp_Object after_change_functions; | 1903 | Lisp_Object after_change_functions; |
| 1903 | struct gcpro gcpro1, gcpro2; | 1904 | struct gcpro gcpro1, gcpro2; |
| 1905 | struct buffer *old = current_buffer; | ||
| 1906 | struct buffer *new; | ||
| 1904 | 1907 | ||
| 1905 | PRESERVE_VALUE; | 1908 | PRESERVE_VALUE; |
| 1906 | PRESERVE_START_END; | 1909 | PRESERVE_START_END; |
| @@ -1920,9 +1923,21 @@ signal_before_change (start_int, end_int, preserve_ptr) | |||
| 1920 | args[2] = FETCH_END; | 1923 | args[2] = FETCH_END; |
| 1921 | run_hook_list_with_args (before_change_functions, 3, args); | 1924 | run_hook_list_with_args (before_change_functions, 3, args); |
| 1922 | 1925 | ||
| 1923 | /* "Unbind" the variables we "bound" to nil. */ | 1926 | /* "Unbind" the variables we "bound" to nil. Beware a |
| 1924 | Vbefore_change_functions = before_change_functions; | 1927 | buffer-local hook which changes the buffer when run (e.g. W3). */ |
| 1925 | Vafter_change_functions = after_change_functions; | 1928 | if (old != current_buffer) |
| 1929 | { | ||
| 1930 | new = current_buffer; | ||
| 1931 | set_buffer_internal (old); | ||
| 1932 | Vbefore_change_functions = before_change_functions; | ||
| 1933 | Vafter_change_functions = after_change_functions; | ||
| 1934 | set_buffer_internal (new); | ||
| 1935 | } | ||
| 1936 | else | ||
| 1937 | { | ||
| 1938 | Vbefore_change_functions = before_change_functions; | ||
| 1939 | Vafter_change_functions = after_change_functions; | ||
| 1940 | } | ||
| 1926 | UNGCPRO; | 1941 | UNGCPRO; |
| 1927 | } | 1942 | } |
| 1928 | 1943 | ||
| @@ -1988,6 +2003,8 @@ signal_after_change (charpos, lendel, lenins) | |||
| 1988 | Lisp_Object args[4]; | 2003 | Lisp_Object args[4]; |
| 1989 | Lisp_Object before_change_functions; | 2004 | Lisp_Object before_change_functions; |
| 1990 | Lisp_Object after_change_functions; | 2005 | Lisp_Object after_change_functions; |
| 2006 | struct buffer *old = current_buffer; | ||
| 2007 | struct buffer *new; | ||
| 1991 | struct gcpro gcpro1, gcpro2; | 2008 | struct gcpro gcpro1, gcpro2; |
| 1992 | 2009 | ||
| 1993 | /* "Bind" before-change-functions and after-change-functions | 2010 | /* "Bind" before-change-functions and after-change-functions |
| @@ -2007,9 +2024,21 @@ signal_after_change (charpos, lendel, lenins) | |||
| 2007 | run_hook_list_with_args (after_change_functions, | 2024 | run_hook_list_with_args (after_change_functions, |
| 2008 | 4, args); | 2025 | 4, args); |
| 2009 | 2026 | ||
| 2010 | /* "Unbind" the variables we "bound" to nil. */ | 2027 | /* "Unbind" the variables we "bound" to nil. Beware a |
| 2011 | Vbefore_change_functions = before_change_functions; | 2028 | buffer-local hook which changes the buffer when run (e.g. W3). */ |
| 2012 | Vafter_change_functions = after_change_functions; | 2029 | if (old != current_buffer) |
| 2030 | { | ||
| 2031 | new = current_buffer; | ||
| 2032 | set_buffer_internal (old); | ||
| 2033 | Vbefore_change_functions = before_change_functions; | ||
| 2034 | Vafter_change_functions = after_change_functions; | ||
| 2035 | set_buffer_internal (new); | ||
| 2036 | } | ||
| 2037 | else | ||
| 2038 | { | ||
| 2039 | Vbefore_change_functions = before_change_functions; | ||
| 2040 | Vafter_change_functions = after_change_functions; | ||
| 2041 | } | ||
| 2013 | UNGCPRO; | 2042 | UNGCPRO; |
| 2014 | } | 2043 | } |
| 2015 | 2044 | ||