Commit 63b5a4a6 authored by Mark Oteiza's avatar Mark Oteiza

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.
parent 884d43b4
......@@ -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
......
......@@ -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 "\\)"))
......
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment