diff options
author | Yuuki Harano <masm+github@masm11.me> | 2021-12-06 00:37:01 +0900 |
---|---|---|
committer | Yuuki Harano <masm+github@masm11.me> | 2021-12-06 00:37:01 +0900 |
commit | e5f74cecf132eb266abbaf7483bd793f45cc370f (patch) | |
tree | 5c58e97632e36aa3bf6e7133c4bcc1e57e33afce /lisp/emacs-lisp | |
parent | 6d7a1123b44ecc4b0f5f356df1eaea0b74e1e855 (diff) | |
parent | 622550f7187f5ec9261a0d30b5ee6f440069a1e0 (diff) | |
download | emacs-e5f74cecf132eb266abbaf7483bd793f45cc370f.tar.gz emacs-e5f74cecf132eb266abbaf7483bd793f45cc370f.tar.bz2 emacs-e5f74cecf132eb266abbaf7483bd793f45cc370f.zip |
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs into feature/pgtk
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/edebug.el | 2 | ||||
-rw-r--r-- | lisp/emacs-lisp/eieio-core.el | 19 | ||||
-rw-r--r-- | lisp/emacs-lisp/package.el | 18 |
3 files changed, 24 insertions, 15 deletions
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index a38c8bd5ca9..ac1cd22ac27 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -469,7 +469,7 @@ just FUNCTION is printed." (funcall orig-fun nil))) (defun edebug-eval-defun (edebug-it) - (declare (obsolete "use eval-defun or edebug--eval-defun instead" "28.1")) + (declare (obsolete "use `eval-defun' or `edebug--eval-defun' instead" "28.1")) (interactive "P") (if (advice-member-p #'edebug--eval-defun 'eval-defun) (eval-defun edebug-it) diff --git a/lisp/emacs-lisp/eieio-core.el b/lisp/emacs-lisp/eieio-core.el index 7c5babcf54c..ca47ec77f76 100644 --- a/lisp/emacs-lisp/eieio-core.el +++ b/lisp/emacs-lisp/eieio-core.el @@ -450,7 +450,7 @@ See `defclass' for more information." )) ;; Now that everything has been loaded up, all our lists are backwards! - ;; Fix that up now and then them into vectors. + ;; Fix that up now and turn them into vectors. (cl-callf (lambda (slots) (apply #'vector (nreverse slots))) (eieio--class-slots newc)) (cl-callf nreverse (eieio--class-initarg-tuples newc)) @@ -704,11 +704,15 @@ an error." nil ;; Trim off object IDX junk added in for the object index. (setq slot-idx (- slot-idx (eval-when-compile eieio--object-num-slots))) - (let ((st (cl--slot-descriptor-type (aref (eieio--class-slots class) - slot-idx)))) - (if (not (eieio--perform-slot-validation st value)) - (signal 'invalid-slot-type - (list (eieio--class-name class) slot st value)))))) + (let* ((sd (aref (eieio--class-slots class) + slot-idx)) + (st (cl--slot-descriptor-type sd))) + (cond + ((not (eieio--perform-slot-validation st value)) + (signal 'invalid-slot-type + (list (eieio--class-name class) slot st value))) + ((alist-get :read-only (cl--slot-descriptor-props sd)) + (signal 'eieio-read-only (list (eieio--class-name class) slot))))))) (defun eieio--validate-class-slot-value (class slot-idx value slot) "Make sure that for CLASS referencing SLOT-IDX, VALUE is valid. @@ -813,7 +817,7 @@ Fills in CLASS's SLOT with its default value." (defun eieio-oset (obj slot value) "Do the work for the macro `oset'. Fills in OBJ's SLOT with VALUE." - (cl-check-type obj eieio-object) + (cl-check-type obj (or eieio-object cl-structure-object)) (cl-check-type slot symbol) (let* ((class (eieio--object-class obj)) (c (eieio--slot-name-index class slot))) @@ -1063,6 +1067,7 @@ method invocation orders of the involved classes." ;; (define-error 'invalid-slot-name "Invalid slot name") (define-error 'invalid-slot-type "Invalid slot type") +(define-error 'eieio-read-only "Read-only slot") (define-error 'unbound-slot "Unbound slot") (define-error 'inconsistent-class-hierarchy "Inconsistent class hierarchy") diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 08dfe504d27..66bbd631a72 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1181,13 +1181,17 @@ The return result is a `package-desc'." info) (while files (with-temp-buffer - (insert-file-contents (pop files)) - ;; When we find the file with the data, - (when (setq info (ignore-errors (package-buffer-info))) - ;; stop looping, - (setq files nil) - ;; set the 'dir kind, - (setf (package-desc-kind info) 'dir)))) + (let ((file (pop files))) + ;; The file may be a link to a nonexistent file; e.g., a + ;; lock file. + (when (file-exists-p file) + (insert-file-contents file) + ;; When we find the file with the data, + (when (setq info (ignore-errors (package-buffer-info))) + ;; stop looping, + (setq files nil) + ;; set the 'dir kind, + (setf (package-desc-kind info) 'dir)))))) (unless info (error "No .el files with package headers in `%s'" default-directory)) ;; and return the info. |