diff options
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/byte-run.el | 19 | ||||
-rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 24 | ||||
-rw-r--r-- | lisp/emacs-lisp/lisp.el | 5 |
3 files changed, 24 insertions, 24 deletions
diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index e61f841da60..f79add14836 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -153,24 +153,21 @@ See the docstrings of `defalias' and `make-obsolete' for more details." 'define-obsolete-function-alias '(obsolete-name current-name when &optional docstring) "23.1") -(defun make-obsolete-variable (obsolete-name current-name &optional when) +(defun make-obsolete-variable (obsolete-name current-name &optional when access-type) "Make the byte-compiler warn that OBSOLETE-NAME is obsolete. The warning will say that CURRENT-NAME should be used instead. If CURRENT-NAME is a string, that is the `use instead' message. -If provided, WHEN should be a string indicating when the variable -was first made obsolete, for example a date or a release number." - (interactive - (list - (let ((str (completing-read "Make variable obsolete: " obarray 'boundp t))) - (if (equal str "") (error "")) - (intern str)) - (car (read-from-string (read-string "Obsoletion replacement: "))))) +WHEN should be a string indicating when the variable +was first made obsolete, for example a date or a release number. +ACCESS-TYPE if non-nil should specify the kind of access that will trigger + obsolescence warnings; it can be either `get' or `set'." (put obsolete-name 'byte-obsolete-variable - (purecopy (cons current-name when))) + (purecopy (list current-name access-type when))) obsolete-name) (set-advertised-calling-convention ;; New code should always provide the `when' argument. - 'make-obsolete-variable '(obsolete-name current-name when) "23.1") + 'make-obsolete-variable + '(obsolete-name current-name when &optional access-type) "23.1") (defmacro define-obsolete-variable-alias (obsolete-name current-name &optional when docstring) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 08d484fc872..1e7ee315942 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -1109,7 +1109,7 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'." (let* ((funcp (get symbol 'byte-obsolete-info)) (obsolete (or funcp (get symbol 'byte-obsolete-variable))) (instead (car obsolete)) - (asof (if funcp (nth 2 obsolete) (cdr obsolete)))) + (asof (nth 2 obsolete))) (unless (and funcp (memq symbol byte-compile-not-obsolete-funcs)) (byte-compile-warn "`%s' is an obsolete %s%s%s" symbol (if funcp "function" "variable") @@ -3016,20 +3016,24 @@ That command is designed for interactive use only" fn)) (assert (eq byte-compile-depth (1+ start-depth)) nil "Wrong depth start=%s end=%s" start-depth byte-compile-depth))) -(defun byte-compile-check-variable (var &optional binding) - "Do various error checks before a use of the variable VAR. -If BINDING is non-nil, VAR is being bound." +(defun byte-compile-check-variable (var access-type) + "Do various error checks before a use of the variable VAR." (when (symbolp var) (byte-compile-set-symbol-position var)) (cond ((or (not (symbolp var)) (byte-compile-const-symbol-p var)) (when (byte-compile-warning-enabled-p 'constants) - (byte-compile-warn (if binding + (byte-compile-warn (if (eq access-type 'let-bind) "attempt to let-bind %s `%s`" "variable reference to %s `%s'") (if (symbolp var) "constant" "nonvariable") (prin1-to-string var)))) - ((and (get var 'byte-obsolete-variable) - (not (memq var byte-compile-not-obsolete-vars))) + ((let ((od (get var 'byte-obsolete-variable))) + (and od + (not (memq var byte-compile-not-obsolete-vars)) + (or (case (nth 1 od) + (set (not (eq access-type 'reference))) + (get (eq access-type 'reference)) + (t t))))) (byte-compile-warn-obsolete var)))) (defsubst byte-compile-dynamic-variable-op (base-op var) @@ -3041,13 +3045,13 @@ If BINDING is non-nil, VAR is being bound." (defun byte-compile-dynamic-variable-bind (var) "Generate code to bind the lexical variable VAR to the top-of-stack value." - (byte-compile-check-variable var t) + (byte-compile-check-variable var 'let-bind) (push var byte-compile-bound-variables) (byte-compile-dynamic-variable-op 'byte-varbind var)) (defun byte-compile-variable-ref (var) "Generate code to push the value of the variable VAR on the stack." - (byte-compile-check-variable var) + (byte-compile-check-variable var 'reference) (let ((lex-binding (assq var byte-compile--lexical-environment))) (if lex-binding ;; VAR is lexically bound @@ -3063,7 +3067,7 @@ If BINDING is non-nil, VAR is being bound." (defun byte-compile-variable-set (var) "Generate code to set the variable VAR from the top-of-stack value." - (byte-compile-check-variable var) + (byte-compile-check-variable var 'assign) (let ((lex-binding (assq var byte-compile--lexical-environment))) (if lex-binding ;; VAR is lexically bound diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index ece96fe2515..db6a03333d4 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el @@ -636,9 +636,8 @@ considered." (plist (nthcdr 3 data))) (if (null data) (minibuffer-message "Nothing to complete") - (let ((completion-annotate-function - (plist-get plist :annotation-function))) - (completion-in-region (nth 0 data) (nth 1 data) (nth 2 data) + (let ((completion-extra-properties plist)) + (completion-in-region (nth 0 data) (nth 1 data) (nth 2 data) (plist-get plist :predicate)))))) |