diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2003-05-05 18:13:08 +0000 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2003-05-05 18:13:08 +0000 |
commit | bd2356104120d8744b74743f4d05f91c7e37c50e (patch) | |
tree | 81aa08a89941566ff90b051bc4cc7db65085f76f /src/fileio.c | |
parent | edf505ce9a21d7f7a0ac6d2964c79355187e9eb3 (diff) | |
download | emacs-bd2356104120d8744b74743f4d05f91c7e37c50e.tar.gz |
(Qwrite_region_annotate_functions): New var.
(build_annotations): Use it to process the global part of the hook.
(syms_of_fileio): Init and staticpro it.
Diffstat (limited to 'src/fileio.c')
-rw-r--r-- | src/fileio.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/fileio.c b/src/fileio.c index 29367875ac4..71036912bbc 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -183,6 +183,7 @@ Lisp_Object Qafter_insert_file_set_coding; /* Functions to be called to create text property annotations for file. */ Lisp_Object Vwrite_region_annotate_functions; +Lisp_Object Qwrite_region_annotate_functions; /* During build_annotations, each time an annotation function is called, this holds the annotations made by the previous functions. */ @@ -5217,7 +5218,7 @@ build_annotations (start, end) Lisp_Object p, res; struct gcpro gcpro1, gcpro2; Lisp_Object original_buffer; - int i; + int i, used_global = 0; XSETBUFFER (original_buffer, current_buffer); @@ -5227,6 +5228,15 @@ build_annotations (start, end) while (CONSP (p)) { struct buffer *given_buffer = current_buffer; + if (EQ (Qt, XCAR (p)) && !used_global) + { /* Use the global value of the hook. */ + Lisp_Object arg[2]; + used_global = 1; + arg[0] = Fdefault_value (Qwrite_region_annotate_functions); + arg[1] = XCDR (p); + p = Fappend (2, arg); + continue; + } Vwrite_region_annotations_so_far = annotations; res = call2 (XCAR (p), start, end); /* If the function makes a different buffer current, @@ -6449,8 +6459,13 @@ inserted at the specified positions of the file being written (1 means to insert before the first byte written). The POSITIONs must be sorted into increasing order. If there are several functions in the list, the several lists are merged destructively. Alternatively, the function can return -with a different buffer current and value nil.*/); +with a different buffer current; in that case it should pay attention +to the annotations returned by previous functions and listed in +`write-region-annotations-so-far'.*/); Vwrite_region_annotate_functions = Qnil; + staticpro (&Qwrite_region_annotate_functions); + Qwrite_region_annotate_functions + = intern ("write-region-annotate-functions"); DEFVAR_LISP ("write-region-annotations-so-far", &Vwrite_region_annotations_so_far, |