diff options
| author | Stefan Monnier | 2015-02-16 01:37:57 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2015-02-16 01:37:57 -0500 |
| commit | 6bf61df8ab359f1371ab2e3e278bc8642d65a985 (patch) | |
| tree | 024fb64c5f0882fe527fe389e8adaf3341c54b20 | |
| parent | e59feb3c15ca1dfb7a2a7edef21cbdb07d6ea183 (diff) | |
| download | emacs-6bf61df8ab359f1371ab2e3e278bc8642d65a985.tar.gz emacs-6bf61df8ab359f1371ab2e3e278bc8642d65a985.zip | |
* lisp/emacs-lisp/cl-macs.el (cl-defstruct): Keep type=nil by default.
* lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Add sanity checks
about relationship between `type', `named', and `slots'.
* lisp/emacs-lisp/cl-generic.el (cl--generic-struct-tagcode): Adjust to new
value of `cl-struct-type' property.
| -rw-r--r-- | lisp/ChangeLog | 12 | ||||
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 14 | ||||
| -rw-r--r-- | lisp/emacs-lisp/cl-generic.el | 4 | ||||
| -rw-r--r-- | lisp/emacs-lisp/cl-macs.el | 8 | ||||
| -rw-r--r-- | lisp/emacs-lisp/cl-preloaded.el | 4 |
5 files changed, 27 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ca180ff6327..bb8c97badf7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2015-02-16 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * emacs-lisp/cl-macs.el (cl-defstruct): Keep type=nil by default. | ||
| 4 | * emacs-lisp/cl-preloaded.el (cl-struct-define): Add sanity checks | ||
| 5 | about relationship between `type', `named', and `slots'. | ||
| 6 | * emacs-lisp/cl-generic.el (cl--generic-struct-tagcode): Adjust to new | ||
| 7 | value of `cl-struct-type' property. | ||
| 8 | |||
| 1 | 2015-02-15 Jérémy Compostella <jeremy.compostella@gmail.com> | 9 | 2015-02-15 Jérémy Compostella <jeremy.compostella@gmail.com> |
| 2 | 10 | ||
| 3 | * net/tramp-sh.el (tramp-remote-process-environment): Disable paging | 11 | * net/tramp-sh.el (tramp-remote-process-environment): Disable paging |
| @@ -5,8 +13,8 @@ | |||
| 5 | 13 | ||
| 6 | 2015-02-14 Artur Malabarba <bruce.connor.am@gmail.com> | 14 | 2015-02-14 Artur Malabarba <bruce.connor.am@gmail.com> |
| 7 | 15 | ||
| 8 | * emacs-lisp/package.el (package-read-all-archive-contents): Don't | 16 | * emacs-lisp/package.el (package-read-all-archive-contents): |
| 9 | build the compatibility table. | 17 | Don't build the compatibility table. |
| 10 | (package-refresh-contents, package-initialize): Do build the | 18 | (package-refresh-contents, package-initialize): Do build the |
| 11 | compatibility table. | 19 | compatibility table. |
| 12 | (package--build-compatibility-table): New function. | 20 | (package--build-compatibility-table): New function. |
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 548aaa9626b..e929c02eefb 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el | |||
| @@ -1353,13 +1353,13 @@ extra args." | |||
| 1353 | (let ((keyword-args (cdr (cdr (cdr (cdr form))))) | 1353 | (let ((keyword-args (cdr (cdr (cdr (cdr form))))) |
| 1354 | (name (cadr form))) | 1354 | (name (cadr form))) |
| 1355 | (or (not (eq (car-safe name) 'quote)) | 1355 | (or (not (eq (car-safe name) 'quote)) |
| 1356 | (and (eq (car form) 'custom-declare-group) | 1356 | (and (eq (car form) 'custom-declare-group) |
| 1357 | (equal name ''emacs)) | 1357 | (equal name ''emacs)) |
| 1358 | (plist-get keyword-args :group) | 1358 | (plist-get keyword-args :group) |
| 1359 | (not (and (consp name) (eq (car name) 'quote))) | 1359 | (not (and (consp name) (eq (car name) 'quote))) |
| 1360 | (byte-compile-warn | 1360 | (byte-compile-warn |
| 1361 | "%s for `%s' fails to specify containing group" | 1361 | "%s for `%s' fails to specify containing group" |
| 1362 | (cdr (assq (car form) | 1362 | (cdr (assq (car form) |
| 1363 | '((custom-declare-group . defgroup) | 1363 | '((custom-declare-group . defgroup) |
| 1364 | (custom-declare-face . defface) | 1364 | (custom-declare-face . defface) |
| 1365 | (custom-declare-variable . defcustom)))) | 1365 | (custom-declare-variable . defcustom)))) |
diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el index c4232863cfc..ccd5bec5685 100644 --- a/lisp/emacs-lisp/cl-generic.el +++ b/lisp/emacs-lisp/cl-generic.el | |||
| @@ -731,7 +731,7 @@ Can only be used from within the lexical body of a primary or around method." | |||
| 731 | (defun cl--generic-struct-tagcode (type name) | 731 | (defun cl--generic-struct-tagcode (type name) |
| 732 | (and (symbolp type) | 732 | (and (symbolp type) |
| 733 | (get type 'cl-struct-type) | 733 | (get type 'cl-struct-type) |
| 734 | (or (eq 'vector (car (get type 'cl-struct-type))) | 734 | (or (null (car (get type 'cl-struct-type))) |
| 735 | (error "Can't dispatch on cl-struct %S: type is %S" | 735 | (error "Can't dispatch on cl-struct %S: type is %S" |
| 736 | type (car (get type 'cl-struct-type)))) | 736 | type (car (get type 'cl-struct-type)))) |
| 737 | (or (equal '(cl-tag-slot) (car (get type 'cl-struct-slots))) | 737 | (or (equal '(cl-tag-slot) (car (get type 'cl-struct-slots))) |
| @@ -761,7 +761,7 @@ Can only be used from within the lexical body of a primary or around method." | |||
| 761 | (let ((types (list (intern (substring (symbol-name tag) 10))))) | 761 | (let ((types (list (intern (substring (symbol-name tag) 10))))) |
| 762 | (while (get (car types) 'cl-struct-include) | 762 | (while (get (car types) 'cl-struct-include) |
| 763 | (push (get (car types) 'cl-struct-include) types)) | 763 | (push (get (car types) 'cl-struct-include) types)) |
| 764 | (push 'cl-struct types) ;The "parent type" of all cl-structs. | 764 | (push 'cl-structure-object types) ;The "parent type" of all cl-structs. |
| 765 | (nreverse types)))) | 765 | (nreverse types)))) |
| 766 | 766 | ||
| 767 | ;;; Dispatch on "system types". | 767 | ;;; Dispatch on "system types". |
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 2861d669697..caaf7687dc8 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el | |||
| @@ -2494,7 +2494,7 @@ non-nil value, that slot cannot be set via `setf'. | |||
| 2494 | (or (memq type '(vector list)) | 2494 | (or (memq type '(vector list)) |
| 2495 | (error "Invalid :type specifier: %s" type)) | 2495 | (error "Invalid :type specifier: %s" type)) |
| 2496 | (if named (setq tag name))) | 2496 | (if named (setq tag name))) |
| 2497 | (setq type 'vector named 'true))) | 2497 | (setq named 'true))) |
| 2498 | (or named (setq descs (delq (assq 'cl-tag-slot descs) descs))) | 2498 | (or named (setq descs (delq (assq 'cl-tag-slot descs) descs))) |
| 2499 | (when (and (null predicate) named) | 2499 | (when (and (null predicate) named) |
| 2500 | (setq predicate (intern (format "cl--struct-%s-p" name)))) | 2500 | (setq predicate (intern (format "cl--struct-%s-p" name)))) |
| @@ -2503,7 +2503,7 @@ non-nil value, that slot cannot be set via `setf'. | |||
| 2503 | (length (memq (assq 'cl-tag-slot descs) | 2503 | (length (memq (assq 'cl-tag-slot descs) |
| 2504 | descs))))) | 2504 | descs))))) |
| 2505 | (cond | 2505 | (cond |
| 2506 | ((eq type 'vector) | 2506 | ((memq type '(nil vector)) |
| 2507 | `(and (vectorp cl-x) | 2507 | `(and (vectorp cl-x) |
| 2508 | (>= (length cl-x) ,(length descs)) | 2508 | (>= (length cl-x) ,(length descs)) |
| 2509 | (memq (aref cl-x ,pos) ,tag-symbol))) | 2509 | (memq (aref cl-x ,pos) ,tag-symbol))) |
| @@ -2535,7 +2535,7 @@ non-nil value, that slot cannot be set via `setf'. | |||
| 2535 | (list `(or ,pred-check | 2535 | (list `(or ,pred-check |
| 2536 | (error "%s accessing a non-%s" | 2536 | (error "%s accessing a non-%s" |
| 2537 | ',accessor ',name)))) | 2537 | ',accessor ',name)))) |
| 2538 | ,(if (eq type 'vector) `(aref cl-x ,pos) | 2538 | ,(if (memq type '(nil vector)) `(aref cl-x ,pos) |
| 2539 | (if (= pos 0) '(car cl-x) | 2539 | (if (= pos 0) '(car cl-x) |
| 2540 | `(nth ,pos cl-x)))) | 2540 | `(nth ,pos cl-x)))) |
| 2541 | forms) | 2541 | forms) |
| @@ -2593,7 +2593,7 @@ non-nil value, that slot cannot be set via `setf'. | |||
| 2593 | (&cl-defs '(nil ,@descs) ,@args) | 2593 | (&cl-defs '(nil ,@descs) ,@args) |
| 2594 | ,@(if (cl--safe-expr-p `(progn ,@(mapcar #'cl-second descs))) | 2594 | ,@(if (cl--safe-expr-p `(progn ,@(mapcar #'cl-second descs))) |
| 2595 | '((declare (side-effect-free t)))) | 2595 | '((declare (side-effect-free t)))) |
| 2596 | (,type ,@make)) | 2596 | (,(or type #'vector) ,@make)) |
| 2597 | forms))) | 2597 | forms))) |
| 2598 | (if print-auto (nconc print-func (list '(princ ")" cl-s) t))) | 2598 | (if print-auto (nconc print-func (list '(princ ")" cl-s) t))) |
| 2599 | ;; Don't bother adding to cl-custom-print-functions since it's not used | 2599 | ;; Don't bother adding to cl-custom-print-functions since it's not used |
diff --git a/lisp/emacs-lisp/cl-preloaded.el b/lisp/emacs-lisp/cl-preloaded.el index 03045de509a..401d34b449e 100644 --- a/lisp/emacs-lisp/cl-preloaded.el +++ b/lisp/emacs-lisp/cl-preloaded.el | |||
| @@ -28,8 +28,12 @@ | |||
| 28 | 28 | ||
| 29 | ;;; Code: | 29 | ;;; Code: |
| 30 | 30 | ||
| 31 | (eval-when-compile (require 'cl-lib)) | ||
| 32 | |||
| 31 | (defun cl-struct-define (name docstring parent type named slots children-sym | 33 | (defun cl-struct-define (name docstring parent type named slots children-sym |
| 32 | tag print-auto) | 34 | tag print-auto) |
| 35 | (cl-assert (or type (equal '(cl-tag-slot) (car slots)))) | ||
| 36 | (cl-assert (or type (not named))) | ||
| 33 | (if (boundp children-sym) | 37 | (if (boundp children-sym) |
| 34 | (add-to-list children-sym tag) | 38 | (add-to-list children-sym tag) |
| 35 | (set children-sym (list tag))) | 39 | (set children-sym (list tag))) |