diff options
| author | Stefan Monnier | 2009-10-01 17:47:38 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2009-10-01 17:47:38 +0000 |
| commit | 9d28c33edefe1b366f4c6944886a3e4cf294cf60 (patch) | |
| tree | 49c37c932cee4f48d0bba8b7009ceec71af60d92 | |
| parent | ced10a4c9f0030e4e554d6ca3f96c6e366dba8db (diff) | |
| download | emacs-9d28c33edefe1b366f4c6944886a3e4cf294cf60.tar.gz emacs-9d28c33edefe1b366f4c6944886a3e4cf294cf60.zip | |
* eval.c (Fcalled_interactively_p): Add `kind' argument.
* subr.el (interactive-p): Mark obsolete.
(called-interactively-p): Make the optional-ness of `kind' obsolete.
* emacs-lisp/bytecomp.el (byte-compile-fdefinition): Make it obey
advertised-signature-table for subroutines as well.
| -rw-r--r-- | etc/NEWS | 2 | ||||
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 22 | ||||
| -rw-r--r-- | lisp/subr.el | 64 | ||||
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/eval.c | 24 |
6 files changed, 76 insertions, 47 deletions
| @@ -246,6 +246,8 @@ Command*'. | |||
| 246 | 246 | ||
| 247 | * Lisp changes in Emacs 23.2 | 247 | * Lisp changes in Emacs 23.2 |
| 248 | 248 | ||
| 249 | ** called-interactively-p now takes one argument and replaces interactive-p | ||
| 250 | which is now marked obsolete. | ||
| 249 | ** New function set-advertised-calling-convention makes it possible | 251 | ** New function set-advertised-calling-convention makes it possible |
| 250 | to obsolete arguments as well as make some arguments mandatory. | 252 | to obsolete arguments as well as make some arguments mandatory. |
| 251 | ** eval-next-after-load is obsolete. | 253 | ** eval-next-after-load is obsolete. |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 505f9b847c6..b4953592726 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,10 @@ | |||
| 1 | 2009-10-01 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2009-10-01 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * subr.el (interactive-p): Mark obsolete. | ||
| 4 | (called-interactively-p): Make the optional-ness of `kind' obsolete. | ||
| 5 | * emacs-lisp/bytecomp.el (byte-compile-fdefinition): Make it obey | ||
| 6 | advertised-signature-table for subroutines as well. | ||
| 7 | |||
| 3 | * emacs-lisp/byte-run.el (advertised-signature-table): New var. | 8 | * emacs-lisp/byte-run.el (advertised-signature-table): New var. |
| 4 | (set-advertised-calling-convention): New function. | 9 | (set-advertised-calling-convention): New function. |
| 5 | (make-obsolete, define-obsolete-function-alias) | 10 | (make-obsolete, define-obsolete-function-alias) |
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index f411576c883..1262264e9ec 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el | |||
| @@ -1248,7 +1248,11 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'." | |||
| 1248 | (and (not macro-p) | 1248 | (and (not macro-p) |
| 1249 | (byte-code-function-p (symbol-function fn))))) | 1249 | (byte-code-function-p (symbol-function fn))))) |
| 1250 | (setq fn (symbol-function fn))) | 1250 | (setq fn (symbol-function fn))) |
| 1251 | (let ((advertised (gethash fn advertised-signature-table t))) | 1251 | (let ((advertised (gethash (if (and (symbolp fn) (fboundp fn)) |
| 1252 | ;; Could be a subr. | ||
| 1253 | (symbol-function fn) | ||
| 1254 | fn) | ||
| 1255 | advertised-signature-table t))) | ||
| 1252 | (cond | 1256 | (cond |
| 1253 | ((listp advertised) | 1257 | ((listp advertised) |
| 1254 | (if macro-p | 1258 | (if macro-p |
| @@ -3104,14 +3108,14 @@ That command is designed for interactive use only" bytecomp-fn)) | |||
| 3104 | ;; which have special byte codes just for speed. | 3108 | ;; which have special byte codes just for speed. |
| 3105 | 3109 | ||
| 3106 | (defmacro byte-defop-compiler (function &optional compile-handler) | 3110 | (defmacro byte-defop-compiler (function &optional compile-handler) |
| 3107 | ;; add a compiler-form for FUNCTION. | 3111 | "Add a compiler-form for FUNCTION. |
| 3108 | ;; If function is a symbol, then the variable "byte-SYMBOL" must name | 3112 | If function is a symbol, then the variable \"byte-SYMBOL\" must name |
| 3109 | ;; the opcode to be used. If function is a list, the first element | 3113 | the opcode to be used. If function is a list, the first element |
| 3110 | ;; is the function and the second element is the bytecode-symbol. | 3114 | is the function and the second element is the bytecode-symbol. |
| 3111 | ;; The second element may be nil, meaning there is no opcode. | 3115 | The second element may be nil, meaning there is no opcode. |
| 3112 | ;; COMPILE-HANDLER is the function to use to compile this byte-op, or | 3116 | COMPILE-HANDLER is the function to use to compile this byte-op, or |
| 3113 | ;; may be the abbreviations 0, 1, 2, 3, 0-1, or 1-2. | 3117 | may be the abbreviations 0, 1, 2, 3, 0-1, or 1-2. |
| 3114 | ;; If it is nil, then the handler is "byte-compile-SYMBOL." | 3118 | If it is nil, then the handler is \"byte-compile-SYMBOL.\"" |
| 3115 | (let (opcode) | 3119 | (let (opcode) |
| 3116 | (if (symbolp function) | 3120 | (if (symbolp function) |
| 3117 | (setq opcode (intern (concat "byte-" (symbol-name function)))) | 3121 | (setq opcode (intern (concat "byte-" (symbol-name function)))) |
diff --git a/lisp/subr.el b/lisp/subr.el index a7d3fcd600c..20a692c22a8 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -1008,6 +1008,39 @@ and `event-end' functions." | |||
| 1008 | 1008 | ||
| 1009 | ;;;; Obsolescent names for functions. | 1009 | ;;;; Obsolescent names for functions. |
| 1010 | 1010 | ||
| 1011 | (define-obsolete-function-alias 'window-dot 'window-point "22.1") | ||
| 1012 | (define-obsolete-function-alias 'set-window-dot 'set-window-point "22.1") | ||
| 1013 | (define-obsolete-function-alias 'read-input 'read-string "22.1") | ||
| 1014 | (define-obsolete-function-alias 'show-buffer 'set-window-buffer "22.1") | ||
| 1015 | (define-obsolete-function-alias 'eval-current-buffer 'eval-buffer "22.1") | ||
| 1016 | (define-obsolete-function-alias 'string-to-int 'string-to-number "22.1") | ||
| 1017 | |||
| 1018 | (make-obsolete 'char-bytes "now always returns 1." "20.4") | ||
| 1019 | (make-obsolete 'forward-point "use (+ (point) N) instead." "23.1") | ||
| 1020 | |||
| 1021 | (defun insert-string (&rest args) | ||
| 1022 | "Mocklisp-compatibility insert function. | ||
| 1023 | Like the function `insert' except that any argument that is a number | ||
| 1024 | is converted into a string by expressing it in decimal." | ||
| 1025 | (dolist (el args) | ||
| 1026 | (insert (if (integerp el) (number-to-string el) el)))) | ||
| 1027 | (make-obsolete 'insert-string 'insert "22.1") | ||
| 1028 | |||
| 1029 | (defun makehash (&optional test) (make-hash-table :test (or test 'eql))) | ||
| 1030 | (make-obsolete 'makehash 'make-hash-table "22.1") | ||
| 1031 | |||
| 1032 | ;; These are used by VM and some old programs | ||
| 1033 | (defalias 'focus-frame 'ignore "") | ||
| 1034 | (make-obsolete 'focus-frame "it does nothing." "22.1") | ||
| 1035 | (defalias 'unfocus-frame 'ignore "") | ||
| 1036 | (make-obsolete 'unfocus-frame "it does nothing." "22.1") | ||
| 1037 | (make-obsolete 'make-variable-frame-local | ||
| 1038 | "explicitly check for a frame-parameter instead." "22.2") | ||
| 1039 | (make-obsolete 'interactive-p 'called-interactively-p "23.2") | ||
| 1040 | (set-advertised-calling-convention 'called-interactively-p '(kind)) | ||
| 1041 | |||
| 1042 | ;;;; Obsolescence declarations for variables, and aliases. | ||
| 1043 | |||
| 1011 | ;; Special "default-FOO" variables which contain the default value of | 1044 | ;; Special "default-FOO" variables which contain the default value of |
| 1012 | ;; the "FOO" variable are nasty. Their implementation is brittle, and | 1045 | ;; the "FOO" variable are nasty. Their implementation is brittle, and |
| 1013 | ;; slows down several unrelated variable operations; furthermore, they | 1046 | ;; slows down several unrelated variable operations; furthermore, they |
| @@ -1047,37 +1080,6 @@ and `event-end' functions." | |||
| 1047 | (make-obsolete-variable 'default-enable-multibyte-characters | 1080 | (make-obsolete-variable 'default-enable-multibyte-characters |
| 1048 | "use enable-multibyte-characters or set-buffer-multibyte instead" "23.2") | 1081 | "use enable-multibyte-characters or set-buffer-multibyte instead" "23.2") |
| 1049 | 1082 | ||
| 1050 | (define-obsolete-function-alias 'window-dot 'window-point "22.1") | ||
| 1051 | (define-obsolete-function-alias 'set-window-dot 'set-window-point "22.1") | ||
| 1052 | (define-obsolete-function-alias 'read-input 'read-string "22.1") | ||
| 1053 | (define-obsolete-function-alias 'show-buffer 'set-window-buffer "22.1") | ||
| 1054 | (define-obsolete-function-alias 'eval-current-buffer 'eval-buffer "22.1") | ||
| 1055 | (define-obsolete-function-alias 'string-to-int 'string-to-number "22.1") | ||
| 1056 | |||
| 1057 | (make-obsolete 'char-bytes "now always returns 1." "20.4") | ||
| 1058 | (make-obsolete 'forward-point "use (+ (point) N) instead." "23.1") | ||
| 1059 | |||
| 1060 | (defun insert-string (&rest args) | ||
| 1061 | "Mocklisp-compatibility insert function. | ||
| 1062 | Like the function `insert' except that any argument that is a number | ||
| 1063 | is converted into a string by expressing it in decimal." | ||
| 1064 | (dolist (el args) | ||
| 1065 | (insert (if (integerp el) (number-to-string el) el)))) | ||
| 1066 | (make-obsolete 'insert-string 'insert "22.1") | ||
| 1067 | |||
| 1068 | (defun makehash (&optional test) (make-hash-table :test (or test 'eql))) | ||
| 1069 | (make-obsolete 'makehash 'make-hash-table "22.1") | ||
| 1070 | |||
| 1071 | ;; These are used by VM and some old programs | ||
| 1072 | (defalias 'focus-frame 'ignore "") | ||
| 1073 | (make-obsolete 'focus-frame "it does nothing." "22.1") | ||
| 1074 | (defalias 'unfocus-frame 'ignore "") | ||
| 1075 | (make-obsolete 'unfocus-frame "it does nothing." "22.1") | ||
| 1076 | (make-obsolete 'make-variable-frame-local | ||
| 1077 | "explicitly check for a frame-parameter instead." "22.2") | ||
| 1078 | |||
| 1079 | ;;;; Obsolescence declarations for variables, and aliases. | ||
| 1080 | |||
| 1081 | (make-obsolete-variable 'define-key-rebound-commands nil "23.2") | 1083 | (make-obsolete-variable 'define-key-rebound-commands nil "23.2") |
| 1082 | (make-obsolete-variable 'redisplay-end-trigger-functions 'jit-lock-register "23.1") | 1084 | (make-obsolete-variable 'redisplay-end-trigger-functions 'jit-lock-register "23.1") |
| 1083 | (make-obsolete 'window-redisplay-end-trigger nil "23.1") | 1085 | (make-obsolete 'window-redisplay-end-trigger nil "23.1") |
diff --git a/src/ChangeLog b/src/ChangeLog index 3e36b223142..afdfff07562 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,6 +1,10 @@ | |||
| 1 | 2009-10-01 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * eval.c (Fcalled_interactively_p): Add `kind' argument. | ||
| 4 | |||
| 1 | 2009-10-01 Michael Albinus <michael.albinus@gmx.de> | 5 | 2009-10-01 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 6 | ||
| 3 | * fileio.c (Fdelete_directory_internal): Renamed from | 7 | * fileio.c (Fdelete_directory_internal): Rename from |
| 4 | Fdelete_directory. It is not a command anymore. It has no file | 8 | Fdelete_directory. It is not a command anymore. It has no file |
| 5 | name handler. | 9 | name handler. |
| 6 | 10 | ||
diff --git a/src/eval.c b/src/eval.c index 8d446de09fc..20988392e5f 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -608,19 +608,31 @@ use `called-interactively-p'. */) | |||
| 608 | } | 608 | } |
| 609 | 609 | ||
| 610 | 610 | ||
| 611 | DEFUN ("called-interactively-p", Fcalled_interactively_p, Scalled_interactively_p, 0, 0, 0, | 611 | DEFUN ("called-interactively-p", Fcalled_interactively_p, Scalled_interactively_p, 0, 1, 0, |
| 612 | doc: /* Return t if the containing function was called by `call-interactively'. | 612 | doc: /* Return t if the containing function was called by `call-interactively'. |
| 613 | This includes being called as the binding of a key, or called from a | 613 | If KIND is `interactive', then only return t if the call was made |
| 614 | keyboard macro (unlike `interactive-p'). | 614 | interactively by the user, i.e. not in `noninteractive' mode nor |
| 615 | when `executing-kbd-macro'. | ||
| 616 | If KIND is `any', on the other hand, it will return t for any kind of | ||
| 617 | interactive call, including being called as the binding of a key, or | ||
| 618 | from a keyboard macro, or in `noninteractive' mode. | ||
| 619 | |||
| 620 | The only known proper use of `interactive' for KIND is in deciding | ||
| 621 | whether to display a helpful message, or how to display it. If you're | ||
| 622 | thinking of using it for any other purpose, it is quite likely that | ||
| 623 | you're making a mistake. Think: what do you want to do when the | ||
| 624 | command is called from a keyboard macro? | ||
| 615 | 625 | ||
| 616 | This function is meant for implementing advice and other | 626 | This function is meant for implementing advice and other |
| 617 | function-modifying features. Instead of using this, it is sometimes | 627 | function-modifying features. Instead of using this, it is sometimes |
| 618 | cleaner to give your function an extra optional argument whose | 628 | cleaner to give your function an extra optional argument whose |
| 619 | `interactive' spec specifies non-nil unconditionally (\"p\" is a good | 629 | `interactive' spec specifies non-nil unconditionally (\"p\" is a good |
| 620 | way to do this). */) | 630 | way to do this), or via (not (or executing-kbd-macro noninteractive)). */) |
| 621 | () | 631 | (kind) |
| 632 | Lisp_Object kind; | ||
| 622 | { | 633 | { |
| 623 | return interactive_p (1) ? Qt : Qnil; | 634 | return ((INTERACTIVE || !EQ (kind, intern ("interactive"))) |
| 635 | && interactive_p (1)) ? Qt : Qnil; | ||
| 624 | } | 636 | } |
| 625 | 637 | ||
| 626 | 638 | ||