Move all usages of values' to
values--store-value'
* lisp/simple.el (eval-expression): * lisp/progmodes/elisp-mode.el (eval-last-sexp): * lisp/emacs-lisp/pp.el (pp-eval-expression): * lisp/emacs-lisp/edebug.el (edebug-eval-expression): * lisp/emacs-lisp/pp.el (pp-eval-expression): * lisp/emacs-lisp/edebug.el (edebug-eval-expression): * lisp/cedet/data-debug.el (data-debug-eval-expression): Use it instead of pushing to `values' directly (bug#22066). * lisp/subr.el (values--store-value): New function.
This commit is contained in:
parent
900ed3ad84
commit
0cc35e1431
6 changed files with 68 additions and 54 deletions
|
@ -1045,30 +1045,30 @@ If the result is a list or vector, then use the data debugger to display it."
|
|||
(list (let ((minibuffer-completing-symbol t))
|
||||
(read-from-minibuffer "Eval: "
|
||||
nil read-expression-map t
|
||||
'read-expression-history))
|
||||
))
|
||||
'read-expression-history))))
|
||||
|
||||
(if (null eval-expression-debug-on-error)
|
||||
(setq values (cons (eval expr) values))
|
||||
(let ((old-value (make-symbol "t")) new-value)
|
||||
;; Bind debug-on-error to something unique so that we can
|
||||
;; detect when evalled code changes it.
|
||||
(let ((debug-on-error old-value))
|
||||
(setq values (cons (eval expr) values))
|
||||
(setq new-value debug-on-error))
|
||||
;; If evalled code has changed the value of debug-on-error,
|
||||
;; propagate that change to the global binding.
|
||||
(unless (eq old-value new-value)
|
||||
(setq debug-on-error new-value))))
|
||||
(let (result)
|
||||
(if (null eval-expression-debug-on-error)
|
||||
(setq result (values--store-value (eval expr)))
|
||||
(let ((old-value (make-symbol "t")) new-value)
|
||||
;; Bind debug-on-error to something unique so that we can
|
||||
;; detect when evalled code changes it.
|
||||
(let ((debug-on-error old-value))
|
||||
(setq result (values--store-value (eval expr)))
|
||||
(setq new-value debug-on-error))
|
||||
;; If evalled code has changed the value of debug-on-error,
|
||||
;; propagate that change to the global binding.
|
||||
(unless (eq old-value new-value)
|
||||
(setq debug-on-error new-value))))
|
||||
|
||||
(if (or (consp (car values)) (vectorp (car values)))
|
||||
(let ((v (car values)))
|
||||
(data-debug-show-stuff v "Expression"))
|
||||
;; Old style
|
||||
(prog1
|
||||
(prin1 (car values) t)
|
||||
(let ((str (eval-expression-print-format (car values))))
|
||||
(if str (princ str t))))))
|
||||
(if (or (consp result) (vectorp result))
|
||||
(let ((v result))
|
||||
(data-debug-show-stuff v "Expression"))
|
||||
;; Old style
|
||||
(prog1
|
||||
(prin1 result t)
|
||||
(let ((str (eval-expression-print-format result)))
|
||||
(if str (princ str t)))))))
|
||||
|
||||
(provide 'data-debug)
|
||||
|
||||
|
|
|
@ -3801,9 +3801,10 @@ Print result in minibuffer."
|
|||
(interactive (list (read--expression "Eval: ")))
|
||||
(princ
|
||||
(edebug-outside-excursion
|
||||
(setq values (cons (edebug-eval expr) values))
|
||||
(concat (edebug-safe-prin1-to-string (car values))
|
||||
(eval-expression-print-format (car values))))))
|
||||
(let ((result (edebug-eval expr)))
|
||||
(values--store-value result)
|
||||
(concat (edebug-safe-prin1-to-string result)
|
||||
(eval-expression-print-format result))))))
|
||||
|
||||
(defun edebug-eval-last-sexp (&optional no-truncate)
|
||||
"Evaluate sexp before point in the outside environment.
|
||||
|
|
|
@ -127,8 +127,9 @@ Also add the value to the front of the list in the variable `values'."
|
|||
(interactive
|
||||
(list (read--expression "Eval: ")))
|
||||
(message "Evaluating...")
|
||||
(push (eval expression lexical-binding) values)
|
||||
(pp-display-expression (car values) "*Pp Eval Output*"))
|
||||
(let ((result (eval expression lexical-binding)))
|
||||
(values--store-value result)
|
||||
(pp-display-expression result "*Pp Eval Output*")))
|
||||
|
||||
;;;###autoload
|
||||
(defun pp-macroexpand-expression (expression)
|
||||
|
|
|
@ -1268,9 +1268,8 @@ If `eval-expression-debug-on-error' is non-nil, which is the default,
|
|||
this command arranges for all errors to enter the debugger."
|
||||
(interactive "P")
|
||||
(if (null eval-expression-debug-on-error)
|
||||
(let ((value (elisp--eval-last-sexp eval-last-sexp-arg-internal)))
|
||||
(push value values)
|
||||
value)
|
||||
(values--store-values
|
||||
(elisp--eval-last-sexp eval-last-sexp-arg-internal))
|
||||
(let ((value
|
||||
(let ((debug-on-error elisp--eval-last-sexp-fake-value))
|
||||
(cons (elisp--eval-last-sexp eval-last-sexp-arg-internal)
|
||||
|
|
|
@ -1809,31 +1809,34 @@ this command arranges for all errors to enter the debugger."
|
|||
(cons (read--expression "Eval: ")
|
||||
(eval-expression-get-print-arguments current-prefix-arg)))
|
||||
|
||||
(if (null eval-expression-debug-on-error)
|
||||
(push (eval (let ((lexical-binding t)) (macroexpand-all exp)) t)
|
||||
values)
|
||||
(let ((old-value (make-symbol "t")) new-value)
|
||||
;; Bind debug-on-error to something unique so that we can
|
||||
;; detect when evalled code changes it.
|
||||
(let ((debug-on-error old-value))
|
||||
(push (eval (let ((lexical-binding t)) (macroexpand-all exp)) t)
|
||||
values)
|
||||
(setq new-value debug-on-error))
|
||||
;; If evalled code has changed the value of debug-on-error,
|
||||
;; propagate that change to the global binding.
|
||||
(unless (eq old-value new-value)
|
||||
(setq debug-on-error new-value))))
|
||||
(let (result)
|
||||
(if (null eval-expression-debug-on-error)
|
||||
(setq result
|
||||
(values--store-value
|
||||
(eval (let ((lexical-binding t)) (macroexpand-all exp)) t)))
|
||||
(let ((old-value (make-symbol "t")) new-value)
|
||||
;; Bind debug-on-error to something unique so that we can
|
||||
;; detect when evalled code changes it.
|
||||
(let ((debug-on-error old-value))
|
||||
(setq result
|
||||
(values--store-value
|
||||
(eval (let ((lexical-binding t)) (macroexpand-all exp)) t)))
|
||||
(setq new-value debug-on-error))
|
||||
;; If evalled code has changed the value of debug-on-error,
|
||||
;; propagate that change to the global binding.
|
||||
(unless (eq old-value new-value)
|
||||
(setq debug-on-error new-value))))
|
||||
|
||||
(let ((print-length (unless no-truncate eval-expression-print-length))
|
||||
(print-level (unless no-truncate eval-expression-print-level))
|
||||
(eval-expression-print-maximum-character char-print-limit)
|
||||
(deactivate-mark))
|
||||
(let ((out (if insert-value (current-buffer) t)))
|
||||
(prog1
|
||||
(prin1 (car values) out)
|
||||
(let ((str (and char-print-limit
|
||||
(eval-expression-print-format (car values)))))
|
||||
(when str (princ str out)))))))
|
||||
(let ((print-length (unless no-truncate eval-expression-print-length))
|
||||
(print-level (unless no-truncate eval-expression-print-level))
|
||||
(eval-expression-print-maximum-character char-print-limit)
|
||||
(deactivate-mark))
|
||||
(let ((out (if insert-value (current-buffer) t)))
|
||||
(prog1
|
||||
(prin1 result out)
|
||||
(let ((str (and char-print-limit
|
||||
(eval-expression-print-format result))))
|
||||
(when str (princ str out))))))))
|
||||
|
||||
(defun edit-and-eval-command (prompt command)
|
||||
"Prompting with PROMPT, let user edit COMMAND and eval result.
|
||||
|
|
10
lisp/subr.el
10
lisp/subr.el
|
@ -1655,6 +1655,12 @@ The return value has the form (WIDTH . HEIGHT). POSITION should
|
|||
be a list of the form returned by `event-start' and `event-end'."
|
||||
(nth 9 position))
|
||||
|
||||
(defun values--store-value (value)
|
||||
"Store VALUE in the obsolete `values' variable."
|
||||
(with-suppressed-warnings ((obsolete values))
|
||||
(push value values))
|
||||
value)
|
||||
|
||||
|
||||
;;;; Obsolescent names for functions.
|
||||
|
||||
|
@ -1721,6 +1727,10 @@ be a list of the form returned by `event-start' and `event-end'."
|
|||
(make-obsolete-variable 'load-dangerous-libraries
|
||||
"no longer used." "27.1")
|
||||
|
||||
;; We can't actually make `values' obsolete, because that will result
|
||||
;; in warnings when using `values' in let-bindings.
|
||||
;;(make-obsolete-variable 'values "no longer used" "28.1")
|
||||
|
||||
|
||||
;;;; Alternate names for functions - these are not being phased out.
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue