diff options
| author | Mark Oteiza | 2017-08-08 15:10:49 -0400 |
|---|---|---|
| committer | Mark Oteiza | 2017-08-08 15:10:49 -0400 |
| commit | 63b5a4a65eec5792b985c9d6be68424731bd478d (patch) | |
| tree | bce03c0669c7c7cde230a87b499a63f802720c67 | |
| parent | 884d43b43eb51fe91c657ed0780cf85d31522248 (diff) | |
| download | emacs-63b5a4a65eec5792b985c9d6be68424731bd478d.tar.gz emacs-63b5a4a65eec5792b985c9d6be68424731bd478d.zip | |
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.
| -rw-r--r-- | lisp/calendar/calendar.el | 2 | ||||
| -rw-r--r-- | lisp/desktop.el | 4 | ||||
| -rw-r--r-- | lisp/international/ogonek.el | 9 |
3 files changed, 7 insertions, 8 deletions
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index 84282209ddd..1d6749319d8 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el | |||
| @@ -835,7 +835,7 @@ For examples of three common styles, see `diary-american-date-forms', | |||
| 835 | diary-american-date-forms) | 835 | diary-american-date-forms) |
| 836 | :initialize 'custom-initialize-default | 836 | :initialize 'custom-initialize-default |
| 837 | :set (lambda (symbol value) | 837 | :set (lambda (symbol value) |
| 838 | (unless (equal value (eval symbol)) | 838 | (unless (equal value (default-value symbol)) |
| 839 | (custom-set-default symbol value) | 839 | (custom-set-default symbol value) |
| 840 | (setq diary-font-lock-keywords (diary-font-lock-keywords)) | 840 | (setq diary-font-lock-keywords (diary-font-lock-keywords)) |
| 841 | ;; Need to redraw not just to get new font-locking, but also | 841 | ;; Need to redraw not just to get new font-locking, but also |
diff --git a/lisp/desktop.el b/lisp/desktop.el index 540d0e3b11d..a2260ba490d 100644 --- a/lisp/desktop.el +++ b/lisp/desktop.el | |||
| @@ -709,8 +709,8 @@ if different)." | |||
| 709 | (setq desktop-io-file-version nil) | 709 | (setq desktop-io-file-version nil) |
| 710 | (dolist (var desktop-globals-to-clear) | 710 | (dolist (var desktop-globals-to-clear) |
| 711 | (if (symbolp var) | 711 | (if (symbolp var) |
| 712 | (eval `(setq-default ,var nil)) | 712 | (set-default var nil) |
| 713 | (eval `(setq-default ,(car var) ,(cdr var))))) | 713 | (set-default var (eval (cdr var))))) |
| 714 | (let ((preserve-regexp (concat "^\\(" | 714 | (let ((preserve-regexp (concat "^\\(" |
| 715 | (mapconcat (lambda (regexp) | 715 | (mapconcat (lambda (regexp) |
| 716 | (concat "\\(" regexp "\\)")) | 716 | (concat "\\(" regexp "\\)")) |
diff --git a/lisp/international/ogonek.el b/lisp/international/ogonek.el index ef3a980f19a..cabcf90078a 100644 --- a/lisp/international/ogonek.el +++ b/lisp/international/ogonek.el | |||
| @@ -301,13 +301,12 @@ Store the name in the parameter-variable DEFAULT-NAME-VAR. | |||
| 301 | PROMPT is a string to be shown when the user is asked for a name." | 301 | PROMPT is a string to be shown when the user is asked for a name." |
| 302 | (let ((encoding | 302 | (let ((encoding |
| 303 | (completing-read | 303 | (completing-read |
| 304 | (format "%s (default %s): " prompt (eval default-name-var)) | 304 | (format "%s (default %s): " prompt (symbol-value default-name-var)) |
| 305 | ogonek-name-encoding-alist nil t))) | 305 | ogonek-name-encoding-alist nil t))) |
| 306 | ;; change the default name to the one just read | 306 | ;; change the default name to the one just read, and |
| 307 | (set default-name-var | ||
| 308 | (if (string= encoding "") (eval default-name-var) encoding)) | ||
| 309 | ;; return the new default as the name you read | 307 | ;; return the new default as the name you read |
| 310 | (eval default-name-var))) | 308 | (set default-name-var |
| 309 | (if (string= encoding "") (symbol-value default-name-var) encoding)))) | ||
| 311 | 310 | ||
| 312 | (defun ogonek-read-prefix (prompt default-prefix-var) | 311 | (defun ogonek-read-prefix (prompt default-prefix-var) |
| 313 | "Read a prefix character for prefix notation. | 312 | "Read a prefix character for prefix notation. |