comparison src/buffer.c @ 444:576fb035e263 r21-2-37

Import from CVS: tag r21-2-37
author cvs
date Mon, 13 Aug 2007 11:36:19 +0200
parents abe6d1db359e
children 1ccc32a20af4
comparison
equal deleted inserted replaced
443:a8296e22da4e 444:576fb035e263
400 } 400 }
401 401
402 #endif /* FSFmacs */ 402 #endif /* FSFmacs */
403 403
404 DEFUN ("get-buffer", Fget_buffer, 1, 1, 0, /* 404 DEFUN ("get-buffer", Fget_buffer, 1, 1, 0, /*
405 Return the buffer named NAME (a string). 405 Return the buffer named BUFFER-NAME (a string), or nil if there is none.
406 If there is no live buffer named NAME, return nil. 406 BUFFER-NAME may also be a buffer; if so, the value is that buffer.
407 NAME may also be a buffer; if so, the value is that buffer. 407 */
408 */ 408 (buffer_name))
409 (name))
410 { 409 {
411 #ifdef I18N3 410 #ifdef I18N3
412 /* #### Doc string should indicate that the buffer name will get 411 /* #### Doc string should indicate that the buffer name will get
413 translated. */ 412 translated. */
414 #endif 413 #endif
415 414
416 /* #### This might return a dead buffer. This is gross. This is 415 /* #### This might return a dead buffer. This is gross. This is
417 called FSF compatibility. */ 416 called FSF compatibility. */
418 if (BUFFERP (name)) 417 if (BUFFERP (buffer_name))
419 return name; 418 return buffer_name;
420 return get_buffer (name, 0); 419 return get_buffer (buffer_name, 0);
421 /* FSFmacs 19.29 calls assoc_ignore_text_properties() here. 420 /* FSFmacs 19.29 calls assoc_ignore_text_properties() here.
422 Bleagh!! */ 421 Bleagh!! */
423 } 422 }
424 423
425 424
631 return finish_init_buffer (b, name); 630 return finish_init_buffer (b, name);
632 } 631 }
633 632
634 DEFUN ("make-indirect-buffer", Fmake_indirect_buffer, 2, 2, 633 DEFUN ("make-indirect-buffer", Fmake_indirect_buffer, 2, 2,
635 "bMake indirect buffer (to buffer): \nBName of indirect buffer: ", /* 634 "bMake indirect buffer (to buffer): \nBName of indirect buffer: ", /*
636 Create and return an indirect buffer for buffer BASE, named NAME. 635 Create and return an indirect buffer for buffer BASE-BUFFER, named NAME.
637 BASE should be an existing buffer (or buffer name). 636 BASE-BUFFER should be an existing buffer (or buffer name).
638 NAME should be a string which is not the name of an existing buffer. 637 NAME should be a string which is not the name of an existing buffer.
639 If BASE is an indirect buffer itself, the base buffer for that buffer 638
639 If BASE-BUFFER is itself an indirect buffer, the base buffer for that buffer
640 is made the base buffer for the newly created buffer. (Thus, there will 640 is made the base buffer for the newly created buffer. (Thus, there will
641 never be indirect buffers whose base buffers are themselves indirect.) 641 never be indirect buffers whose base buffers are themselves indirect.)
642 */ 642 */
643 (base_buffer, name)) 643 (base_buffer, name))
644 { 644 {
922 /* This is often called when the buffer contents are altered but we 922 /* This is often called when the buffer contents are altered but we
923 don't want to treat the changes that way (e.g. selective 923 don't want to treat the changes that way (e.g. selective
924 display). We still need to make sure redisplay realizes that the 924 display). We still need to make sure redisplay realizes that the
925 contents have potentially altered and it needs to do some 925 contents have potentially altered and it needs to do some
926 work. */ 926 work. */
927 buf = decode_buffer(buffer, 0); 927 buf = decode_buffer (buffer, 0);
928 BUF_MODIFF (buf)++; 928 BUF_MODIFF (buf)++;
929 BUF_SAVE_MODIFF (buf) = NILP (flag) ? BUF_MODIFF (buf) : 0; 929 BUF_SAVE_MODIFF (buf) = NILP (flag) ? BUF_MODIFF (buf) : 0;
930 MARK_MODELINE_CHANGED; 930 MARK_MODELINE_CHANGED;
931 931
932 return flag; 932 return flag;
1076 return notsogood; 1076 return notsogood;
1077 return Fget_buffer_create (QSscratch); 1077 return Fget_buffer_create (QSscratch);
1078 } 1078 }
1079 1079
1080 DEFUN ("buffer-disable-undo", Fbuffer_disable_undo, 0, 1, "", /* 1080 DEFUN ("buffer-disable-undo", Fbuffer_disable_undo, 0, 1, "", /*
1081 Make BUFFER stop keeping undo information. 1081 Stop keeping undo information for BUFFER.
1082 Any undo records it already has are discarded. 1082 Any undo records it already has are discarded.
1083 No argument or nil as argument means do this for the current buffer. 1083 No argument or nil as argument means do this for the current buffer.
1084 */ 1084 */
1085 (buffer)) 1085 (buffer))
1086 { 1086 {
1089 real_buf->undo_list = Qt; 1089 real_buf->undo_list = Qt;
1090 return Qnil; 1090 return Qnil;
1091 } 1091 }
1092 1092
1093 DEFUN ("buffer-enable-undo", Fbuffer_enable_undo, 0, 1, "", /* 1093 DEFUN ("buffer-enable-undo", Fbuffer_enable_undo, 0, 1, "", /*
1094 Start keeping undo information for buffer BUFFER. 1094 Start keeping undo information for BUFFER.
1095 No argument or nil as argument means do this for the current buffer. 1095 No argument or nil as argument means do this for the current buffer.
1096 */ 1096 */
1097 (buffer)) 1097 (buffer))
1098 { 1098 {
1099 /* Allowing nil is an RMSism */ 1099 /* Allowing nil is an RMSism */
1278 delete_from_buffer_alist (buf); 1278 delete_from_buffer_alist (buf);
1279 1279
1280 /* #### This is a problem if this buffer is in a dedicated window. 1280 /* #### This is a problem if this buffer is in a dedicated window.
1281 Need to undedicate any windows of this buffer first (and delete them?) 1281 Need to undedicate any windows of this buffer first (and delete them?)
1282 */ 1282 */
1283 Freplace_buffer_in_windows (buf); 1283 Freplace_buffer_in_windows (buf, Qnil, Qnil);
1284 1284
1285 font_lock_buffer_was_killed (b); 1285 font_lock_buffer_was_killed (b);
1286 1286
1287 /* Delete any auto-save file, if we saved it in this session. */ 1287 /* Delete any auto-save file, if we saved it in this session. */
1288 if (STRINGP (b->auto_save_file_name) 1288 if (STRINGP (b->auto_save_file_name)
1522 return buffer; 1522 return buffer;
1523 } 1523 }
1524 1524
1525 1525
1526 DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only, 0, 3, 0, /* 1526 DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only, 0, 3, 0, /*
1527 Signal a `buffer-read-only' error if the buffer is read-only. 1527 Signal a `buffer-read-only' error if BUFFER is read-only.
1528 Optional argument BUFFER defaults to the current buffer. 1528 Optional argument BUFFER defaults to the current buffer.
1529 1529
1530 If optional argument START is non-nil, all extents in the buffer 1530 If optional argument START is non-nil, all extents in the buffer
1531 which overlap that part of the buffer are checked to ensure none has a 1531 which overlap that part of the buffer are checked to ensure none has a
1532 `read-only' property. (Extents that lie completely within the range, 1532 `read-only' property. (Extents that lie completely within the range,
1966 unbind_to (count, Qnil); 1966 unbind_to (count, Qnil);
1967 1967
1968 if (sink_type != DFC_TYPE_LISP_LSTREAM) 1968 if (sink_type != DFC_TYPE_LISP_LSTREAM)
1969 { 1969 {
1970 sink->data.len = Dynarr_length (conversion_out_dynarr); 1970 sink->data.len = Dynarr_length (conversion_out_dynarr);
1971 Dynarr_add (conversion_out_dynarr, 0); 1971 Dynarr_add (conversion_out_dynarr, '\0'); /* NUL-terminate! */
1972 sink->data.ptr = Dynarr_atp (conversion_out_dynarr, 0); 1972 sink->data.ptr = Dynarr_atp (conversion_out_dynarr, 0);
1973 } 1973 }
1974 } 1974 }
1975 1975
1976 void 1976 void
2015 Bytecount len = source->data.len; 2015 Bytecount len = source->data.len;
2016 const Bufbyte *end = ptr + len; 2016 const Bufbyte *end = ptr + len;
2017 2017
2018 for (; ptr < end; ptr++) 2018 for (; ptr < end; ptr++)
2019 { 2019 {
2020 Extbyte c = *ptr; 2020 Bufbyte c = *ptr;
2021 2021
2022 if (BYTE_ASCII_P (c)) 2022 if (BYTE_ASCII_P (c))
2023 Dynarr_add (conversion_in_dynarr, c); 2023 Dynarr_add (conversion_in_dynarr, c);
2024 else if (BYTE_C1_P (c)) 2024 else if (BYTE_C1_P (c))
2025 { 2025 {
2104 unbind_to (count, Qnil); 2104 unbind_to (count, Qnil);
2105 2105
2106 if (sink_type != DFC_TYPE_LISP_LSTREAM) 2106 if (sink_type != DFC_TYPE_LISP_LSTREAM)
2107 { 2107 {
2108 sink->data.len = Dynarr_length (conversion_in_dynarr); 2108 sink->data.len = Dynarr_length (conversion_in_dynarr);
2109 Dynarr_add (conversion_in_dynarr, 0); /* remember to zero-terminate! */ 2109 Dynarr_add (conversion_in_dynarr, '\0'); /* NUL-terminate! */
2110 sink->data.ptr = Dynarr_atp (conversion_in_dynarr, 0); 2110 sink->data.ptr = Dynarr_atp (conversion_in_dynarr, 0);
2111 } 2111 }
2112 } 2112 }
2113 2113
2114 2114
2214 the read-only state of the buffer. See also `kill-all-local-variables'. 2214 the read-only state of the buffer. See also `kill-all-local-variables'.
2215 */ ); 2215 */ );
2216 Vchange_major_mode_hook = Qnil; 2216 Vchange_major_mode_hook = Qnil;
2217 2217
2218 DEFVAR_BOOL ("find-file-compare-truenames", &find_file_compare_truenames /* 2218 DEFVAR_BOOL ("find-file-compare-truenames", &find_file_compare_truenames /*
2219 If this is true, then the find-file command will check the truenames 2219 If this is true, then the `find-file' command will check the truenames
2220 of all visited files when deciding whether a given file is already in 2220 of all visited files when deciding whether a given file is already in
2221 a buffer, instead of just the buffer-file-name. This means that if you 2221 a buffer, instead of just `buffer-file-name'. This means that if you
2222 attempt to visit another file which is a symbolic-link to a file which is 2222 attempt to visit another file which is a symbolic link to a file which
2223 already in a buffer, the existing buffer will be found instead of a newly- 2223 is already in a buffer, the existing buffer will be found instead of a
2224 created one. This works if any component of the pathname (including a non- 2224 newly-created one. This works if any component of the pathname
2225 terminal component) is a symbolic link as well, but doesn't work with hard 2225 (including a non-terminal component) is a symbolic link as well, but
2226 links (nothing does). 2226 doesn't work with hard links (nothing does).
2227 2227
2228 See also the variable find-file-use-truenames. 2228 See also the variable `find-file-use-truenames'.
2229 */ ); 2229 */ );
2230 find_file_compare_truenames = 0; 2230 find_file_compare_truenames = 0;
2231 2231
2232 DEFVAR_BOOL ("find-file-use-truenames", &find_file_use_truenames /* 2232 DEFVAR_BOOL ("find-file-use-truenames", &find_file_use_truenames /*
2233 If this is true, then a buffer's visited file-name will always be 2233 If this is true, then a buffer's visited file-name will always be
2234 chased back to the real file; it will never be a symbolic link, and there 2234 chased back to the real file; it will never be a symbolic link, and there
2235 will never be a symbolic link anywhere in its directory path. 2235 will never be a symbolic link anywhere in its directory path.
2236 That is, the buffer-file-name and buffer-file-truename will be equal. 2236 That is, the buffer-file-name and buffer-file-truename will be equal.
2237 This doesn't work with hard links. 2237 This doesn't work with hard links.
2238 2238
2239 See also the variable find-file-compare-truenames. 2239 See also the variable `find-file-compare-truenames'.
2240 */ ); 2240 */ );
2241 find_file_use_truenames = 0; 2241 find_file_use_truenames = 0;
2242 2242
2243 DEFVAR_LISP ("before-change-functions", &Vbefore_change_functions /* 2243 DEFVAR_LISP ("before-change-functions", &Vbefore_change_functions /*
2244 List of functions to call before each text change. 2244 List of functions to call before each text change.
2918 2918
2919 DEFVAR_BUFFER_LOCAL ("buffer-undo-list", undo_list /* 2919 DEFVAR_BUFFER_LOCAL ("buffer-undo-list", undo_list /*
2920 List of undo entries in current buffer. 2920 List of undo entries in current buffer.
2921 Recent changes come first; older changes follow newer. 2921 Recent changes come first; older changes follow newer.
2922 2922
2923 An entry (BEG . END) represents an insertion which begins at 2923 An entry (START . END) represents an insertion which begins at
2924 position BEG and ends at position END. 2924 position START and ends at position END.
2925 2925
2926 An entry (TEXT . POSITION) represents the deletion of the string TEXT 2926 An entry (TEXT . POSITION) represents the deletion of the string TEXT
2927 from (abs POSITION). If POSITION is positive, point was at the front 2927 from (abs POSITION). If POSITION is positive, point was at the front
2928 of the text being deleted; if negative, point was at the end. 2928 of the text being deleted; if negative, point was at the end.
2929 2929
3003 Invisibility spec of this buffer. 3003 Invisibility spec of this buffer.
3004 The default is t, which means that text is invisible 3004 The default is t, which means that text is invisible
3005 if it has (or is covered by an extent with) a non-nil `invisible' property. 3005 if it has (or is covered by an extent with) a non-nil `invisible' property.
3006 If the value is a list, a text character is invisible if its `invisible' 3006 If the value is a list, a text character is invisible if its `invisible'
3007 property is an element in that list. 3007 property is an element in that list.
3008 If an element is a cons cell of the form (PROP . ELLIPSIS), 3008 If an element is a cons cell of the form (PROPERTY . ELLIPSIS),
3009 then characters with property value PROP are invisible, 3009 then characters with property value PROPERTY are invisible,
3010 and they have an ellipsis as well if ELLIPSIS is non-nil. 3010 and they have an ellipsis as well if ELLIPSIS is non-nil.
3011 Note that the actual characters used for the ellipsis are controllable 3011 Note that the actual characters used for the ellipsis are controllable
3012 using `invisible-text-glyph', and default to "...". 3012 using `invisible-text-glyph', and default to "...".
3013 */, redisplay_variable_changed); 3013 */, redisplay_variable_changed);
3014 3014