diff options
| author | Miles Bader | 2008-01-30 07:57:28 +0000 |
|---|---|---|
| committer | Miles Bader | 2008-01-30 07:57:28 +0000 |
| commit | d235ca2ff8fab139ce797757fcb159d1e28fa7e0 (patch) | |
| tree | 96c5cd1a06a0d9dc26e8470c6eabfc032c0046f3 /src/buffer.c | |
| parent | 3709a060f679dba14df71ae64a0035fa2b5b3106 (diff) | |
| parent | 02cbe062bee38a6705bafb1699d77e3c44cfafcf (diff) | |
| download | emacs-d235ca2ff8fab139ce797757fcb159d1e28fa7e0.tar.gz emacs-d235ca2ff8fab139ce797757fcb159d1e28fa7e0.zip | |
Merge from emacs--devo--0
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-324
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/src/buffer.c b/src/buffer.c index 5958c1f91be..c18e3ad8ddf 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -153,6 +153,7 @@ Lisp_Object Qucs_set_table_for_input; | |||
| 153 | int inhibit_modification_hooks; | 153 | int inhibit_modification_hooks; |
| 154 | 154 | ||
| 155 | Lisp_Object Qfundamental_mode, Qmode_class, Qpermanent_local; | 155 | Lisp_Object Qfundamental_mode, Qmode_class, Qpermanent_local; |
| 156 | Lisp_Object Qpermanent_local_hook; | ||
| 156 | 157 | ||
| 157 | Lisp_Object Qprotected_field; | 158 | Lisp_Object Qprotected_field; |
| 158 | 159 | ||
| @@ -762,13 +763,38 @@ reset_buffer_local_variables (b, permanent_too) | |||
| 762 | b->local_var_alist = Qnil; | 763 | b->local_var_alist = Qnil; |
| 763 | else | 764 | else |
| 764 | { | 765 | { |
| 765 | Lisp_Object tmp, last = Qnil; | 766 | Lisp_Object tmp, prop, last = Qnil; |
| 766 | for (tmp = b->local_var_alist; CONSP (tmp); tmp = XCDR (tmp)) | 767 | for (tmp = b->local_var_alist; CONSP (tmp); tmp = XCDR (tmp)) |
| 767 | if (CONSP (XCAR (tmp)) | 768 | if (CONSP (XCAR (tmp)) |
| 768 | && SYMBOLP (XCAR (XCAR (tmp))) | 769 | && SYMBOLP (XCAR (XCAR (tmp))) |
| 769 | && !NILP (Fget (XCAR (XCAR (tmp)), Qpermanent_local))) | 770 | && !NILP (prop = Fget (XCAR (XCAR (tmp)), Qpermanent_local))) |
| 770 | /* If permanent-local, keep it. */ | 771 | { |
| 771 | last = tmp; | 772 | /* If permanent-local, keep it. */ |
| 773 | last = tmp; | ||
| 774 | if (EQ (prop, Qpermanent_local_hook)) | ||
| 775 | { | ||
| 776 | /* This is a partially permanent hook variable. | ||
| 777 | Preserve only the elements that want to be preserved. */ | ||
| 778 | Lisp_Object list, newlist; | ||
| 779 | list = XCDR (XCAR (tmp)); | ||
| 780 | if (!CONSP (list)) | ||
| 781 | newlist = list; | ||
| 782 | else | ||
| 783 | for (newlist = Qnil; CONSP (list); list = XCDR (list)) | ||
| 784 | { | ||
| 785 | Lisp_Object elt = XCAR (list); | ||
| 786 | /* Preserve element ELT if it's t, | ||
| 787 | if it is a function with a `permanent-local-hook' property, | ||
| 788 | or if it's not a symbol. */ | ||
| 789 | if (! SYMBOLP (elt) | ||
| 790 | || EQ (elt, Qt) | ||
| 791 | || !NILP (Fget (elt, Qpermanent_local_hook))) | ||
| 792 | newlist = Fcons (elt, newlist); | ||
| 793 | } | ||
| 794 | XSETCDR (XCAR (tmp), Fnreverse (newlist)); | ||
| 795 | } | ||
| 796 | } | ||
| 797 | /* Delete this local variable. */ | ||
| 772 | else if (NILP (last)) | 798 | else if (NILP (last)) |
| 773 | b->local_var_alist = XCDR (tmp); | 799 | b->local_var_alist = XCDR (tmp); |
| 774 | else | 800 | else |
| @@ -5308,6 +5334,8 @@ syms_of_buffer () | |||
| 5308 | staticpro (&Vbuffer_alist); | 5334 | staticpro (&Vbuffer_alist); |
| 5309 | staticpro (&Qprotected_field); | 5335 | staticpro (&Qprotected_field); |
| 5310 | staticpro (&Qpermanent_local); | 5336 | staticpro (&Qpermanent_local); |
| 5337 | Qpermanent_local_hook = intern ("permanent-local-hook"); | ||
| 5338 | staticpro (&Qpermanent_local_hook); | ||
| 5311 | staticpro (&Qkill_buffer_hook); | 5339 | staticpro (&Qkill_buffer_hook); |
| 5312 | Qoverlayp = intern ("overlayp"); | 5340 | Qoverlayp = intern ("overlayp"); |
| 5313 | staticpro (&Qoverlayp); | 5341 | staticpro (&Qoverlayp); |
| @@ -5335,6 +5363,7 @@ syms_of_buffer () | |||
| 5335 | staticpro (&Qbefore_change_functions); | 5363 | staticpro (&Qbefore_change_functions); |
| 5336 | Qafter_change_functions = intern ("after-change-functions"); | 5364 | Qafter_change_functions = intern ("after-change-functions"); |
| 5337 | staticpro (&Qafter_change_functions); | 5365 | staticpro (&Qafter_change_functions); |
| 5366 | /* The next one is initialized in init_buffer_once. */ | ||
| 5338 | staticpro (&Qucs_set_table_for_input); | 5367 | staticpro (&Qucs_set_table_for_input); |
| 5339 | 5368 | ||
| 5340 | Qkill_buffer_query_functions = intern ("kill-buffer-query-functions"); | 5369 | Qkill_buffer_query_functions = intern ("kill-buffer-query-functions"); |
| @@ -5575,7 +5604,8 @@ its hooks should not expect certain variables such as | |||
| 5575 | 5604 | ||
| 5576 | DEFVAR_PER_BUFFER ("mode-name", ¤t_buffer->mode_name, | 5605 | DEFVAR_PER_BUFFER ("mode-name", ¤t_buffer->mode_name, |
| 5577 | Qnil, | 5606 | Qnil, |
| 5578 | doc: /* Pretty name of current buffer's major mode (a string). */); | 5607 | doc: /* Pretty name of current buffer's major mode. |
| 5608 | Usually a string. See `mode-line-format' for other possible forms. */); | ||
| 5579 | 5609 | ||
| 5580 | DEFVAR_PER_BUFFER ("local-abbrev-table", ¤t_buffer->abbrev_table, Qnil, | 5610 | DEFVAR_PER_BUFFER ("local-abbrev-table", ¤t_buffer->abbrev_table, Qnil, |
| 5581 | doc: /* Local (mode-specific) abbrev table of current buffer. */); | 5611 | doc: /* Local (mode-specific) abbrev table of current buffer. */); |