Mercurial > emacs
comparison src/buffer.c @ 7455:35657813817c
(Frename_buffer): Reject empty string as new name.
(syms_of_buffer): Fix typo in previous change.
| author | Richard M. Stallman <rms@gnu.org> |
|---|---|
| date | Wed, 11 May 1994 04:16:19 +0000 |
| parents | 7b5d67590d57 |
| children | 4ba64e05dad6 |
comparison
equal
deleted
inserted
replaced
| 7454:8d9e41a175fa | 7455:35657813817c |
|---|---|
| 579 register Lisp_Object name, unique; | 579 register Lisp_Object name, unique; |
| 580 { | 580 { |
| 581 register Lisp_Object tem, buf; | 581 register Lisp_Object tem, buf; |
| 582 | 582 |
| 583 CHECK_STRING (name, 0); | 583 CHECK_STRING (name, 0); |
| 584 | |
| 585 if (XSTRING (name)->size == 0) | |
| 586 error ("Empty string is invalid as a buffer name"); | |
| 587 | |
| 584 tem = Fget_buffer (name); | 588 tem = Fget_buffer (name); |
| 585 /* Don't short-circuit if UNIQUE is t. That is a useful way to rename | 589 /* Don't short-circuit if UNIQUE is t. That is a useful way to rename |
| 586 the buffer automatically so you can create another with the original name. | 590 the buffer automatically so you can create another with the original name. |
| 587 It makes UNIQUE equivalent to | 591 It makes UNIQUE equivalent to |
| 588 (rename-buffer (generate-new-buffer-name NAME)). */ | 592 (rename-buffer (generate-new-buffer-name NAME)). */ |
| 2589 Buffer changes made while executing the `before-change-function'\n\ | 2593 Buffer changes made while executing the `before-change-function'\n\ |
| 2590 don't call any before-change or after-change functions.\n\ | 2594 don't call any before-change or after-change functions.\n\ |
| 2591 That's because these variables are temporarily set to nil.\n\ | 2595 That's because these variables are temporarily set to nil.\n\ |
| 2592 As a result, a hook function cannot straightforwardly alter the value of\n\ | 2596 As a result, a hook function cannot straightforwardly alter the value of\n\ |
| 2593 these variables. See the Emacs Lisp manual for a way of\n\ | 2597 these variables. See the Emacs Lisp manual for a way of\n\ |
| 2594 accomplishing an equivalent result by using other variables.") | 2598 accomplishing an equivalent result by using other variables."); |
| 2595 Vbefore_change_function = Qnil; | 2599 Vbefore_change_function = Qnil; |
| 2596 | 2600 |
| 2597 DEFVAR_LISP ("after-change-function", &Vafter_change_function, | 2601 DEFVAR_LISP ("after-change-function", &Vafter_change_function, |
| 2598 "Function to call after each text change.\n\ | 2602 "Function to call after each text change.\n\ |
| 2599 Three arguments are passed to the function: the positions of\n\ | 2603 Three arguments are passed to the function: the positions of\n\ |
| 2606 Buffer changes made while executing the `after-change-function'\n\ | 2610 Buffer changes made while executing the `after-change-function'\n\ |
| 2607 don't call any before-change or after-change functions.\n\ | 2611 don't call any before-change or after-change functions.\n\ |
| 2608 That's because these variables are temporarily set to nil.\n\ | 2612 That's because these variables are temporarily set to nil.\n\ |
| 2609 As a result, a hook function cannot straightforwardly alter the value of\n\ | 2613 As a result, a hook function cannot straightforwardly alter the value of\n\ |
| 2610 these variables. See the Emacs Lisp manual for a way of\n\ | 2614 these variables. See the Emacs Lisp manual for a way of\n\ |
| 2611 accomplishing an equivalent result by using other variables.") | 2615 accomplishing an equivalent result by using other variables."); |
| 2612 Vafter_change_function = Qnil; | 2616 Vafter_change_function = Qnil; |
| 2613 | 2617 |
| 2614 DEFVAR_LISP ("before-change-functions", &Vbefore_change_functions, | 2618 DEFVAR_LISP ("before-change-functions", &Vbefore_change_functions, |
| 2615 "List of functions to call before each text change.\n\ | 2619 "List of functions to call before each text change.\n\ |
| 2616 Two arguments are passed to each function: the positions of\n\ | 2620 Two arguments are passed to each function: the positions of\n\ |
| 2621 Buffer changes made while executing the `before-change-functions'\n\ | 2625 Buffer changes made while executing the `before-change-functions'\n\ |
| 2622 don't call any before-change or after-change functions.\n\ | 2626 don't call any before-change or after-change functions.\n\ |
| 2623 That's because these variables are temporarily set to nil.\n\ | 2627 That's because these variables are temporarily set to nil.\n\ |
| 2624 As a result, a hook function cannot straightforwardly alter the value of\n\ | 2628 As a result, a hook function cannot straightforwardly alter the value of\n\ |
| 2625 these variables. See the Emacs Lisp manual for a way of\n\ | 2629 these variables. See the Emacs Lisp manual for a way of\n\ |
| 2626 accomplishing an equivalent result by using other variables.") | 2630 accomplishing an equivalent result by using other variables."); |
| 2627 Vbefore_change_functions = Qnil; | 2631 Vbefore_change_functions = Qnil; |
| 2628 | 2632 |
| 2629 DEFVAR_LISP ("after-change-functions", &Vafter_change_functions, | 2633 DEFVAR_LISP ("after-change-functions", &Vafter_change_functions, |
| 2630 "List of function to call after each text change.\n\ | 2634 "List of function to call after each text change.\n\ |
| 2631 Three arguments are passed to each function: the positions of\n\ | 2635 Three arguments are passed to each function: the positions of\n\ |
| 2638 Buffer changes made while executing the `after-change-functions'\n\ | 2642 Buffer changes made while executing the `after-change-functions'\n\ |
| 2639 don't call any before-change or after-change functions.\n\ | 2643 don't call any before-change or after-change functions.\n\ |
| 2640 That's because these variables are temporarily set to nil.\n\ | 2644 That's because these variables are temporarily set to nil.\n\ |
| 2641 As a result, a hook function cannot straightforwardly alter the value of\n\ | 2645 As a result, a hook function cannot straightforwardly alter the value of\n\ |
| 2642 these variables. See the Emacs Lisp manual for a way of\n\ | 2646 these variables. See the Emacs Lisp manual for a way of\n\ |
| 2643 accomplishing an equivalent result by using other variables.") | 2647 accomplishing an equivalent result by using other variables."); |
| 2644 | 2648 |
| 2645 Vafter_change_functions = Qnil; | 2649 Vafter_change_functions = Qnil; |
| 2646 | 2650 |
| 2647 DEFVAR_LISP ("first-change-hook", &Vfirst_change_hook, | 2651 DEFVAR_LISP ("first-change-hook", &Vfirst_change_hook, |
| 2648 "A list of functions to call before changing a buffer which is unmodified.\n\ | 2652 "A list of functions to call before changing a buffer which is unmodified.\n\ |
