diff options
Diffstat (limited to 'src/data.c')
| -rw-r--r-- | src/data.c | 70 |
1 files changed, 36 insertions, 34 deletions
diff --git a/src/data.c b/src/data.c index abcdd4dca0d..09899400b68 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -81,6 +81,7 @@ Lisp_Object Qfont_spec, Qfont_entity, Qfont_object; | |||
| 81 | static Lisp_Object Qdefun; | 81 | static Lisp_Object Qdefun; |
| 82 | 82 | ||
| 83 | Lisp_Object Qinteractive_form; | 83 | Lisp_Object Qinteractive_form; |
| 84 | static Lisp_Object Qdefalias_fset_function; | ||
| 84 | 85 | ||
| 85 | static void swap_in_symval_forwarding (struct Lisp_Symbol *, struct Lisp_Buffer_Local_Value *); | 86 | static void swap_in_symval_forwarding (struct Lisp_Symbol *, struct Lisp_Buffer_Local_Value *); |
| 86 | 87 | ||
| @@ -444,7 +445,7 @@ DEFUN ("floatp", Ffloatp, Sfloatp, 1, 1, 0, | |||
| 444 | } | 445 | } |
| 445 | 446 | ||
| 446 | 447 | ||
| 447 | /* Extract and set components of lists */ | 448 | /* Extract and set components of lists. */ |
| 448 | 449 | ||
| 449 | DEFUN ("car", Fcar, Scar, 1, 1, 0, | 450 | DEFUN ("car", Fcar, Scar, 1, 1, 0, |
| 450 | doc: /* Return the car of LIST. If arg is nil, return nil. | 451 | doc: /* Return the car of LIST. If arg is nil, return nil. |
| @@ -608,27 +609,18 @@ DEFUN ("fset", Ffset, Sfset, 2, 2, 0, | |||
| 608 | (register Lisp_Object symbol, Lisp_Object definition) | 609 | (register Lisp_Object symbol, Lisp_Object definition) |
| 609 | { | 610 | { |
| 610 | register Lisp_Object function; | 611 | register Lisp_Object function; |
| 611 | |||
| 612 | CHECK_SYMBOL (symbol); | 612 | CHECK_SYMBOL (symbol); |
| 613 | if (NILP (symbol) || EQ (symbol, Qt)) | ||
| 614 | xsignal1 (Qsetting_constant, symbol); | ||
| 615 | 613 | ||
| 616 | function = XSYMBOL (symbol)->function; | 614 | function = XSYMBOL (symbol)->function; |
| 617 | 615 | ||
| 618 | if (!NILP (Vautoload_queue) && !EQ (function, Qunbound)) | 616 | if (!NILP (Vautoload_queue) && !EQ (function, Qunbound)) |
| 619 | Vautoload_queue = Fcons (Fcons (symbol, function), Vautoload_queue); | 617 | Vautoload_queue = Fcons (Fcons (symbol, function), Vautoload_queue); |
| 620 | 618 | ||
| 621 | if (CONSP (function) && EQ (XCAR (function), Qautoload)) | 619 | if (AUTOLOADP (function)) |
| 622 | Fput (symbol, Qautoload, XCDR (function)); | 620 | Fput (symbol, Qautoload, XCDR (function)); |
| 623 | 621 | ||
| 624 | set_symbol_function (symbol, definition); | 622 | set_symbol_function (symbol, definition); |
| 625 | /* Handle automatic advice activation. */ | 623 | |
| 626 | if (CONSP (XSYMBOL (symbol)->plist) | ||
| 627 | && !NILP (Fget (symbol, Qad_advice_info))) | ||
| 628 | { | ||
| 629 | call2 (Qad_activate_internal, symbol, Qnil); | ||
| 630 | definition = XSYMBOL (symbol)->function; | ||
| 631 | } | ||
| 632 | return definition; | 624 | return definition; |
| 633 | } | 625 | } |
| 634 | 626 | ||
| @@ -642,15 +634,32 @@ The return value is undefined. */) | |||
| 642 | (register Lisp_Object symbol, Lisp_Object definition, Lisp_Object docstring) | 634 | (register Lisp_Object symbol, Lisp_Object definition, Lisp_Object docstring) |
| 643 | { | 635 | { |
| 644 | CHECK_SYMBOL (symbol); | 636 | CHECK_SYMBOL (symbol); |
| 645 | if (CONSP (XSYMBOL (symbol)->function) | ||
| 646 | && EQ (XCAR (XSYMBOL (symbol)->function), Qautoload)) | ||
| 647 | LOADHIST_ATTACH (Fcons (Qt, symbol)); | ||
| 648 | if (!NILP (Vpurify_flag) | 637 | if (!NILP (Vpurify_flag) |
| 649 | /* If `definition' is a keymap, immutable (and copying) is wrong. */ | 638 | /* If `definition' is a keymap, immutable (and copying) is wrong. */ |
| 650 | && !KEYMAPP (definition)) | 639 | && !KEYMAPP (definition)) |
| 651 | definition = Fpurecopy (definition); | 640 | definition = Fpurecopy (definition); |
| 652 | definition = Ffset (symbol, definition); | 641 | |
| 653 | LOADHIST_ATTACH (Fcons (Qdefun, symbol)); | 642 | { |
| 643 | bool autoload = AUTOLOADP (definition); | ||
| 644 | if (NILP (Vpurify_flag) || !autoload) | ||
| 645 | { /* Only add autoload entries after dumping, because the ones before are | ||
| 646 | not useful and else we get loads of them from the loaddefs.el. */ | ||
| 647 | |||
| 648 | if (AUTOLOADP (XSYMBOL (symbol)->function)) | ||
| 649 | /* Remember that the function was already an autoload. */ | ||
| 650 | LOADHIST_ATTACH (Fcons (Qt, symbol)); | ||
| 651 | LOADHIST_ATTACH (Fcons (autoload ? Qautoload : Qdefun, symbol)); | ||
| 652 | } | ||
| 653 | } | ||
| 654 | |||
| 655 | { /* Handle automatic advice activation. */ | ||
| 656 | Lisp_Object hook = Fget (symbol, Qdefalias_fset_function); | ||
| 657 | if (!NILP (hook)) | ||
| 658 | call2 (hook, symbol, definition); | ||
| 659 | else | ||
| 660 | Ffset (symbol, definition); | ||
| 661 | } | ||
| 662 | |||
| 654 | if (!NILP (docstring)) | 663 | if (!NILP (docstring)) |
| 655 | Fput (symbol, Qfunction_documentation, docstring); | 664 | Fput (symbol, Qfunction_documentation, docstring); |
| 656 | /* We used to return `definition', but now that `defun' and `defmacro' expand | 665 | /* We used to return `definition', but now that `defun' and `defmacro' expand |
| @@ -680,12 +689,10 @@ function with `&rest' args, or `unevalled' for a special form. */) | |||
| 680 | CHECK_SUBR (subr); | 689 | CHECK_SUBR (subr); |
| 681 | minargs = XSUBR (subr)->min_args; | 690 | minargs = XSUBR (subr)->min_args; |
| 682 | maxargs = XSUBR (subr)->max_args; | 691 | maxargs = XSUBR (subr)->max_args; |
| 683 | if (maxargs == MANY) | 692 | return Fcons (make_number (minargs), |
| 684 | return Fcons (make_number (minargs), Qmany); | 693 | maxargs == MANY ? Qmany |
| 685 | else if (maxargs == UNEVALLED) | 694 | : maxargs == UNEVALLED ? Qunevalled |
| 686 | return Fcons (make_number (minargs), Qunevalled); | 695 | : make_number (maxargs)); |
| 687 | else | ||
| 688 | return Fcons (make_number (minargs), make_number (maxargs)); | ||
| 689 | } | 696 | } |
| 690 | 697 | ||
| 691 | DEFUN ("subr-name", Fsubr_name, Ssubr_name, 1, 1, 0, | 698 | DEFUN ("subr-name", Fsubr_name, Ssubr_name, 1, 1, 0, |
| @@ -711,7 +718,7 @@ Value, if non-nil, is a list \(interactive SPEC). */) | |||
| 711 | return Qnil; | 718 | return Qnil; |
| 712 | 719 | ||
| 713 | /* Use an `interactive-form' property if present, analogous to the | 720 | /* Use an `interactive-form' property if present, analogous to the |
| 714 | function-documentation property. */ | 721 | function-documentation property. */ |
| 715 | fun = cmd; | 722 | fun = cmd; |
| 716 | while (SYMBOLP (fun)) | 723 | while (SYMBOLP (fun)) |
| 717 | { | 724 | { |
| @@ -735,6 +742,8 @@ Value, if non-nil, is a list \(interactive SPEC). */) | |||
| 735 | if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) > COMPILED_INTERACTIVE) | 742 | if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) > COMPILED_INTERACTIVE) |
| 736 | return list2 (Qinteractive, AREF (fun, COMPILED_INTERACTIVE)); | 743 | return list2 (Qinteractive, AREF (fun, COMPILED_INTERACTIVE)); |
| 737 | } | 744 | } |
| 745 | else if (AUTOLOADP (fun)) | ||
| 746 | return Finteractive_form (Fautoload_do_load (fun, cmd, Qnil)); | ||
| 738 | else if (CONSP (fun)) | 747 | else if (CONSP (fun)) |
| 739 | { | 748 | { |
| 740 | Lisp_Object funcar = XCAR (fun); | 749 | Lisp_Object funcar = XCAR (fun); |
| @@ -742,14 +751,6 @@ Value, if non-nil, is a list \(interactive SPEC). */) | |||
| 742 | return Fassq (Qinteractive, Fcdr (Fcdr (XCDR (fun)))); | 751 | return Fassq (Qinteractive, Fcdr (Fcdr (XCDR (fun)))); |
| 743 | else if (EQ (funcar, Qlambda)) | 752 | else if (EQ (funcar, Qlambda)) |
| 744 | return Fassq (Qinteractive, Fcdr (XCDR (fun))); | 753 | return Fassq (Qinteractive, Fcdr (XCDR (fun))); |
| 745 | else if (EQ (funcar, Qautoload)) | ||
| 746 | { | ||
| 747 | struct gcpro gcpro1; | ||
| 748 | GCPRO1 (cmd); | ||
| 749 | Fautoload_do_load (fun, cmd, Qnil); | ||
| 750 | UNGCPRO; | ||
| 751 | return Finteractive_form (cmd); | ||
| 752 | } | ||
| 753 | } | 754 | } |
| 754 | return Qnil; | 755 | return Qnil; |
| 755 | } | 756 | } |
| @@ -2695,10 +2696,10 @@ usage: (* &rest NUMBERS-OR-MARKERS) */) | |||
| 2695 | return arith_driver (Amult, nargs, args); | 2696 | return arith_driver (Amult, nargs, args); |
| 2696 | } | 2697 | } |
| 2697 | 2698 | ||
| 2698 | DEFUN ("/", Fquo, Squo, 2, MANY, 0, | 2699 | DEFUN ("/", Fquo, Squo, 1, MANY, 0, |
| 2699 | doc: /* Return first argument divided by all the remaining arguments. | 2700 | doc: /* Return first argument divided by all the remaining arguments. |
| 2700 | The arguments must be numbers or markers. | 2701 | The arguments must be numbers or markers. |
| 2701 | usage: (/ DIVIDEND DIVISOR &rest DIVISORS) */) | 2702 | usage: (/ DIVIDEND &rest DIVISORS) */) |
| 2702 | (ptrdiff_t nargs, Lisp_Object *args) | 2703 | (ptrdiff_t nargs, Lisp_Object *args) |
| 2703 | { | 2704 | { |
| 2704 | ptrdiff_t argnum; | 2705 | ptrdiff_t argnum; |
| @@ -3063,6 +3064,7 @@ syms_of_data (void) | |||
| 3063 | DEFSYM (Qfont_object, "font-object"); | 3064 | DEFSYM (Qfont_object, "font-object"); |
| 3064 | 3065 | ||
| 3065 | DEFSYM (Qinteractive_form, "interactive-form"); | 3066 | DEFSYM (Qinteractive_form, "interactive-form"); |
| 3067 | DEFSYM (Qdefalias_fset_function, "defalias-fset-function"); | ||
| 3066 | 3068 | ||
| 3067 | defsubr (&Sindirect_variable); | 3069 | defsubr (&Sindirect_variable); |
| 3068 | defsubr (&Sinteractive_form); | 3070 | defsubr (&Sinteractive_form); |