1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-24 07:20:37 +00:00

Replace some uses of eval

There are a number of places where eval is used unnecessarily to get
or set the value of a symbol.
* lisp/calendar/calendar.el (diary-date-forms): Use default-value in
custom setter.
* lisp/desktop.el (desktop-clear): Use set-default instead.
* lisp/international/ogonek.el (ogonek-read-encoding): Use
symbol-value.
This commit is contained in:
Mark Oteiza 2017-08-08 15:10:49 -04:00
parent 884d43b43e
commit 63b5a4a65e
3 changed files with 7 additions and 8 deletions

View File

@ -835,7 +835,7 @@ For examples of three common styles, see `diary-american-date-forms',
diary-american-date-forms)
:initialize 'custom-initialize-default
:set (lambda (symbol value)
(unless (equal value (eval symbol))
(unless (equal value (default-value symbol))
(custom-set-default symbol value)
(setq diary-font-lock-keywords (diary-font-lock-keywords))
;; Need to redraw not just to get new font-locking, but also

View File

@ -709,8 +709,8 @@ if different)."
(setq desktop-io-file-version nil)
(dolist (var desktop-globals-to-clear)
(if (symbolp var)
(eval `(setq-default ,var nil))
(eval `(setq-default ,(car var) ,(cdr var)))))
(set-default var nil)
(set-default var (eval (cdr var)))))
(let ((preserve-regexp (concat "^\\("
(mapconcat (lambda (regexp)
(concat "\\(" regexp "\\)"))

View File

@ -301,13 +301,12 @@ Store the name in the parameter-variable DEFAULT-NAME-VAR.
PROMPT is a string to be shown when the user is asked for a name."
(let ((encoding
(completing-read
(format "%s (default %s): " prompt (eval default-name-var))
(format "%s (default %s): " prompt (symbol-value default-name-var))
ogonek-name-encoding-alist nil t)))
;; change the default name to the one just read
(set default-name-var
(if (string= encoding "") (eval default-name-var) encoding))
;; change the default name to the one just read, and
;; return the new default as the name you read
(eval default-name-var)))
(set default-name-var
(if (string= encoding "") (symbol-value default-name-var) encoding))))
(defun ogonek-read-prefix (prompt default-prefix-var)
"Read a prefix character for prefix notation.