diff options
| author | Stefan Monnier | 2003-05-05 18:13:08 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2003-05-05 18:13:08 +0000 |
| commit | bd2356104120d8744b74743f4d05f91c7e37c50e (patch) | |
| tree | 81aa08a89941566ff90b051bc4cc7db65085f76f /src | |
| parent | edf505ce9a21d7f7a0ac6d2964c79355187e9eb3 (diff) | |
| download | emacs-bd2356104120d8744b74743f4d05f91c7e37c50e.tar.gz emacs-bd2356104120d8744b74743f4d05f91c7e37c50e.zip | |
(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')
| -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; | |||
| 183 | 183 | ||
| 184 | /* Functions to be called to create text property annotations for file. */ | 184 | /* Functions to be called to create text property annotations for file. */ |
| 185 | Lisp_Object Vwrite_region_annotate_functions; | 185 | Lisp_Object Vwrite_region_annotate_functions; |
| 186 | Lisp_Object Qwrite_region_annotate_functions; | ||
| 186 | 187 | ||
| 187 | /* During build_annotations, each time an annotation function is called, | 188 | /* During build_annotations, each time an annotation function is called, |
| 188 | this holds the annotations made by the previous functions. */ | 189 | this holds the annotations made by the previous functions. */ |
| @@ -5217,7 +5218,7 @@ build_annotations (start, end) | |||
| 5217 | Lisp_Object p, res; | 5218 | Lisp_Object p, res; |
| 5218 | struct gcpro gcpro1, gcpro2; | 5219 | struct gcpro gcpro1, gcpro2; |
| 5219 | Lisp_Object original_buffer; | 5220 | Lisp_Object original_buffer; |
| 5220 | int i; | 5221 | int i, used_global = 0; |
| 5221 | 5222 | ||
| 5222 | XSETBUFFER (original_buffer, current_buffer); | 5223 | XSETBUFFER (original_buffer, current_buffer); |
| 5223 | 5224 | ||
| @@ -5227,6 +5228,15 @@ build_annotations (start, end) | |||
| 5227 | while (CONSP (p)) | 5228 | while (CONSP (p)) |
| 5228 | { | 5229 | { |
| 5229 | struct buffer *given_buffer = current_buffer; | 5230 | struct buffer *given_buffer = current_buffer; |
| 5231 | if (EQ (Qt, XCAR (p)) && !used_global) | ||
| 5232 | { /* Use the global value of the hook. */ | ||
| 5233 | Lisp_Object arg[2]; | ||
| 5234 | used_global = 1; | ||
| 5235 | arg[0] = Fdefault_value (Qwrite_region_annotate_functions); | ||
| 5236 | arg[1] = XCDR (p); | ||
| 5237 | p = Fappend (2, arg); | ||
| 5238 | continue; | ||
| 5239 | } | ||
| 5230 | Vwrite_region_annotations_so_far = annotations; | 5240 | Vwrite_region_annotations_so_far = annotations; |
| 5231 | res = call2 (XCAR (p), start, end); | 5241 | res = call2 (XCAR (p), start, end); |
| 5232 | /* If the function makes a different buffer current, | 5242 | /* 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 | |||
| 6449 | insert before the first byte written). The POSITIONs must be sorted into | 6459 | insert before the first byte written). The POSITIONs must be sorted into |
| 6450 | increasing order. If there are several functions in the list, the several | 6460 | increasing order. If there are several functions in the list, the several |
| 6451 | lists are merged destructively. Alternatively, the function can return | 6461 | lists are merged destructively. Alternatively, the function can return |
| 6452 | with a different buffer current and value nil.*/); | 6462 | with a different buffer current; in that case it should pay attention |
| 6463 | to the annotations returned by previous functions and listed in | ||
| 6464 | `write-region-annotations-so-far'.*/); | ||
| 6453 | Vwrite_region_annotate_functions = Qnil; | 6465 | Vwrite_region_annotate_functions = Qnil; |
| 6466 | staticpro (&Qwrite_region_annotate_functions); | ||
| 6467 | Qwrite_region_annotate_functions | ||
| 6468 | = intern ("write-region-annotate-functions"); | ||
| 6454 | 6469 | ||
| 6455 | DEFVAR_LISP ("write-region-annotations-so-far", | 6470 | DEFVAR_LISP ("write-region-annotations-so-far", |
| 6456 | &Vwrite_region_annotations_so_far, | 6471 | &Vwrite_region_annotations_so_far, |