Mercurial > emacs
comparison src/buffer.c @ 83271:1830bcd0eec0
Merged from miles@gnu.org--gnu-2005 (patch 39-44, 184-191)
Patches applied:
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-184
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-185
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-186
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-187
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-188
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-189
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-190
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-191
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-39
Merge from emacs--cvs-trunk--0
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-40
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-41
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-42
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-43
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-44
Merge from emacs--cvs-trunk--0
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-311
| author | Karoly Lorentey <lorentey@elte.hu> |
|---|---|
| date | Sat, 19 Mar 2005 17:55:13 +0000 |
| parents | 92c8be21e2c3 d2f6fa8790f3 |
| children | 9deb6323655c |
comparison
equal
deleted
inserted
replaced
| 83270:42406ecdf5bf | 83271:1830bcd0eec0 |
|---|---|
| 180 | 180 |
| 181 static void alloc_buffer_text P_ ((struct buffer *, size_t)); | 181 static void alloc_buffer_text P_ ((struct buffer *, size_t)); |
| 182 static void free_buffer_text P_ ((struct buffer *b)); | 182 static void free_buffer_text P_ ((struct buffer *b)); |
| 183 static struct Lisp_Overlay * copy_overlays P_ ((struct buffer *, struct Lisp_Overlay *)); | 183 static struct Lisp_Overlay * copy_overlays P_ ((struct buffer *, struct Lisp_Overlay *)); |
| 184 static void modify_overlay P_ ((struct buffer *, EMACS_INT, EMACS_INT)); | 184 static void modify_overlay P_ ((struct buffer *, EMACS_INT, EMACS_INT)); |
| 185 static Lisp_Object buffer_lisp_local_variables P_ ((struct buffer *)); | |
| 185 | 186 |
| 186 | 187 |
| 187 /* For debugging; temporary. See set_buffer_internal. */ | 188 /* For debugging; temporary. See set_buffer_internal. */ |
| 188 /* Lisp_Object Qlisp_mode, Vcheck_symbol; */ | 189 /* Lisp_Object Qlisp_mode, Vcheck_symbol; */ |
| 189 | 190 |
| 513 bcopy (from->local_flags, to->local_flags, sizeof to->local_flags); | 514 bcopy (from->local_flags, to->local_flags, sizeof to->local_flags); |
| 514 | 515 |
| 515 to->overlays_before = copy_overlays (to, from->overlays_before); | 516 to->overlays_before = copy_overlays (to, from->overlays_before); |
| 516 to->overlays_after = copy_overlays (to, from->overlays_after); | 517 to->overlays_after = copy_overlays (to, from->overlays_after); |
| 517 | 518 |
| 518 /* Copy the alist of local variables, | 519 /* Get (a copy of) the alist of Lisp-level local variables of FROM |
| 519 and all the alist elements too. */ | 520 and install that in TO. */ |
| 520 to->local_var_alist | 521 to->local_var_alist = buffer_lisp_local_variables (from); |
| 521 = Fcopy_sequence (from->local_var_alist); | 522 } |
| 522 for (tem = to->local_var_alist; CONSP (tem); | |
| 523 tem = XCDR (tem)) | |
| 524 XSETCAR (tem, Fcons (XCAR (XCAR (tem)), XCDR (XCAR (tem)))); | |
| 525 } | |
| 526 | |
| 527 | 523 |
| 528 DEFUN ("make-indirect-buffer", Fmake_indirect_buffer, Smake_indirect_buffer, | 524 DEFUN ("make-indirect-buffer", Fmake_indirect_buffer, Smake_indirect_buffer, |
| 529 2, 3, | 525 2, 3, |
| 530 "bMake indirect buffer (to buffer): \nBName of indirect buffer: ", | 526 "bMake indirect buffer (to buffer): \nBName of indirect buffer: ", |
| 531 doc: /* Create and return an indirect buffer for buffer BASE-BUFFER, named NAME. | 527 doc: /* Create and return an indirect buffer for buffer BASE-BUFFER, named NAME. |
| 932 return Fsignal (Qvoid_variable, Fcons (symbol, Qnil)); | 928 return Fsignal (Qvoid_variable, Fcons (symbol, Qnil)); |
| 933 | 929 |
| 934 return result; | 930 return result; |
| 935 } | 931 } |
| 936 | 932 |
| 933 /* Return an alist of the Lisp-level buffer-local bindings of | |
| 934 buffer BUF. That is, do't include the variables maintained | |
| 935 in special slots in the buffer object. */ | |
| 936 | |
| 937 static Lisp_Object | |
| 938 buffer_lisp_local_variables (buf) | |
| 939 struct buffer *buf; | |
| 940 { | |
| 941 Lisp_Object result = Qnil; | |
| 942 register Lisp_Object tail; | |
| 943 for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail)) | |
| 944 { | |
| 945 Lisp_Object val, elt; | |
| 946 | |
| 947 elt = XCAR (tail); | |
| 948 | |
| 949 /* Reference each variable in the alist in buf. | |
| 950 If inquiring about the current buffer, this gets the current values, | |
| 951 so store them into the alist so the alist is up to date. | |
| 952 If inquiring about some other buffer, this swaps out any values | |
| 953 for that buffer, making the alist up to date automatically. */ | |
| 954 val = find_symbol_value (XCAR (elt)); | |
| 955 /* Use the current buffer value only if buf is the current buffer. */ | |
| 956 if (buf != current_buffer) | |
| 957 val = XCDR (elt); | |
| 958 | |
| 959 /* If symbol is unbound, put just the symbol in the list. */ | |
| 960 if (EQ (val, Qunbound)) | |
| 961 result = Fcons (XCAR (elt), result); | |
| 962 /* Otherwise, put (symbol . value) in the list. */ | |
| 963 else | |
| 964 result = Fcons (Fcons (XCAR (elt), val), result); | |
| 965 } | |
| 966 | |
| 967 return result; | |
| 968 } | |
| 969 | |
| 937 DEFUN ("buffer-local-variables", Fbuffer_local_variables, | 970 DEFUN ("buffer-local-variables", Fbuffer_local_variables, |
| 938 Sbuffer_local_variables, 0, 1, 0, | 971 Sbuffer_local_variables, 0, 1, 0, |
| 939 doc: /* Return an alist of variables that are buffer-local in BUFFER. | 972 doc: /* Return an alist of variables that are buffer-local in BUFFER. |
| 940 Most elements look like (SYMBOL . VALUE), describing one variable. | 973 Most elements look like (SYMBOL . VALUE), describing one variable. |
| 941 For a symbol that is locally unbound, just the symbol appears in the value. | 974 For a symbol that is locally unbound, just the symbol appears in the value. |
| 953 { | 986 { |
| 954 CHECK_BUFFER (buffer); | 987 CHECK_BUFFER (buffer); |
| 955 buf = XBUFFER (buffer); | 988 buf = XBUFFER (buffer); |
| 956 } | 989 } |
| 957 | 990 |
| 958 result = Qnil; | 991 result = buffer_lisp_local_variables (buf); |
| 959 | |
| 960 { | |
| 961 register Lisp_Object tail; | |
| 962 for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail)) | |
| 963 { | |
| 964 Lisp_Object val, elt; | |
| 965 | |
| 966 elt = XCAR (tail); | |
| 967 | |
| 968 /* Reference each variable in the alist in buf. | |
| 969 If inquiring about the current buffer, this gets the current values, | |
| 970 so store them into the alist so the alist is up to date. | |
| 971 If inquiring about some other buffer, this swaps out any values | |
| 972 for that buffer, making the alist up to date automatically. */ | |
| 973 val = find_symbol_value (XCAR (elt)); | |
| 974 /* Use the current buffer value only if buf is the current buffer. */ | |
| 975 if (buf != current_buffer) | |
| 976 val = XCDR (elt); | |
| 977 | |
| 978 /* If symbol is unbound, put just the symbol in the list. */ | |
| 979 if (EQ (val, Qunbound)) | |
| 980 result = Fcons (XCAR (elt), result); | |
| 981 /* Otherwise, put (symbol . value) in the list. */ | |
| 982 else | |
| 983 result = Fcons (Fcons (XCAR (elt), val), result); | |
| 984 } | |
| 985 } | |
| 986 | 992 |
| 987 /* Add on all the variables stored in special slots. */ | 993 /* Add on all the variables stored in special slots. */ |
| 988 { | 994 { |
| 989 int offset, idx; | 995 int offset, idx; |
| 990 | 996 |
| 1002 } | 1008 } |
| 1003 } | 1009 } |
| 1004 | 1010 |
| 1005 return result; | 1011 return result; |
| 1006 } | 1012 } |
| 1007 | |
| 1008 | 1013 |
| 1009 DEFUN ("buffer-modified-p", Fbuffer_modified_p, Sbuffer_modified_p, | 1014 DEFUN ("buffer-modified-p", Fbuffer_modified_p, Sbuffer_modified_p, |
| 1010 0, 1, 0, | 1015 0, 1, 0, |
| 1011 doc: /* Return t if BUFFER was modified since its file was last read or saved. | 1016 doc: /* Return t if BUFFER was modified since its file was last read or saved. |
| 1012 No argument or nil as argument means use current buffer as BUFFER. */) | 1017 No argument or nil as argument means use current buffer as BUFFER. */) |
