diff options
| author | Joakim Verona | 2015-01-20 00:54:09 +0100 |
|---|---|---|
| committer | Joakim Verona | 2015-01-20 00:54:09 +0100 |
| commit | fee879f0a00bbe3f3389509874ee30a9cbc24cd4 (patch) | |
| tree | 5bc4dc325818bec8a6a4cf20b1c907d23e24425a | |
| parent | 395a90fee92a836f55df0b879f8ee3d862d648ac (diff) | |
| parent | fb6462f056f616f3da8ae18037c7c2137fecb6fd (diff) | |
| download | emacs-fee879f0a00bbe3f3389509874ee30a9cbc24cd4.tar.gz emacs-fee879f0a00bbe3f3389509874ee30a9cbc24cd4.zip | |
Merge branch 'master' into xwidget
| -rw-r--r-- | etc/NEWS | 2 | ||||
| -rw-r--r-- | lisp/ChangeLog | 79 | ||||
| -rw-r--r-- | lisp/cus-dep.el | 3 | ||||
| -rw-r--r-- | lisp/emacs-lisp/cl-generic.el | 27 | ||||
| -rw-r--r-- | lisp/emacs-lisp/eieio-core.el | 25 | ||||
| -rw-r--r-- | lisp/emacs-lisp/eieio-generic.el | 2 | ||||
| -rw-r--r-- | lisp/emacs-lisp/eieio.el | 11 | ||||
| -rw-r--r-- | lisp/emacs-lisp/package.el | 14 | ||||
| -rw-r--r-- | lisp/ido.el | 233 | ||||
| -rw-r--r-- | lisp/progmodes/xref.el | 56 | ||||
| -rw-r--r-- | src/ChangeLog | 36 | ||||
| -rw-r--r-- | src/alloc.c | 6 | ||||
| -rw-r--r-- | src/callint.c | 10 | ||||
| -rw-r--r-- | src/coding.c | 9 | ||||
| -rw-r--r-- | src/dispnew.c | 12 | ||||
| -rw-r--r-- | src/eval.c | 11 | ||||
| -rw-r--r-- | src/fileio.c | 17 | ||||
| -rw-r--r-- | src/fns.c | 13 | ||||
| -rw-r--r-- | src/font.c | 7 | ||||
| -rw-r--r-- | src/fringe.c | 7 | ||||
| -rw-r--r-- | src/lisp.h | 24 | ||||
| -rw-r--r-- | src/xdisp.c | 3 | ||||
| -rw-r--r-- | test/ChangeLog | 13 | ||||
| -rw-r--r-- | test/automated/Makefile.in | 4 | ||||
| -rw-r--r-- | test/automated/cl-generic-tests.el | 31 | ||||
| -rw-r--r-- | test/automated/eieio-test-methodinvoke.el | 7 |
26 files changed, 442 insertions, 220 deletions
| @@ -203,6 +203,8 @@ the old behavior -- *shell* buffer displays in current window -- use | |||
| 203 | 203 | ||
| 204 | ** EIEIO | 204 | ** EIEIO |
| 205 | *** The `:protection' slot option is not obeyed any more. | 205 | *** The `:protection' slot option is not obeyed any more. |
| 206 | *** The `newname' argument to constructors is optional&deprecated. | ||
| 207 | If you need your objects to be named, do it by inheriting from `eieio-named'. | ||
| 206 | *** The <class>-list-p and <class>-child-p functions are declared obsolete. | 208 | *** The <class>-list-p and <class>-child-p functions are declared obsolete. |
| 207 | *** The <class> variables are declared obsolete. | 209 | *** The <class> variables are declared obsolete. |
| 208 | *** The <initarg> variables are declared obsolete. | 210 | *** The <initarg> variables are declared obsolete. |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 680adc71d0a..b1a3a73864c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,74 @@ | |||
| 1 | 2015-01-19 Dmitry Gutov <dgutov@yandex.ru> | ||
| 2 | |||
| 3 | * ido.el: Update Customization instructions. | ||
| 4 | |||
| 5 | 2015-01-19 Jonas Bernoulli <jonas@bernoul.li> | ||
| 6 | |||
| 7 | Define Ido keymaps once (bug#17000). | ||
| 8 | * ido.el (ido-common-completion-map) | ||
| 9 | (ido-file-dir-completion-map) | ||
| 10 | (ido-file-completion-map, ido-buffer-completion-map): Set up key | ||
| 11 | bindings when each variable is defined. | ||
| 12 | (ido-completion-map): Move definition. | ||
| 13 | (ido-init-completion-maps): Noop. | ||
| 14 | (ido-common-initialization): Don't call it. | ||
| 15 | (ido-setup-completion-map): Improve doc-string, cleanup. | ||
| 16 | |||
| 17 | 2015-01-19 Ivan Shmakov <ivan@siamics.net> | ||
| 18 | |||
| 19 | * cus-dep.el (custom-make-dependencies): Ensure that | ||
| 20 | default-directory is interpreted as a directory (see bug#19140.) | ||
| 21 | |||
| 22 | 2015-01-19 Dmitry Gutov <dgutov@yandex.ru> | ||
| 23 | |||
| 24 | * progmodes/xref.el (xref--display-position): | ||
| 25 | Set `other-window-scroll-buffer'. | ||
| 26 | (xref-goto-xref): Use `user-error'. | ||
| 27 | |||
| 28 | 2015-01-19 Dmitry Gutov <dgutov@yandex.ru> | ||
| 29 | |||
| 30 | * progmodes/xref.el (xref--display-history): New variable. | ||
| 31 | (xref--window-configuration): Remove. | ||
| 32 | (xref--save-to-history): New function. | ||
| 33 | (xref--display-position): Use it. Add new argument. | ||
| 34 | (xref--restore-window-configuration): Remove. | ||
| 35 | (xref--show-location, xref-show-location-at-point): Update | ||
| 36 | accordingly. | ||
| 37 | (xref--xref-buffer-mode): Don't use `pre-command-hook'. | ||
| 38 | (xref--quit): New command. | ||
| 39 | (xref-goto-xref): Use it. | ||
| 40 | (xref--xref-buffer-mode-map): Bind `q' to it. | ||
| 41 | |||
| 42 | 2015-01-18 Dmitry Gutov <dgutov@yandex.ru> | ||
| 43 | |||
| 44 | * progmodes/xref.el (xref-goto-xref): Perform the jump even inside | ||
| 45 | indentation or at eol. | ||
| 46 | |||
| 47 | 2015-01-18 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 48 | |||
| 49 | * emacs-lisp/eieio-core.el: Add `subclass' specializer for cl-generic. | ||
| 50 | (eieio--generic-subclass-tagcode, eieio--generic-subclass-tag-types): | ||
| 51 | New functions. | ||
| 52 | (cl-generic-tagcode-function, cl-generic-tag-types-function): Use them. | ||
| 53 | |||
| 54 | * emacs-lisp/eieio.el (defclass): Add obsolescence warning for the | ||
| 55 | `newname' argument. | ||
| 56 | |||
| 57 | * emacs-lisp/cl-generic.el (cl-generic-define-method): Correctly handle | ||
| 58 | introduction of a new dispatch argument. | ||
| 59 | (cl--generic-cache-miss): Handle dispatch on an argument which was not | ||
| 60 | considered as dispatchable for this method. | ||
| 61 | (cl-defmethod): Warn when adding a method to an obsolete generic function. | ||
| 62 | (cl--generic-lambda): Make sure it works if cl-lib is not yet loaded. | ||
| 63 | |||
| 64 | * emacs-lisp/eieio-generic.el (eieio--defgeneric-init-form): Use autoloadp. | ||
| 65 | |||
| 66 | 2015-01-18 Artur Malabarba <bruce.connor.am@gmail.com> | ||
| 67 | |||
| 68 | * emacs-lisp/package.el (package--append-to-alist): Rename from | ||
| 69 | `package--add-to-alist' | ||
| 70 | Updated docstring due to new name. | ||
| 71 | |||
| 1 | 2015-01-18 Leo Liu <sdl.web@gmail.com> | 72 | 2015-01-18 Leo Liu <sdl.web@gmail.com> |
| 2 | 73 | ||
| 3 | * emacs-lisp/cl-extra.el (cl-subseq): Use seq-subseq and fix | 74 | * emacs-lisp/cl-extra.el (cl-subseq): Use seq-subseq and fix |
| @@ -132,8 +203,8 @@ | |||
| 132 | 2015-01-16 Artur Malabarba <bruce.connor.am@gmail.com> | 203 | 2015-01-16 Artur Malabarba <bruce.connor.am@gmail.com> |
| 133 | 204 | ||
| 134 | * emacs-lisp/package.el (package--read-pkg-desc): | 205 | * emacs-lisp/package.el (package--read-pkg-desc): |
| 135 | New function. Read a `define-package' form in current buffer. Return | 206 | New function. Read a `define-package' form in current buffer. |
| 136 | the pkg-desc, with desc-kind set to KIND. | 207 | Return the pkg-desc, with desc-kind set to KIND. |
| 137 | (package-dir-info): New function. Find package information for a | 208 | (package-dir-info): New function. Find package information for a |
| 138 | directory. The return result is a `package-desc'. | 209 | directory. The return result is a `package-desc'. |
| 139 | (package-install-from-buffer): Install packages from dired buffer. | 210 | (package-install-from-buffer): Install packages from dired buffer. |
| @@ -856,8 +927,8 @@ | |||
| 856 | 2014-12-27 Eli Zaretskii <eliz@gnu.org> | 927 | 2014-12-27 Eli Zaretskii <eliz@gnu.org> |
| 857 | 928 | ||
| 858 | * language/misc-lang.el (composition-function-table): Add Syriac | 929 | * language/misc-lang.el (composition-function-table): Add Syriac |
| 859 | characters and also ZWJ/ZWNJ. See | 930 | characters and also ZWJ/ZWNJ. |
| 860 | http://lists.gnu.org/archive/html/help-gnu-emacs/2014-12/msg00248.html | 931 | See http://lists.gnu.org/archive/html/help-gnu-emacs/2014-12/msg00248.html |
| 861 | for the details. | 932 | for the details. |
| 862 | 933 | ||
| 863 | 2014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org> | 934 | 2014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org> |
diff --git a/lisp/cus-dep.el b/lisp/cus-dep.el index 453b15ddcea..b8a9eb82655 100644 --- a/lisp/cus-dep.el +++ b/lisp/cus-dep.el | |||
| @@ -62,7 +62,8 @@ Usage: emacs -batch -l ./cus-dep.el -f custom-make-dependencies DIRS" | |||
| 62 | (while (setq subdir (pop command-line-args-left)) | 62 | (while (setq subdir (pop command-line-args-left)) |
| 63 | (message "Directory %s" subdir) | 63 | (message "Directory %s" subdir) |
| 64 | (let ((files (directory-files subdir nil "\\`[^=.].*\\.el\\'")) | 64 | (let ((files (directory-files subdir nil "\\`[^=.].*\\.el\\'")) |
| 65 | (default-directory (expand-file-name subdir)) | 65 | (default-directory |
| 66 | (file-name-as-directory (expand-file-name subdir))) | ||
| 66 | (preloaded (concat "\\`\\(\\./+\\)?" | 67 | (preloaded (concat "\\`\\(\\./+\\)?" |
| 67 | (regexp-opt preloaded-file-list t) | 68 | (regexp-opt preloaded-file-list t) |
| 68 | "\\.el\\'"))) | 69 | "\\.el\\'"))) |
diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el index 819e2e92888..544f1fa140f 100644 --- a/lisp/emacs-lisp/cl-generic.el +++ b/lisp/emacs-lisp/cl-generic.el | |||
| @@ -212,13 +212,13 @@ This macro can only be used within the lexical scope of a cl-generic method." | |||
| 212 | (macroenv (cons `(cl-generic-current-method-specializers | 212 | (macroenv (cons `(cl-generic-current-method-specializers |
| 213 | . ,(lambda () specializers)) | 213 | . ,(lambda () specializers)) |
| 214 | macroexpand-all-environment))) | 214 | macroexpand-all-environment))) |
| 215 | (require 'cl-lib) ;Needed to expand `cl-flet' and `cl-function'. | ||
| 215 | (if (not with-cnm) | 216 | (if (not with-cnm) |
| 216 | (cons nil (macroexpand-all fun macroenv)) | 217 | (cons nil (macroexpand-all fun macroenv)) |
| 217 | ;; First macroexpand away the cl-function stuff (e.g. &key and | 218 | ;; First macroexpand away the cl-function stuff (e.g. &key and |
| 218 | ;; destructuring args, `declare' and whatnot). | 219 | ;; destructuring args, `declare' and whatnot). |
| 219 | (pcase (macroexpand fun macroenv) | 220 | (pcase (macroexpand fun macroenv) |
| 220 | (`#'(lambda ,args . ,body) | 221 | (`#'(lambda ,args . ,body) |
| 221 | (require 'cl-lib) ;Needed to expand `cl-flet'. | ||
| 222 | (let* ((doc-string (and doc-string (stringp (car body)) | 222 | (let* ((doc-string (and doc-string (stringp (car body)) |
| 223 | (pop body))) | 223 | (pop body))) |
| 224 | (cnm (make-symbol "cl--cnm")) | 224 | (cnm (make-symbol "cl--cnm")) |
| @@ -287,6 +287,13 @@ which case this method will be invoked when the argument is `eql' to VAL. | |||
| 287 | (cadr name)))) | 287 | (cadr name)))) |
| 288 | (setq name setter) | 288 | (setq name setter) |
| 289 | code)) | 289 | code)) |
| 290 | ,(and (get name 'byte-obsolete-info) | ||
| 291 | (or (not (fboundp 'byte-compile-warning-enabled-p)) | ||
| 292 | (byte-compile-warning-enabled-p 'obsolete)) | ||
| 293 | (let* ((obsolete (get name 'byte-obsolete-info))) | ||
| 294 | (macroexp--warn-and-return | ||
| 295 | (macroexp--obsolete-warning name obsolete "generic function") | ||
| 296 | nil))) | ||
| 290 | (cl-generic-define-method ',name ',qualifiers ',args | 297 | (cl-generic-define-method ',name ',qualifiers ',args |
| 291 | ,uses-cnm ,fun))))) | 298 | ,uses-cnm ,fun))))) |
| 292 | 299 | ||
| @@ -308,13 +315,14 @@ which case this method will be invoked when the argument is `eql' to VAL. | |||
| 308 | (dolist (specializer specializers) | 315 | (dolist (specializer specializers) |
| 309 | (let* ((tagcode (funcall cl-generic-tagcode-function specializer 'arg)) | 316 | (let* ((tagcode (funcall cl-generic-tagcode-function specializer 'arg)) |
| 310 | (x (assq i dispatches))) | 317 | (x (assq i dispatches))) |
| 311 | (if (not x) | 318 | (unless x |
| 312 | (setf (cl--generic-dispatches generic) | 319 | (setq x (list i (funcall cl-generic-tagcode-function t 'arg))) |
| 313 | (setq dispatches (cons (list i tagcode) dispatches))) | 320 | (setf (cl--generic-dispatches generic) |
| 314 | (unless (member tagcode (cdr x)) | 321 | (setq dispatches (cons x dispatches)))) |
| 315 | (setf (cdr x) | 322 | (unless (member tagcode (cdr x)) |
| 316 | (nreverse (sort (cons tagcode (cdr x)) | 323 | (setf (cdr x) |
| 317 | #'car-less-than-car))))) | 324 | (nreverse (sort (cons tagcode (cdr x)) |
| 325 | #'car-less-than-car)))) | ||
| 318 | (setq i (1+ i)))) | 326 | (setq i (1+ i)))) |
| 319 | (if me (setcdr me (cons uses-cnm function)) | 327 | (if me (setcdr me (cons uses-cnm function)) |
| 320 | (setf (cl--generic-method-table generic) | 328 | (setf (cl--generic-method-table generic) |
| @@ -478,7 +486,8 @@ for all those different tags in the method-cache.") | |||
| 478 | (let ((types (apply #'append (mapcar cl-generic-tag-types-function tags))) | 486 | (let ((types (apply #'append (mapcar cl-generic-tag-types-function tags))) |
| 479 | (methods '())) | 487 | (methods '())) |
| 480 | (dolist (method-desc (cl--generic-method-table generic)) | 488 | (dolist (method-desc (cl--generic-method-table generic)) |
| 481 | (let ((m (member (nth dispatch-arg (caar method-desc)) types))) | 489 | (let* ((specializer (or (nth dispatch-arg (caar method-desc)) t)) |
| 490 | (m (member specializer types))) | ||
| 482 | (when m | 491 | (when m |
| 483 | (push (cons (length m) method-desc) methods)))) | 492 | (push (cons (length m) method-desc) methods)))) |
| 484 | ;; Sort the methods, most specific first. | 493 | ;; Sort the methods, most specific first. |
diff --git a/lisp/emacs-lisp/eieio-core.el b/lisp/emacs-lisp/eieio-core.el index a82e887fa0c..e4221e48fe2 100644 --- a/lisp/emacs-lisp/eieio-core.el +++ b/lisp/emacs-lisp/eieio-core.el | |||
| @@ -1227,6 +1227,8 @@ method invocation orders of the involved classes." | |||
| 1227 | 1227 | ||
| 1228 | (require 'cl-generic) | 1228 | (require 'cl-generic) |
| 1229 | 1229 | ||
| 1230 | ;;;; General support to dispatch based on the type of the argument. | ||
| 1231 | |||
| 1230 | (add-function :before-until cl-generic-tagcode-function | 1232 | (add-function :before-until cl-generic-tagcode-function |
| 1231 | #'eieio--generic-tagcode) | 1233 | #'eieio--generic-tagcode) |
| 1232 | (defun eieio--generic-tagcode (type name) | 1234 | (defun eieio--generic-tagcode (type name) |
| @@ -1246,6 +1248,29 @@ method invocation orders of the involved classes." | |||
| 1246 | (mapcar #'eieio--class-symbol | 1248 | (mapcar #'eieio--class-symbol |
| 1247 | (eieio--class-precedence-list (symbol-value tag))))) | 1249 | (eieio--class-precedence-list (symbol-value tag))))) |
| 1248 | 1250 | ||
| 1251 | ;;;; Dispatch for arguments which are classes. | ||
| 1252 | |||
| 1253 | ;; Since EIEIO does not support metaclasses, users can't easily use the | ||
| 1254 | ;; "dispatch on argument type" for class arguments. That's why EIEIO's | ||
| 1255 | ;; `defmethod' added the :static qualifier. For cl-generic, such a qualifier | ||
| 1256 | ;; would not make much sense (e.g. to which argument should it apply?). | ||
| 1257 | ;; Instead, we add a new "subclass" specializer. | ||
| 1258 | |||
| 1259 | (add-function :before-until cl-generic-tagcode-function | ||
| 1260 | #'eieio--generic-subclass-tagcode) | ||
| 1261 | (defun eieio--generic-subclass-tagcode (type name) | ||
| 1262 | (when (eq 'subclass (car-safe type)) | ||
| 1263 | `(60 . (and (symbolp ,name) (eieio--class-v ,name))))) | ||
| 1264 | |||
| 1265 | (add-function :before-until cl-generic-tag-types-function | ||
| 1266 | #'eieio--generic-subclass-tag-types) | ||
| 1267 | (defun eieio--generic-subclass-tag-types (tag) | ||
| 1268 | (when (eieio--class-p tag) | ||
| 1269 | (mapcar (lambda (class) | ||
| 1270 | `(subclass | ||
| 1271 | ,(if (symbolp class) class (eieio--class-symbol class)))) | ||
| 1272 | (eieio--class-precedence-list tag)))) | ||
| 1273 | |||
| 1249 | ;;; Backward compatibility functions | 1274 | ;;; Backward compatibility functions |
| 1250 | ;; To support .elc files compiled for older versions of EIEIO. | 1275 | ;; To support .elc files compiled for older versions of EIEIO. |
| 1251 | 1276 | ||
diff --git a/lisp/emacs-lisp/eieio-generic.el b/lisp/emacs-lisp/eieio-generic.el index 27a58493905..74ecefe7863 100644 --- a/lisp/emacs-lisp/eieio-generic.el +++ b/lisp/emacs-lisp/eieio-generic.el | |||
| @@ -110,7 +110,7 @@ Methods with only primary implementations are executed in an optimized way." | |||
| 110 | 110 | ||
| 111 | (cond | 111 | (cond |
| 112 | ((or (not (fboundp method)) | 112 | ((or (not (fboundp method)) |
| 113 | (eq 'autoload (car-safe (symbol-function method)))) | 113 | (autoloadp (symbol-function method))) |
| 114 | ;; Make sure the method tables are installed. | 114 | ;; Make sure the method tables are installed. |
| 115 | (eieio--mt-install method) | 115 | (eieio--mt-install method) |
| 116 | ;; Construct the actual body of this function. | 116 | ;; Construct the actual body of this function. |
diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el index c5597b83170..0c85d90151a 100644 --- a/lisp/emacs-lisp/eieio.el +++ b/lisp/emacs-lisp/eieio.el | |||
| @@ -276,6 +276,17 @@ and reference them using the function `class-option'." | |||
| 276 | `(defun ,name (&rest slots) | 276 | `(defun ,name (&rest slots) |
| 277 | ,(format "Create a new object with name NAME of class type %S." | 277 | ,(format "Create a new object with name NAME of class type %S." |
| 278 | name) | 278 | name) |
| 279 | (declare (compiler-macro | ||
| 280 | (lambda (whole) | ||
| 281 | (if (not (stringp (car slots))) | ||
| 282 | whole | ||
| 283 | (macroexp--warn-and-return | ||
| 284 | (format "Obsolete name arg %S to constructor %S" | ||
| 285 | (car slots) (car whole)) | ||
| 286 | ;; Keep the name arg, for backward compatibility, | ||
| 287 | ;; but hide it so we don't trigger indefinitely. | ||
| 288 | `(,(car whole) (identity ,(car slots)) | ||
| 289 | ,@(cdr slots))))))) | ||
| 279 | (apply #'eieio-constructor ',name slots)))))) | 290 | (apply #'eieio-constructor ',name slots)))))) |
| 280 | 291 | ||
| 281 | 292 | ||
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 4be3b584a72..0f094b556ba 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el | |||
| @@ -1154,13 +1154,15 @@ Also, add the originating archive to the `package-desc' structure." | |||
| 1154 | (when (not (and pinned-to-archive | 1154 | (when (not (and pinned-to-archive |
| 1155 | (not (equal (cdr pinned-to-archive) archive)))) | 1155 | (not (equal (cdr pinned-to-archive) archive)))) |
| 1156 | (setq package-archive-contents | 1156 | (setq package-archive-contents |
| 1157 | (package--add-to-alist pkg-desc package-archive-contents))))) | 1157 | (package--append-to-alist pkg-desc package-archive-contents))))) |
| 1158 | 1158 | ||
| 1159 | (defun package--add-to-alist (pkg-desc alist) | 1159 | (defun package--append-to-alist (pkg-desc alist) |
| 1160 | "Add PKG-DESC to ALIST. | 1160 | "Append an entry for PKG-DESC to the start of ALIST and return it. |
| 1161 | This entry takes the form (`package-desc-name' PKG-DESC). | ||
| 1161 | 1162 | ||
| 1162 | Packages are grouped by name. The package descriptions are sorted | 1163 | If ALIST already has an entry with this name, destructively add |
| 1163 | by version number." | 1164 | PKG-DESC to the cdr of this entry instead, sorted by version |
| 1165 | number." | ||
| 1164 | (let* ((name (package-desc-name pkg-desc)) | 1166 | (let* ((name (package-desc-name pkg-desc)) |
| 1165 | (priority-version (package-desc-priority-version pkg-desc)) | 1167 | (priority-version (package-desc-priority-version pkg-desc)) |
| 1166 | (existing-packages (assq name alist))) | 1168 | (existing-packages (assq name alist))) |
| @@ -2100,7 +2102,7 @@ If optional arg BUTTON is non-nil, describe its associated package." | |||
| 2100 | (cond ((member status '("installed" "unsigned")) | 2102 | (cond ((member status '("installed" "unsigned")) |
| 2101 | (push pkg-desc installed)) | 2103 | (push pkg-desc installed)) |
| 2102 | ((member status '("available" "new")) | 2104 | ((member status '("available" "new")) |
| 2103 | (setq available (package--add-to-alist pkg-desc available)))))) | 2105 | (setq available (package--append-to-alist pkg-desc available)))))) |
| 2104 | ;; Loop through list of installed packages, finding upgrades. | 2106 | ;; Loop through list of installed packages, finding upgrades. |
| 2105 | (dolist (pkg-desc installed) | 2107 | (dolist (pkg-desc installed) |
| 2106 | (let* ((name (package-desc-name pkg-desc)) | 2108 | (let* ((name (package-desc-name pkg-desc)) |
diff --git a/lisp/ido.el b/lisp/ido.el index 2321b57d08a..1f4e3facd36 100644 --- a/lisp/ido.el +++ b/lisp/ido.el | |||
| @@ -208,13 +208,13 @@ | |||
| 208 | ;; | 208 | ;; |
| 209 | ;; Customize the Ido group to change the Ido functionality. | 209 | ;; Customize the Ido group to change the Ido functionality. |
| 210 | ;; | 210 | ;; |
| 211 | ;; To modify the keybindings, use the ido-setup-hook. For example: | 211 | ;; To modify the keybindings, use `define-key' on |
| 212 | ;;(add-hook 'ido-setup-hook 'ido-my-keys) | 212 | ;; `ido-common-completion-map' or one of the specialized keymaps: |
| 213 | ;; `ido-file-dir-completion-map', `ido-file-completion-map' or | ||
| 214 | ;; `ido-buffer-completion-map'. | ||
| 213 | ;; | 215 | ;; |
| 214 | ;;(defun ido-my-keys () | 216 | ;; (with-eval-after-load 'ido |
| 215 | ;; "Add my keybindings for ido." | 217 | ;; (define-key ido-common-completion-map " " 'ido-next-match)) |
| 216 | ;; (define-key ido-completion-map " " 'ido-next-match) | ||
| 217 | ;; ) | ||
| 218 | 218 | ||
| 219 | ;; Seeing all the matching buffers or files | 219 | ;; Seeing all the matching buffers or files |
| 220 | ;; ---------------------------------------- | 220 | ;; ---------------------------------------- |
| @@ -323,8 +323,8 @@ | |||
| 323 | 323 | ||
| 324 | (defvar recentf-list) | 324 | (defvar recentf-list) |
| 325 | 325 | ||
| 326 | ;;; User Variables | 326 | ;;;; Options |
| 327 | ;; | 327 | |
| 328 | ;; These are some things you might want to change. | 328 | ;; These are some things you might want to change. |
| 329 | 329 | ||
| 330 | (defun ido-fractionp (n) | 330 | (defun ido-fractionp (n) |
| @@ -978,25 +978,90 @@ The fallback command is passed as an argument to the functions." | |||
| 978 | :type 'hook | 978 | :type 'hook |
| 979 | :group 'ido) | 979 | :group 'ido) |
| 980 | 980 | ||
| 981 | ;;; Internal Variables | 981 | ;;;; Keymaps |
| 982 | |||
| 983 | ;; Persistent variables | ||
| 984 | |||
| 985 | (defvar ido-completion-map nil | ||
| 986 | "Currently active keymap for Ido commands.") | ||
| 987 | 982 | ||
| 988 | (defvar ido-common-completion-map nil | 983 | (defvar ido-common-completion-map |
| 984 | (let ((map (make-sparse-keymap))) | ||
| 985 | (set-keymap-parent map minibuffer-local-map) | ||
| 986 | (define-key map "\C-a" 'ido-toggle-ignore) | ||
| 987 | (define-key map "\C-c" 'ido-toggle-case) | ||
| 988 | (define-key map "\C-e" 'ido-edit-input) | ||
| 989 | (define-key map "\t" 'ido-complete) | ||
| 990 | (define-key map " " 'ido-complete-space) | ||
| 991 | (define-key map "\C-j" 'ido-select-text) | ||
| 992 | (define-key map "\C-m" 'ido-exit-minibuffer) | ||
| 993 | (define-key map "\C-p" 'ido-toggle-prefix) | ||
| 994 | (define-key map "\C-r" 'ido-prev-match) | ||
| 995 | (define-key map "\C-s" 'ido-next-match) | ||
| 996 | (define-key map [?\C-.] 'ido-next-match) | ||
| 997 | (define-key map [?\C-,] 'ido-prev-match) | ||
| 998 | (define-key map "\C-t" 'ido-toggle-regexp) | ||
| 999 | (define-key map "\C-z" 'ido-undo-merge-work-directory) | ||
| 1000 | (define-key map [(control ?\s)] 'ido-restrict-to-matches) | ||
| 1001 | (define-key map [(meta ?\s)] 'ido-take-first-match) | ||
| 1002 | (define-key map [(control ?@)] 'ido-restrict-to-matches) | ||
| 1003 | (define-key map [right] 'ido-next-match) | ||
| 1004 | (define-key map [left] 'ido-prev-match) | ||
| 1005 | (define-key map "?" 'ido-completion-help) | ||
| 1006 | (define-key map "\C-b" 'ido-magic-backward-char) | ||
| 1007 | (define-key map "\C-f" 'ido-magic-forward-char) | ||
| 1008 | (define-key map "\C-d" 'ido-magic-delete-char) | ||
| 1009 | map) | ||
| 989 | "Keymap for all Ido commands.") | 1010 | "Keymap for all Ido commands.") |
| 990 | 1011 | ||
| 991 | (defvar ido-file-completion-map nil | 1012 | (defvar ido-file-dir-completion-map |
| 992 | "Keymap for Ido file commands.") | 1013 | (let ((map (make-sparse-keymap))) |
| 993 | 1014 | (set-keymap-parent map ido-common-completion-map) | |
| 994 | (defvar ido-file-dir-completion-map nil | 1015 | (define-key map "\C-x\C-b" 'ido-enter-switch-buffer) |
| 1016 | (define-key map "\C-x\C-f" 'ido-fallback-command) | ||
| 1017 | (define-key map "\C-x\C-d" 'ido-enter-dired) | ||
| 1018 | (define-key map [down] 'ido-next-match-dir) | ||
| 1019 | (define-key map [up] 'ido-prev-match-dir) | ||
| 1020 | (define-key map [(meta up)] 'ido-prev-work-directory) | ||
| 1021 | (define-key map [(meta down)] 'ido-next-work-directory) | ||
| 1022 | (define-key map [backspace] 'ido-delete-backward-updir) | ||
| 1023 | (define-key map "\d" 'ido-delete-backward-updir) | ||
| 1024 | (define-key map [remap delete-backward-char] 'ido-delete-backward-updir) ; BS | ||
| 1025 | (define-key map [remap backward-kill-word] 'ido-delete-backward-word-updir) ; M-DEL | ||
| 1026 | (define-key map [(control backspace)] 'ido-up-directory) | ||
| 1027 | (define-key map "\C-l" 'ido-reread-directory) | ||
| 1028 | (define-key map [(meta ?d)] 'ido-wide-find-dir-or-delete-dir) | ||
| 1029 | (define-key map [(meta ?b)] 'ido-push-dir) | ||
| 1030 | (define-key map [(meta ?v)] 'ido-push-dir-first) | ||
| 1031 | (define-key map [(meta ?f)] 'ido-wide-find-file-or-pop-dir) | ||
| 1032 | (define-key map [(meta ?k)] 'ido-forget-work-directory) | ||
| 1033 | (define-key map [(meta ?m)] 'ido-make-directory) | ||
| 1034 | (define-key map [(meta ?n)] 'ido-next-work-directory) | ||
| 1035 | (define-key map [(meta ?o)] 'ido-prev-work-file) | ||
| 1036 | (define-key map [(meta control ?o)] 'ido-next-work-file) | ||
| 1037 | (define-key map [(meta ?p)] 'ido-prev-work-directory) | ||
| 1038 | (define-key map [(meta ?s)] 'ido-merge-work-directories) | ||
| 1039 | map) | ||
| 995 | "Keymap for Ido file and directory commands.") | 1040 | "Keymap for Ido file and directory commands.") |
| 996 | 1041 | ||
| 997 | (defvar ido-buffer-completion-map nil | 1042 | (defvar ido-file-completion-map |
| 1043 | (let ((map (make-sparse-keymap))) | ||
| 1044 | (set-keymap-parent map ido-file-dir-completion-map) | ||
| 1045 | (define-key map "\C-k" 'ido-delete-file-at-head) | ||
| 1046 | (define-key map "\C-o" 'ido-copy-current-word) | ||
| 1047 | (define-key map "\C-w" 'ido-copy-current-file-name) | ||
| 1048 | (define-key map [(meta ?l)] 'ido-toggle-literal) | ||
| 1049 | map) | ||
| 1050 | "Keymap for Ido file commands.") | ||
| 1051 | |||
| 1052 | (defvar ido-buffer-completion-map | ||
| 1053 | (let ((map (make-sparse-keymap))) | ||
| 1054 | (set-keymap-parent map ido-common-completion-map) | ||
| 1055 | (define-key map "\C-x\C-f" 'ido-enter-find-file) | ||
| 1056 | (define-key map "\C-x\C-b" 'ido-fallback-command) | ||
| 1057 | (define-key map "\C-k" 'ido-kill-buffer-at-head) | ||
| 1058 | (define-key map [?\C-\S-b] 'ido-bury-buffer-at-head) | ||
| 1059 | (define-key map "\C-o" 'ido-toggle-virtual-buffers) | ||
| 1060 | map) | ||
| 998 | "Keymap for Ido buffer commands.") | 1061 | "Keymap for Ido buffer commands.") |
| 999 | 1062 | ||
| 1063 | ;;;; Persistent variables | ||
| 1064 | |||
| 1000 | (defvar ido-file-history nil | 1065 | (defvar ido-file-history nil |
| 1001 | "History of files selected using `ido-find-file'.") | 1066 | "History of files selected using `ido-find-file'.") |
| 1002 | 1067 | ||
| @@ -1027,7 +1092,10 @@ Each element in the list is of the form (DIR (MTIME) FILE...).") | |||
| 1027 | Intended to be let-bound by functions which call Ido repeatedly. | 1092 | Intended to be let-bound by functions which call Ido repeatedly. |
| 1028 | Should never be set permanently.") | 1093 | Should never be set permanently.") |
| 1029 | 1094 | ||
| 1030 | ;; Temporary storage | 1095 | ;;;; Temporary storage |
| 1096 | |||
| 1097 | (defvar ido-completion-map nil | ||
| 1098 | "Currently active keymap for Ido commands.") | ||
| 1031 | 1099 | ||
| 1032 | (defvar ido-eoinput 1 | 1100 | (defvar ido-eoinput 1 |
| 1033 | "Point where minibuffer input ends and completion info begins. | 1101 | "Point where minibuffer input ends and completion info begins. |
| @@ -1086,13 +1154,14 @@ Value is an integer which is number of chars to right of prompt.") | |||
| 1086 | This is a copy of `recentf-list', pared down and with faces applied. | 1154 | This is a copy of `recentf-list', pared down and with faces applied. |
| 1087 | Only used if `ido-use-virtual-buffers' is non-nil.") | 1155 | Only used if `ido-use-virtual-buffers' is non-nil.") |
| 1088 | 1156 | ||
| 1089 | ;;; Variables with dynamic bindings. | 1157 | ;;;; Variables with dynamic bindings. |
| 1090 | ;;; Declared here to keep the byte compiler quiet. | 1158 | |
| 1159 | ;; These are declared here to keep the byte compiler quiet. | ||
| 1091 | 1160 | ||
| 1092 | ;; Stores the current ido item type ('file, 'dir, 'buffer, or 'list). | 1161 | ;; Stores the current ido item type ('file, 'dir, 'buffer, or 'list). |
| 1093 | (defvar ido-cur-item) | 1162 | (defvar ido-cur-item) |
| 1094 | 1163 | ||
| 1095 | ;;; Stores the current default item | 1164 | ;; Stores the current default item. |
| 1096 | (defvar ido-default-item) | 1165 | (defvar ido-default-item) |
| 1097 | 1166 | ||
| 1098 | ;; Stores the current list of items that will be searched through. | 1167 | ;; Stores the current list of items that will be searched through. |
| @@ -1502,7 +1571,6 @@ Removes badly formatted data and ignored directories." | |||
| 1502 | (ido-save-history)) | 1571 | (ido-save-history)) |
| 1503 | 1572 | ||
| 1504 | (defun ido-common-initialization () | 1573 | (defun ido-common-initialization () |
| 1505 | (ido-init-completion-maps) | ||
| 1506 | (add-hook 'minibuffer-setup-hook 'ido-minibuffer-setup) | 1574 | (add-hook 'minibuffer-setup-hook 'ido-minibuffer-setup) |
| 1507 | (add-hook 'choose-completion-string-functions 'ido-choose-completion-string)) | 1575 | (add-hook 'choose-completion-string-functions 'ido-choose-completion-string)) |
| 1508 | 1576 | ||
| @@ -1596,120 +1664,51 @@ This function also adds a hook to the minibuffer." | |||
| 1596 | 1664 | ||
| 1597 | 1665 | ||
| 1598 | ;;; IDO KEYMAP | 1666 | ;;; IDO KEYMAP |
| 1599 | (defun ido-init-completion-maps () | ||
| 1600 | "Set up the completion keymaps used by Ido." | ||
| 1601 | |||
| 1602 | ;; Common map | ||
| 1603 | (let ((map (make-sparse-keymap))) | ||
| 1604 | (define-key map "\C-a" 'ido-toggle-ignore) | ||
| 1605 | (define-key map "\C-c" 'ido-toggle-case) | ||
| 1606 | (define-key map "\C-e" 'ido-edit-input) | ||
| 1607 | (define-key map "\t" 'ido-complete) | ||
| 1608 | (define-key map " " 'ido-complete-space) | ||
| 1609 | (define-key map "\C-j" 'ido-select-text) | ||
| 1610 | (define-key map "\C-m" 'ido-exit-minibuffer) | ||
| 1611 | (define-key map "\C-p" 'ido-toggle-prefix) | ||
| 1612 | (define-key map "\C-r" 'ido-prev-match) | ||
| 1613 | (define-key map "\C-s" 'ido-next-match) | ||
| 1614 | (define-key map [?\C-.] 'ido-next-match) | ||
| 1615 | (define-key map [?\C-,] 'ido-prev-match) | ||
| 1616 | (define-key map "\C-t" 'ido-toggle-regexp) | ||
| 1617 | (define-key map "\C-z" 'ido-undo-merge-work-directory) | ||
| 1618 | (define-key map [(control ?\s)] 'ido-restrict-to-matches) | ||
| 1619 | (define-key map [(meta ?\s)] 'ido-take-first-match) | ||
| 1620 | (define-key map [(control ?@)] 'ido-restrict-to-matches) | ||
| 1621 | (define-key map [right] 'ido-next-match) | ||
| 1622 | (define-key map [left] 'ido-prev-match) | ||
| 1623 | (define-key map "?" 'ido-completion-help) | ||
| 1624 | ;; Magic commands. | ||
| 1625 | (define-key map "\C-b" 'ido-magic-backward-char) | ||
| 1626 | (define-key map "\C-f" 'ido-magic-forward-char) | ||
| 1627 | (define-key map "\C-d" 'ido-magic-delete-char) | ||
| 1628 | (set-keymap-parent map minibuffer-local-map) | ||
| 1629 | (setq ido-common-completion-map map)) | ||
| 1630 | |||
| 1631 | ;; File and directory map | ||
| 1632 | (let ((map (make-sparse-keymap))) | ||
| 1633 | (define-key map "\C-x\C-b" 'ido-enter-switch-buffer) | ||
| 1634 | (define-key map "\C-x\C-f" 'ido-fallback-command) | ||
| 1635 | (define-key map "\C-x\C-d" 'ido-enter-dired) | ||
| 1636 | (define-key map [down] 'ido-next-match-dir) | ||
| 1637 | (define-key map [up] 'ido-prev-match-dir) | ||
| 1638 | (define-key map [(meta up)] 'ido-prev-work-directory) | ||
| 1639 | (define-key map [(meta down)] 'ido-next-work-directory) | ||
| 1640 | (define-key map [backspace] 'ido-delete-backward-updir) | ||
| 1641 | (define-key map "\d" 'ido-delete-backward-updir) | ||
| 1642 | (define-key map [remap delete-backward-char] 'ido-delete-backward-updir) ; BS | ||
| 1643 | (define-key map [remap backward-kill-word] 'ido-delete-backward-word-updir) ; M-DEL | ||
| 1644 | 1667 | ||
| 1645 | (define-key map [(control backspace)] 'ido-up-directory) | 1668 | (defalias 'ido-init-completion-maps 'ignore "") |
| 1646 | (define-key map "\C-l" 'ido-reread-directory) | 1669 | (make-obsolete 'ido-init-completion-maps "it does nothing." "25.1") |
| 1647 | (define-key map [(meta ?d)] 'ido-wide-find-dir-or-delete-dir) | ||
| 1648 | (define-key map [(meta ?b)] 'ido-push-dir) | ||
| 1649 | (define-key map [(meta ?v)] 'ido-push-dir-first) | ||
| 1650 | (define-key map [(meta ?f)] 'ido-wide-find-file-or-pop-dir) | ||
| 1651 | (define-key map [(meta ?k)] 'ido-forget-work-directory) | ||
| 1652 | (define-key map [(meta ?m)] 'ido-make-directory) | ||
| 1653 | (define-key map [(meta ?n)] 'ido-next-work-directory) | ||
| 1654 | (define-key map [(meta ?o)] 'ido-prev-work-file) | ||
| 1655 | (define-key map [(meta control ?o)] 'ido-next-work-file) | ||
| 1656 | (define-key map [(meta ?p)] 'ido-prev-work-directory) | ||
| 1657 | (define-key map [(meta ?s)] 'ido-merge-work-directories) | ||
| 1658 | (set-keymap-parent map ido-common-completion-map) | ||
| 1659 | (setq ido-file-dir-completion-map map)) | ||
| 1660 | 1670 | ||
| 1661 | ;; File only map | 1671 | (defun ido-setup-completion-map () |
| 1662 | (let ((map (make-sparse-keymap))) | 1672 | "Set up the completion keymap used by Ido. |
| 1663 | (define-key map "\C-k" 'ido-delete-file-at-head) | ||
| 1664 | (define-key map "\C-o" 'ido-copy-current-word) | ||
| 1665 | (define-key map "\C-w" 'ido-copy-current-file-name) | ||
| 1666 | (define-key map [(meta ?l)] 'ido-toggle-literal) | ||
| 1667 | (set-keymap-parent map ido-file-dir-completion-map) | ||
| 1668 | (setq ido-file-completion-map map)) | ||
| 1669 | 1673 | ||
| 1670 | ;; Buffer map | 1674 | Create a keymap, bind `ido-completion-map' to it, and depending |
| 1671 | (let ((map (make-sparse-keymap))) | 1675 | on what is being completed (`ido-cur-item') set its parent keymap |
| 1672 | (define-key map "\C-x\C-f" 'ido-enter-find-file) | 1676 | to one of: |
| 1673 | (define-key map "\C-x\C-b" 'ido-fallback-command) | ||
| 1674 | (define-key map "\C-k" 'ido-kill-buffer-at-head) | ||
| 1675 | (define-key map [?\C-\S-b] 'ido-bury-buffer-at-head) | ||
| 1676 | (define-key map "\C-o" 'ido-toggle-virtual-buffers) | ||
| 1677 | (set-keymap-parent map ido-common-completion-map) | ||
| 1678 | (setq ido-buffer-completion-map map))) | ||
| 1679 | 1677 | ||
| 1678 | `ido-common-completion-map' | ||
| 1679 | `ido-file-dir-completion-map' | ||
| 1680 | `ido-file-completion-map' | ||
| 1681 | `ido-buffer-completion-map' | ||
| 1680 | 1682 | ||
| 1681 | (defun ido-setup-completion-map () | 1683 | If option `ido-context-switch-command' is non-nil or `viper-mode' |
| 1682 | "Set up the keymap for Ido." | 1684 | is enabled then some keybindings are changed in the keymap." |
| 1683 | |||
| 1684 | ;; generated every time so that it can inherit new functions. | 1685 | ;; generated every time so that it can inherit new functions. |
| 1685 | (let ((map (make-sparse-keymap)) | 1686 | (let ((map (make-sparse-keymap)) |
| 1686 | (viper-p (if (boundp 'viper-mode) viper-mode))) | 1687 | (viper-p (if (boundp 'viper-mode) viper-mode))) |
| 1687 | |||
| 1688 | (when viper-p | 1688 | (when viper-p |
| 1689 | (define-key map [remap viper-intercept-ESC-key] 'ignore)) | 1689 | (define-key map [remap viper-intercept-ESC-key] 'ignore)) |
| 1690 | 1690 | (pcase ido-cur-item | |
| 1691 | (cond | 1691 | ((or `file `dir) |
| 1692 | ((memq ido-cur-item '(file dir)) | ||
| 1693 | (when ido-context-switch-command | 1692 | (when ido-context-switch-command |
| 1694 | (define-key map "\C-x\C-b" ido-context-switch-command) | 1693 | (define-key map "\C-x\C-b" ido-context-switch-command) |
| 1695 | (define-key map "\C-x\C-d" 'ignore)) | 1694 | (define-key map "\C-x\C-d" 'ignore)) |
| 1696 | (when viper-p | 1695 | (when viper-p |
| 1697 | (define-key map [remap viper-backward-char] 'ido-delete-backward-updir) | 1696 | (define-key map [remap viper-backward-char] |
| 1698 | (define-key map [remap viper-del-backward-char-in-insert] 'ido-delete-backward-updir) | 1697 | 'ido-delete-backward-updir) |
| 1699 | (define-key map [remap viper-delete-backward-word] 'ido-delete-backward-word-updir)) | 1698 | (define-key map [remap viper-del-backward-char-in-insert] |
| 1699 | 'ido-delete-backward-updir) | ||
| 1700 | (define-key map [remap viper-delete-backward-word] | ||
| 1701 | 'ido-delete-backward-word-updir)) | ||
| 1700 | (set-keymap-parent map | 1702 | (set-keymap-parent map |
| 1701 | (if (eq ido-cur-item 'file) | 1703 | (if (eq ido-cur-item 'file) |
| 1702 | ido-file-completion-map | 1704 | ido-file-completion-map |
| 1703 | ido-file-dir-completion-map))) | 1705 | ido-file-dir-completion-map))) |
| 1704 | 1706 | (`buffer | |
| 1705 | ((eq ido-cur-item 'buffer) | ||
| 1706 | (when ido-context-switch-command | 1707 | (when ido-context-switch-command |
| 1707 | (define-key map "\C-x\C-f" ido-context-switch-command)) | 1708 | (define-key map "\C-x\C-f" ido-context-switch-command)) |
| 1708 | (set-keymap-parent map ido-buffer-completion-map)) | 1709 | (set-keymap-parent map ido-buffer-completion-map)) |
| 1709 | 1710 | (_ | |
| 1710 | (t | ||
| 1711 | (set-keymap-parent map ido-common-completion-map))) | 1711 | (set-keymap-parent map ido-common-completion-map))) |
| 1712 | |||
| 1713 | (setq ido-completion-map map))) | 1712 | (setq ido-completion-map map))) |
| 1714 | 1713 | ||
| 1715 | (defun ido-final-slash (dir &optional fix-it) | 1714 | (defun ido-final-slash (dir &optional fix-it) |
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 7f77d218a48..12123c8f2e2 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el | |||
| @@ -51,6 +51,7 @@ | |||
| 51 | (require 'cl-lib) | 51 | (require 'cl-lib) |
| 52 | (require 'eieio) | 52 | (require 'eieio) |
| 53 | (require 'ring) | 53 | (require 'ring) |
| 54 | (require 'pcase) | ||
| 54 | 55 | ||
| 55 | (defgroup xref nil "Cross-referencing commands" | 56 | (defgroup xref nil "Cross-referencing commands" |
| 56 | :group 'tools) | 57 | :group 'tools) |
| @@ -333,19 +334,32 @@ WINDOW controls how the buffer is displayed: | |||
| 333 | 334 | ||
| 334 | ;; The xref buffer is used to display a set of xrefs. | 335 | ;; The xref buffer is used to display a set of xrefs. |
| 335 | 336 | ||
| 336 | (defvar-local xref--window-configuration nil) | 337 | (defvar-local xref--display-history nil |
| 338 | "List of pairs (BUFFER . WINDOW), for temporarily displayed buffers.") | ||
| 337 | 339 | ||
| 338 | (defun xref--display-position (pos other-window recenter-arg) | 340 | (defun xref--save-to-history (buf win) |
| 339 | ;; show the location, but don't hijack focus. | 341 | (let ((restore (window-parameter win 'quit-restore))) |
| 342 | ;; Save the new entry if the window displayed another buffer | ||
| 343 | ;; previously. | ||
| 344 | (when (and restore (not (eq (car restore) 'same))) | ||
| 345 | (push (cons buf win) xref--display-history)))) | ||
| 346 | |||
| 347 | (defun xref--display-position (pos other-window recenter-arg xref-buf) | ||
| 348 | ;; Show the location, but don't hijack focus. | ||
| 340 | (with-selected-window (display-buffer (current-buffer) other-window) | 349 | (with-selected-window (display-buffer (current-buffer) other-window) |
| 341 | (goto-char pos) | 350 | (goto-char pos) |
| 342 | (recenter recenter-arg))) | 351 | (recenter recenter-arg) |
| 352 | (let ((buf (current-buffer)) | ||
| 353 | (win (selected-window))) | ||
| 354 | (with-current-buffer xref-buf | ||
| 355 | (setq-local other-window-scroll-buffer buf) | ||
| 356 | (xref--save-to-history buf win))))) | ||
| 343 | 357 | ||
| 344 | (defun xref--show-location (location) | 358 | (defun xref--show-location (location) |
| 345 | (condition-case err | 359 | (condition-case err |
| 346 | (progn | 360 | (let ((xref-buf (current-buffer))) |
| 347 | (xref--goto-location location) | 361 | (xref--goto-location location) |
| 348 | (xref--display-position (point) t 1)) | 362 | (xref--display-position (point) t 1 xref-buf)) |
| 349 | (user-error (message (error-message-string err))))) | 363 | (user-error (message (error-message-string err))))) |
| 350 | 364 | ||
| 351 | (defun xref-show-location-at-point () | 365 | (defun xref-show-location-at-point () |
| @@ -353,14 +367,8 @@ WINDOW controls how the buffer is displayed: | |||
| 353 | (interactive) | 367 | (interactive) |
| 354 | (let ((loc (xref--location-at-point))) | 368 | (let ((loc (xref--location-at-point))) |
| 355 | (when loc | 369 | (when loc |
| 356 | (setq xref--window-configuration (current-window-configuration)) | ||
| 357 | (xref--show-location loc)))) | 370 | (xref--show-location loc)))) |
| 358 | 371 | ||
| 359 | (defun xref--restore-window-configuration () | ||
| 360 | (when xref--window-configuration | ||
| 361 | (set-window-configuration xref--window-configuration) | ||
| 362 | (setq xref--window-configuration nil))) | ||
| 363 | |||
| 364 | (defun xref-next-line () | 372 | (defun xref-next-line () |
| 365 | "Move to the next xref and display its source in the other window." | 373 | "Move to the next xref and display its source in the other window." |
| 366 | (interactive) | 374 | (interactive) |
| @@ -379,21 +387,21 @@ WINDOW controls how the buffer is displayed: | |||
| 379 | (defvar-local xref--window nil) | 387 | (defvar-local xref--window nil) |
| 380 | 388 | ||
| 381 | (defun xref-goto-xref () | 389 | (defun xref-goto-xref () |
| 382 | "Jump to the xref at point and bury the xref buffer." | 390 | "Jump to the xref on the current line and bury the xref buffer." |
| 383 | (interactive) | 391 | (interactive) |
| 392 | (back-to-indentation) | ||
| 384 | (let ((loc (or (xref--location-at-point) | 393 | (let ((loc (or (xref--location-at-point) |
| 385 | (error "No reference at point"))) | 394 | (user-error "No reference at point"))) |
| 386 | (window xref--window)) | 395 | (window xref--window)) |
| 387 | (quit-window) | 396 | (xref--quit) |
| 388 | (xref--pop-to-location loc window))) | 397 | (xref--pop-to-location loc window))) |
| 389 | 398 | ||
| 390 | (define-derived-mode xref--xref-buffer-mode fundamental-mode "XREF" | 399 | (define-derived-mode xref--xref-buffer-mode fundamental-mode "XREF" |
| 391 | "Mode for displaying cross-references." | 400 | "Mode for displaying cross-references." |
| 392 | (setq buffer-read-only t) | 401 | (setq buffer-read-only t)) |
| 393 | (add-hook 'pre-command-hook #'xref--restore-window-configuration nil t)) | ||
| 394 | 402 | ||
| 395 | (let ((map xref--xref-buffer-mode-map)) | 403 | (let ((map xref--xref-buffer-mode-map)) |
| 396 | (define-key map (kbd "q") #'quit-window) | 404 | (define-key map (kbd "q") #'xref--quit) |
| 397 | (define-key map (kbd "n") #'xref-next-line) | 405 | (define-key map (kbd "n") #'xref-next-line) |
| 398 | (define-key map (kbd "p") #'xref-prev-line) | 406 | (define-key map (kbd "p") #'xref-prev-line) |
| 399 | (define-key map (kbd "RET") #'xref-goto-xref) | 407 | (define-key map (kbd "RET") #'xref-goto-xref) |
| @@ -403,6 +411,18 @@ WINDOW controls how the buffer is displayed: | |||
| 403 | (define-key map (kbd ".") #'xref-next-line) | 411 | (define-key map (kbd ".") #'xref-next-line) |
| 404 | (define-key map (kbd ",") #'xref-prev-line)) | 412 | (define-key map (kbd ",") #'xref-prev-line)) |
| 405 | 413 | ||
| 414 | (defun xref--quit () | ||
| 415 | "Quit all windows in `xref--display-history', then quit current window." | ||
| 416 | (interactive) | ||
| 417 | (let ((window (selected-window)) | ||
| 418 | (history xref--display-history)) | ||
| 419 | (setq xref--display-history nil) | ||
| 420 | (pcase-dolist (`(,buf . ,win) history) | ||
| 421 | (when (and (window-live-p win) | ||
| 422 | (eq buf (window-buffer win))) | ||
| 423 | (quit-window nil win))) | ||
| 424 | (quit-window nil window))) | ||
| 425 | |||
| 406 | (defconst xref-buffer-name "*xref*" | 426 | (defconst xref-buffer-name "*xref*" |
| 407 | "The name of the buffer to show xrefs.") | 427 | "The name of the buffer to show xrefs.") |
| 408 | 428 | ||
diff --git a/src/ChangeLog b/src/ChangeLog index 16e2fa19626..f6a5f3837a3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,39 @@ | |||
| 1 | 2015-01-19 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * dispnew.c (adjust_glyph_matrix, realloc_glyph_pool): Verify that | ||
| 4 | Qnil is represented as zero, before using that to initialize parts | ||
| 5 | of the glyph structure. | ||
| 6 | |||
| 7 | * xdisp.c (init_iterator): Verify that Qnil is represented as | ||
| 8 | zero, before using that to initialize parts of the iterator | ||
| 9 | structure. | ||
| 10 | |||
| 11 | 2015-01-19 Paul Eggert <eggert@cs.ucla.edu> | ||
| 12 | |||
| 13 | Prefer memset to repeatedly assigning Qnil | ||
| 14 | * alloc.c (allocate_pseudovector): Catch more bogus values. | ||
| 15 | * alloc.c (allocate_pseudovector): | ||
| 16 | * callint.c (Fcall_interactively): | ||
| 17 | * coding.c (syms_of_coding): | ||
| 18 | * fringe.c (init_fringe): | ||
| 19 | Verify that Qnil == 0. | ||
| 20 | * callint.c (Fcall_interactively): | ||
| 21 | * eval.c (Fapply, Ffuncall): | ||
| 22 | * fns.c (mapcar1, larger_vector): | ||
| 23 | * font.c (font_expand_wildcards): | ||
| 24 | * fringe.c (init_fringe): | ||
| 25 | Prefer memset to assigning zeros by hand. | ||
| 26 | * callint.c (Fcall_interactively): | ||
| 27 | Remove duplicate assignment of Qnil to args[i]. | ||
| 28 | * coding.c (syms_of_coding): | ||
| 29 | Prefer LISP_INITIALLY_ZERO to assigning zeros by hand. | ||
| 30 | * fileio.c (Ffile_selinux_context): | ||
| 31 | Rewrite to avoid need for Lisp_Object array. | ||
| 32 | * lisp.h (XLI_BUILTIN_LISPSYM): New macro. | ||
| 33 | (DEFINE_LISP_SYMBOL_END): Use it. | ||
| 34 | (NIL_IS_ZERO): New constant. | ||
| 35 | (memsetnil): New function. | ||
| 36 | |||
| 1 | 2015-01-16 Dmitry Antipov <dmantipov@yandex.ru> | 37 | 2015-01-16 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 38 | ||
| 3 | Tune pseudovector allocation assuming Qnil == 0. | 39 | Tune pseudovector allocation assuming Qnil == 0. |
diff --git a/src/alloc.c b/src/alloc.c index 22a15b4ac59..2c7b02f1158 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -3169,12 +3169,14 @@ allocate_pseudovector (int memlen, int lisplen, | |||
| 3169 | struct Lisp_Vector *v = allocate_vectorlike (memlen); | 3169 | struct Lisp_Vector *v = allocate_vectorlike (memlen); |
| 3170 | 3170 | ||
| 3171 | /* Catch bogus values. */ | 3171 | /* Catch bogus values. */ |
| 3172 | eassert (tag <= PVEC_FONT); | 3172 | eassert (0 <= tag && tag <= PVEC_FONT); |
| 3173 | eassert (0 <= lisplen && lisplen <= zerolen && zerolen <= memlen); | ||
| 3173 | eassert (memlen - lisplen <= (1 << PSEUDOVECTOR_REST_BITS) - 1); | 3174 | eassert (memlen - lisplen <= (1 << PSEUDOVECTOR_REST_BITS) - 1); |
| 3174 | eassert (lisplen <= (1 << PSEUDOVECTOR_SIZE_BITS) - 1); | 3175 | eassert (lisplen <= (1 << PSEUDOVECTOR_SIZE_BITS) - 1); |
| 3175 | 3176 | ||
| 3176 | /* Only the first lisplen slots will be traced normally by the GC. | 3177 | /* Only the first LISPLEN slots will be traced normally by the GC. |
| 3177 | But since Qnil == 0, we can memset Lisp_Object slots as well. */ | 3178 | But since Qnil == 0, we can memset Lisp_Object slots as well. */ |
| 3179 | verify (NIL_IS_ZERO); | ||
| 3178 | memset (v->contents, 0, zerolen * word_size); | 3180 | memset (v->contents, 0, zerolen * word_size); |
| 3179 | 3181 | ||
| 3180 | XSETPVECTYPESIZE (v, tag, lisplen, memlen - lisplen); | 3182 | XSETPVECTYPESIZE (v, tag, lisplen, memlen - lisplen); |
diff --git a/src/callint.c b/src/callint.c index dd238b976aa..3a595b57d77 100644 --- a/src/callint.c +++ b/src/callint.c | |||
| @@ -509,12 +509,8 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 509 | visargs = args + nargs; | 509 | visargs = args + nargs; |
| 510 | varies = (signed char *) (visargs + nargs); | 510 | varies = (signed char *) (visargs + nargs); |
| 511 | 511 | ||
| 512 | for (i = 0; i < nargs; i++) | 512 | verify (NIL_IS_ZERO); |
| 513 | { | 513 | memset (args, 0, nargs * (2 * word_size + 1)); |
| 514 | args[i] = Qnil; | ||
| 515 | visargs[i] = Qnil; | ||
| 516 | varies[i] = 0; | ||
| 517 | } | ||
| 518 | 514 | ||
| 519 | GCPRO5 (prefix_arg, function, *args, *visargs, up_event); | 515 | GCPRO5 (prefix_arg, function, *args, *visargs, up_event); |
| 520 | gcpro3.nvars = nargs; | 516 | gcpro3.nvars = nargs; |
| @@ -781,7 +777,7 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 781 | argument if no prefix. */ | 777 | argument if no prefix. */ |
| 782 | if (NILP (prefix_arg)) | 778 | if (NILP (prefix_arg)) |
| 783 | { | 779 | { |
| 784 | args[i] = Qnil; | 780 | /* args[i] = Qnil; */ |
| 785 | varies[i] = -1; | 781 | varies[i] = -1; |
| 786 | } | 782 | } |
| 787 | else | 783 | else |
diff --git a/src/coding.c b/src/coding.c index b11143a32fb..77cea77cef5 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -11272,13 +11272,10 @@ internal character representation. */); | |||
| 11272 | Vtranslation_table_for_input = Qnil; | 11272 | Vtranslation_table_for_input = Qnil; |
| 11273 | 11273 | ||
| 11274 | { | 11274 | { |
| 11275 | Lisp_Object args[coding_arg_undecided_max]; | 11275 | verify (NIL_IS_ZERO); |
| 11276 | Lisp_Object plist[16]; | 11276 | Lisp_Object args[coding_arg_undecided_max] = { LISP_INITIALLY_ZERO, }; |
| 11277 | int i; | ||
| 11278 | |||
| 11279 | for (i = 0; i < coding_arg_undecided_max; i++) | ||
| 11280 | args[i] = Qnil; | ||
| 11281 | 11277 | ||
| 11278 | Lisp_Object plist[16]; | ||
| 11282 | plist[0] = intern_c_string (":name"); | 11279 | plist[0] = intern_c_string (":name"); |
| 11283 | plist[1] = args[coding_arg_name] = Qno_conversion; | 11280 | plist[1] = args[coding_arg_name] = Qno_conversion; |
| 11284 | plist[2] = intern_c_string (":mnemonic"); | 11281 | plist[2] = intern_c_string (":mnemonic"); |
diff --git a/src/dispnew.c b/src/dispnew.c index bfa06bd2878..abfdde6ef24 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -417,6 +417,12 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y | |||
| 417 | new_rows = dim.height - matrix->rows_allocated; | 417 | new_rows = dim.height - matrix->rows_allocated; |
| 418 | matrix->rows = xpalloc (matrix->rows, &matrix->rows_allocated, | 418 | matrix->rows = xpalloc (matrix->rows, &matrix->rows_allocated, |
| 419 | new_rows, INT_MAX, sizeof *matrix->rows); | 419 | new_rows, INT_MAX, sizeof *matrix->rows); |
| 420 | /* As a side effect, this sets the object of each glyph in the | ||
| 421 | row to nil, so verify we will indeed get that. Redisplay | ||
| 422 | relies on the object of special glyphs (truncation and | ||
| 423 | continuation glyps and also blanks used to extend each line | ||
| 424 | on a TTY) to be nil. */ | ||
| 425 | verify (NIL_IS_ZERO); | ||
| 420 | memset (matrix->rows + old_alloc, 0, | 426 | memset (matrix->rows + old_alloc, 0, |
| 421 | (matrix->rows_allocated - old_alloc) * sizeof *matrix->rows); | 427 | (matrix->rows_allocated - old_alloc) * sizeof *matrix->rows); |
| 422 | } | 428 | } |
| @@ -1343,6 +1349,12 @@ realloc_glyph_pool (struct glyph_pool *pool, struct dim matrix_dim) | |||
| 1343 | ptrdiff_t old_nglyphs = pool->nglyphs; | 1349 | ptrdiff_t old_nglyphs = pool->nglyphs; |
| 1344 | pool->glyphs = xpalloc (pool->glyphs, &pool->nglyphs, | 1350 | pool->glyphs = xpalloc (pool->glyphs, &pool->nglyphs, |
| 1345 | needed - old_nglyphs, -1, sizeof *pool->glyphs); | 1351 | needed - old_nglyphs, -1, sizeof *pool->glyphs); |
| 1352 | /* As a side effect, this sets the object of each glyph to nil, | ||
| 1353 | so verify we will indeed get that. Redisplay relies on the | ||
| 1354 | object of special glyphs (truncation and continuation glyps | ||
| 1355 | and also blanks used to extend each line on a TTY) to be | ||
| 1356 | nil. */ | ||
| 1357 | verify (NIL_IS_ZERO); | ||
| 1346 | memset (pool->glyphs + old_nglyphs, 0, | 1358 | memset (pool->glyphs + old_nglyphs, 0, |
| 1347 | (pool->nglyphs - old_nglyphs) * sizeof *pool->glyphs); | 1359 | (pool->nglyphs - old_nglyphs) * sizeof *pool->glyphs); |
| 1348 | } | 1360 | } |
diff --git a/src/eval.c b/src/eval.c index 5cadb1bc2de..ddf6535cabc 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -2299,8 +2299,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) | |||
| 2299 | /* Avoid making funcall cons up a yet another new vector of arguments | 2299 | /* Avoid making funcall cons up a yet another new vector of arguments |
| 2300 | by explicitly supplying nil's for optional values. */ | 2300 | by explicitly supplying nil's for optional values. */ |
| 2301 | SAFE_ALLOCA_LISP (funcall_args, 1 + XSUBR (fun)->max_args); | 2301 | SAFE_ALLOCA_LISP (funcall_args, 1 + XSUBR (fun)->max_args); |
| 2302 | for (i = numargs; i < XSUBR (fun)->max_args; /* nothing */) | 2302 | memsetnil (funcall_args + numargs + 1, XSUBR (fun)->max_args - numargs); |
| 2303 | funcall_args[++i] = Qnil; | ||
| 2304 | funcall_nargs = 1 + XSUBR (fun)->max_args; | 2303 | funcall_nargs = 1 + XSUBR (fun)->max_args; |
| 2305 | } | 2304 | } |
| 2306 | else | 2305 | else |
| @@ -2638,8 +2637,8 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */) | |||
| 2638 | ptrdiff_t numargs = nargs - 1; | 2637 | ptrdiff_t numargs = nargs - 1; |
| 2639 | Lisp_Object lisp_numargs; | 2638 | Lisp_Object lisp_numargs; |
| 2640 | Lisp_Object val; | 2639 | Lisp_Object val; |
| 2641 | register Lisp_Object *internal_args; | 2640 | Lisp_Object *internal_args; |
| 2642 | ptrdiff_t i, count; | 2641 | ptrdiff_t count; |
| 2643 | 2642 | ||
| 2644 | QUIT; | 2643 | QUIT; |
| 2645 | 2644 | ||
| @@ -2694,8 +2693,8 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */) | |||
| 2694 | eassert (XSUBR (fun)->max_args <= ARRAYELTS (internal_argbuf)); | 2693 | eassert (XSUBR (fun)->max_args <= ARRAYELTS (internal_argbuf)); |
| 2695 | internal_args = internal_argbuf; | 2694 | internal_args = internal_argbuf; |
| 2696 | memcpy (internal_args, args + 1, numargs * word_size); | 2695 | memcpy (internal_args, args + 1, numargs * word_size); |
| 2697 | for (i = numargs; i < XSUBR (fun)->max_args; i++) | 2696 | memsetnil (internal_args + numargs, |
| 2698 | internal_args[i] = Qnil; | 2697 | XSUBR (fun)->max_args - numargs); |
| 2699 | } | 2698 | } |
| 2700 | else | 2699 | else |
| 2701 | internal_args = args + 1; | 2700 | internal_args = args + 1; |
diff --git a/src/fileio.c b/src/fileio.c index dc67a00ed2a..ff6720d4ae2 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -2812,7 +2812,8 @@ or if SELinux is disabled, or if Emacs lacks SELinux support. */) | |||
| 2812 | (Lisp_Object filename) | 2812 | (Lisp_Object filename) |
| 2813 | { | 2813 | { |
| 2814 | Lisp_Object absname; | 2814 | Lisp_Object absname; |
| 2815 | Lisp_Object values[4]; | 2815 | Lisp_Object user = Qnil, role = Qnil, type = Qnil, range = Qnil; |
| 2816 | |||
| 2816 | Lisp_Object handler; | 2817 | Lisp_Object handler; |
| 2817 | #if HAVE_LIBSELINUX | 2818 | #if HAVE_LIBSELINUX |
| 2818 | security_context_t con; | 2819 | security_context_t con; |
| @@ -2830,10 +2831,6 @@ or if SELinux is disabled, or if Emacs lacks SELinux support. */) | |||
| 2830 | 2831 | ||
| 2831 | absname = ENCODE_FILE (absname); | 2832 | absname = ENCODE_FILE (absname); |
| 2832 | 2833 | ||
| 2833 | values[0] = Qnil; | ||
| 2834 | values[1] = Qnil; | ||
| 2835 | values[2] = Qnil; | ||
| 2836 | values[3] = Qnil; | ||
| 2837 | #if HAVE_LIBSELINUX | 2834 | #if HAVE_LIBSELINUX |
| 2838 | if (is_selinux_enabled ()) | 2835 | if (is_selinux_enabled ()) |
| 2839 | { | 2836 | { |
| @@ -2842,20 +2839,20 @@ or if SELinux is disabled, or if Emacs lacks SELinux support. */) | |||
| 2842 | { | 2839 | { |
| 2843 | context = context_new (con); | 2840 | context = context_new (con); |
| 2844 | if (context_user_get (context)) | 2841 | if (context_user_get (context)) |
| 2845 | values[0] = build_string (context_user_get (context)); | 2842 | user = build_string (context_user_get (context)); |
| 2846 | if (context_role_get (context)) | 2843 | if (context_role_get (context)) |
| 2847 | values[1] = build_string (context_role_get (context)); | 2844 | role = build_string (context_role_get (context)); |
| 2848 | if (context_type_get (context)) | 2845 | if (context_type_get (context)) |
| 2849 | values[2] = build_string (context_type_get (context)); | 2846 | type = build_string (context_type_get (context)); |
| 2850 | if (context_range_get (context)) | 2847 | if (context_range_get (context)) |
| 2851 | values[3] = build_string (context_range_get (context)); | 2848 | range = build_string (context_range_get (context)); |
| 2852 | context_free (context); | 2849 | context_free (context); |
| 2853 | freecon (con); | 2850 | freecon (con); |
| 2854 | } | 2851 | } |
| 2855 | } | 2852 | } |
| 2856 | #endif | 2853 | #endif |
| 2857 | 2854 | ||
| 2858 | return Flist (ARRAYELTS (values), values); | 2855 | return list4 (user, role, type, range); |
| 2859 | } | 2856 | } |
| 2860 | 2857 | ||
| 2861 | DEFUN ("set-file-selinux-context", Fset_file_selinux_context, | 2858 | DEFUN ("set-file-selinux-context", Fset_file_selinux_context, |
| @@ -2517,16 +2517,14 @@ usage: (nconc &rest LISTS) */) | |||
| 2517 | static void | 2517 | static void |
| 2518 | mapcar1 (EMACS_INT leni, Lisp_Object *vals, Lisp_Object fn, Lisp_Object seq) | 2518 | mapcar1 (EMACS_INT leni, Lisp_Object *vals, Lisp_Object fn, Lisp_Object seq) |
| 2519 | { | 2519 | { |
| 2520 | register Lisp_Object tail; | 2520 | Lisp_Object tail, dummy; |
| 2521 | Lisp_Object dummy; | 2521 | EMACS_INT i; |
| 2522 | register EMACS_INT i; | ||
| 2523 | struct gcpro gcpro1, gcpro2, gcpro3; | 2522 | struct gcpro gcpro1, gcpro2, gcpro3; |
| 2524 | 2523 | ||
| 2525 | if (vals) | 2524 | if (vals) |
| 2526 | { | 2525 | { |
| 2527 | /* Don't let vals contain any garbage when GC happens. */ | 2526 | /* Don't let vals contain any garbage when GC happens. */ |
| 2528 | for (i = 0; i < leni; i++) | 2527 | memsetnil (vals, leni); |
| 2529 | vals[i] = Qnil; | ||
| 2530 | 2528 | ||
| 2531 | GCPRO3 (dummy, fn, seq); | 2529 | GCPRO3 (dummy, fn, seq); |
| 2532 | gcpro1.var = vals; | 2530 | gcpro1.var = vals; |
| @@ -3688,7 +3686,7 @@ Lisp_Object | |||
| 3688 | larger_vector (Lisp_Object vec, ptrdiff_t incr_min, ptrdiff_t nitems_max) | 3686 | larger_vector (Lisp_Object vec, ptrdiff_t incr_min, ptrdiff_t nitems_max) |
| 3689 | { | 3687 | { |
| 3690 | struct Lisp_Vector *v; | 3688 | struct Lisp_Vector *v; |
| 3691 | ptrdiff_t i, incr, incr_max, old_size, new_size; | 3689 | ptrdiff_t incr, incr_max, old_size, new_size; |
| 3692 | ptrdiff_t C_language_max = min (PTRDIFF_MAX, SIZE_MAX) / sizeof *v->contents; | 3690 | ptrdiff_t C_language_max = min (PTRDIFF_MAX, SIZE_MAX) / sizeof *v->contents; |
| 3693 | ptrdiff_t n_max = (0 <= nitems_max && nitems_max < C_language_max | 3691 | ptrdiff_t n_max = (0 <= nitems_max && nitems_max < C_language_max |
| 3694 | ? nitems_max : C_language_max); | 3692 | ? nitems_max : C_language_max); |
| @@ -3702,8 +3700,7 @@ larger_vector (Lisp_Object vec, ptrdiff_t incr_min, ptrdiff_t nitems_max) | |||
| 3702 | new_size = old_size + incr; | 3700 | new_size = old_size + incr; |
| 3703 | v = allocate_vector (new_size); | 3701 | v = allocate_vector (new_size); |
| 3704 | memcpy (v->contents, XVECTOR (vec)->contents, old_size * sizeof *v->contents); | 3702 | memcpy (v->contents, XVECTOR (vec)->contents, old_size * sizeof *v->contents); |
| 3705 | for (i = old_size; i < new_size; ++i) | 3703 | memsetnil (v->contents + old_size, new_size - old_size); |
| 3706 | v->contents[i] = Qnil; | ||
| 3707 | XSETVECTOR (vec, v); | 3704 | XSETVECTOR (vec, v); |
| 3708 | return vec; | 3705 | return vec; |
| 3709 | } | 3706 | } |
diff --git a/src/font.c b/src/font.c index 56a27821718..190b33a8ef0 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -989,15 +989,14 @@ font_expand_wildcards (Lisp_Object *field, int n) | |||
| 989 | if (i == 0 || ! NILP (tmp[i - 1])) | 989 | if (i == 0 || ! NILP (tmp[i - 1])) |
| 990 | /* None of TMP[X] corresponds to Jth field. */ | 990 | /* None of TMP[X] corresponds to Jth field. */ |
| 991 | return -1; | 991 | return -1; |
| 992 | for (; j < range[i].from; j++) | 992 | memsetnil (field + j, range[i].from - j); |
| 993 | field[j] = Qnil; | 993 | j = range[i].from; |
| 994 | } | 994 | } |
| 995 | field[j++] = tmp[i]; | 995 | field[j++] = tmp[i]; |
| 996 | } | 996 | } |
| 997 | if (! NILP (tmp[n - 1]) && j < XLFD_REGISTRY_INDEX) | 997 | if (! NILP (tmp[n - 1]) && j < XLFD_REGISTRY_INDEX) |
| 998 | return -1; | 998 | return -1; |
| 999 | for (; j < XLFD_LAST_INDEX; j++) | 999 | memsetnil (field + j, XLFD_LAST_INDEX - j); |
| 1000 | field[j] = Qnil; | ||
| 1001 | if (INTEGERP (field[XLFD_ENCODING_INDEX])) | 1000 | if (INTEGERP (field[XLFD_ENCODING_INDEX])) |
| 1002 | field[XLFD_ENCODING_INDEX] | 1001 | field[XLFD_ENCODING_INDEX] |
| 1003 | = Fintern (Fnumber_to_string (field[XLFD_ENCODING_INDEX]), Qnil); | 1002 | = Fintern (Fnumber_to_string (field[XLFD_ENCODING_INDEX]), Qnil); |
diff --git a/src/fringe.c b/src/fringe.c index c7262d19336..464379d0cd0 100644 --- a/src/fringe.c +++ b/src/fringe.c | |||
| @@ -1723,15 +1723,12 @@ init_fringe_once (void) | |||
| 1723 | void | 1723 | void |
| 1724 | init_fringe (void) | 1724 | init_fringe (void) |
| 1725 | { | 1725 | { |
| 1726 | int i; | ||
| 1727 | |||
| 1728 | max_fringe_bitmaps = MAX_STANDARD_FRINGE_BITMAPS + 20; | 1726 | max_fringe_bitmaps = MAX_STANDARD_FRINGE_BITMAPS + 20; |
| 1729 | 1727 | ||
| 1730 | fringe_bitmaps = xzalloc (max_fringe_bitmaps * sizeof *fringe_bitmaps); | 1728 | fringe_bitmaps = xzalloc (max_fringe_bitmaps * sizeof *fringe_bitmaps); |
| 1731 | fringe_faces = xmalloc (max_fringe_bitmaps * sizeof *fringe_faces); | ||
| 1732 | 1729 | ||
| 1733 | for (i = 0; i < max_fringe_bitmaps; i++) | 1730 | verify (NIL_IS_ZERO); |
| 1734 | fringe_faces[i] = Qnil; | 1731 | fringe_faces = xzalloc (max_fringe_bitmaps * sizeof *fringe_faces); |
| 1735 | } | 1732 | } |
| 1736 | 1733 | ||
| 1737 | #ifdef HAVE_NTGUI | 1734 | #ifdef HAVE_NTGUI |
diff --git a/src/lisp.h b/src/lisp.h index e94e39a5d01..65e6c626527 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -732,14 +732,18 @@ struct Lisp_Symbol | |||
| 732 | TAG_PTR (Lisp_Symbol, \ | 732 | TAG_PTR (Lisp_Symbol, \ |
| 733 | ((uintptr_t) (offset) >> (USE_LSB_TAG ? 0 : GCTYPEBITS))) | 733 | ((uintptr_t) (offset) >> (USE_LSB_TAG ? 0 : GCTYPEBITS))) |
| 734 | 734 | ||
| 735 | /* XLI_BUILTIN_LISPSYM (iQwhatever) is equivalent to | ||
| 736 | XLI (builtin_lisp_symbol (Qwhatever)), | ||
| 737 | except the former expands to an integer constant expression. */ | ||
| 738 | #define XLI_BUILTIN_LISPSYM(iname) TAG_SYMOFFSET ((iname) * sizeof *lispsym) | ||
| 739 | |||
| 735 | /* Declare extern constants for Lisp symbols. These can be helpful | 740 | /* Declare extern constants for Lisp symbols. These can be helpful |
| 736 | when using a debugger like GDB, on older platforms where the debug | 741 | when using a debugger like GDB, on older platforms where the debug |
| 737 | format does not represent C macros. */ | 742 | format does not represent C macros. */ |
| 738 | #define DEFINE_LISP_SYMBOL_BEGIN(name) \ | 743 | #define DEFINE_LISP_SYMBOL_BEGIN(name) \ |
| 739 | DEFINE_GDB_SYMBOL_BEGIN (Lisp_Object, name) | 744 | DEFINE_GDB_SYMBOL_BEGIN (Lisp_Object, name) |
| 740 | #define DEFINE_LISP_SYMBOL_END(name) \ | 745 | #define DEFINE_LISP_SYMBOL_END(name) \ |
| 741 | DEFINE_GDB_SYMBOL_END (LISP_INITIALLY (TAG_SYMOFFSET (i##name \ | 746 | DEFINE_GDB_SYMBOL_END (LISP_INITIALLY (XLI_BUILTIN_LISPSYM (i##name))) |
| 742 | * sizeof *lispsym))) | ||
| 743 | 747 | ||
| 744 | #include "globals.h" | 748 | #include "globals.h" |
| 745 | 749 | ||
| @@ -1504,6 +1508,20 @@ gc_aset (Lisp_Object array, ptrdiff_t idx, Lisp_Object val) | |||
| 1504 | XVECTOR (array)->contents[idx] = val; | 1508 | XVECTOR (array)->contents[idx] = val; |
| 1505 | } | 1509 | } |
| 1506 | 1510 | ||
| 1511 | /* True, since Qnil's representation is zero. Every place in the code | ||
| 1512 | that assumes Qnil is zero should verify (NIL_IS_ZERO), to make it easy | ||
| 1513 | to find such assumptions later if we change Qnil to be nonzero. */ | ||
| 1514 | enum { NIL_IS_ZERO = XLI_BUILTIN_LISPSYM (iQnil) == 0 }; | ||
| 1515 | |||
| 1516 | /* Set a Lisp_Object array V's SIZE entries to nil. */ | ||
| 1517 | INLINE void | ||
| 1518 | memsetnil (Lisp_Object *v, ptrdiff_t size) | ||
| 1519 | { | ||
| 1520 | eassert (0 <= size); | ||
| 1521 | verify (NIL_IS_ZERO); | ||
| 1522 | memset (v, 0, size * sizeof *v); | ||
| 1523 | } | ||
| 1524 | |||
| 1507 | /* If a struct is made to look like a vector, this macro returns the length | 1525 | /* If a struct is made to look like a vector, this macro returns the length |
| 1508 | of the shortest vector that would hold that struct. */ | 1526 | of the shortest vector that would hold that struct. */ |
| 1509 | 1527 | ||
diff --git a/src/xdisp.c b/src/xdisp.c index fcc0809a464..208c1243e35 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -2753,6 +2753,9 @@ init_iterator (struct it *it, struct window *w, | |||
| 2753 | } | 2753 | } |
| 2754 | 2754 | ||
| 2755 | /* Clear IT. */ | 2755 | /* Clear IT. */ |
| 2756 | /* As a side effect, this sets it->object to nil, so verify we will | ||
| 2757 | indeed get that. */ | ||
| 2758 | verify (NIL_IS_ZERO); | ||
| 2756 | memset (it, 0, sizeof *it); | 2759 | memset (it, 0, sizeof *it); |
| 2757 | it->current.overlay_string_index = -1; | 2760 | it->current.overlay_string_index = -1; |
| 2758 | it->current.dpvec_index = -1; | 2761 | it->current.dpvec_index = -1; |
diff --git a/test/ChangeLog b/test/ChangeLog index 15baf866f37..4b9e7a92621 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,8 +1,21 @@ | |||
| 1 | 2015-01-18 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * automated/Makefile.in (EMACS_EXTRAOPT): New var. | ||
| 4 | (EMACSOPT): Use it. | ||
| 5 | |||
| 6 | * automated/cl-generic-tests.el (cl-generic-test-10-weird): New test. | ||
| 7 | Rename other tests to preserve ordering. | ||
| 8 | |||
| 1 | 2015-01-18 Leo Liu <sdl.web@gmail.com> | 9 | 2015-01-18 Leo Liu <sdl.web@gmail.com> |
| 2 | 10 | ||
| 3 | * automated/seq-tests.el (test-seq-subseq): Add more tests. | 11 | * automated/seq-tests.el (test-seq-subseq): Add more tests. |
| 4 | (Bug#19434) | 12 | (Bug#19434) |
| 5 | 13 | ||
| 14 | 2015-01-18 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 15 | |||
| 16 | * automated/eieio-test-methodinvoke.el (eieio-test-cl-generic-1): | ||
| 17 | Test `subclass' specializer. | ||
| 18 | |||
| 6 | 2015-01-17 Stefan Monnier <monnier@iro.umontreal.ca> | 19 | 2015-01-17 Stefan Monnier <monnier@iro.umontreal.ca> |
| 7 | 20 | ||
| 8 | * automated/eieio-tests.el | 21 | * automated/eieio-tests.el |
diff --git a/test/automated/Makefile.in b/test/automated/Makefile.in index 7243e8af14a..faf0b3d8339 100644 --- a/test/automated/Makefile.in +++ b/test/automated/Makefile.in | |||
| @@ -39,10 +39,12 @@ SEPCHAR = @SEPCHAR@ | |||
| 39 | # directory, we can use emacs --chdir. | 39 | # directory, we can use emacs --chdir. |
| 40 | EMACS = ../../src/emacs | 40 | EMACS = ../../src/emacs |
| 41 | 41 | ||
| 42 | EMACS_EXTRAOPT= | ||
| 43 | |||
| 42 | # Command line flags for Emacs. | 44 | # Command line flags for Emacs. |
| 43 | # Apparently MSYS bash would convert "-L :" to "-L ;" anyway, | 45 | # Apparently MSYS bash would convert "-L :" to "-L ;" anyway, |
| 44 | # but we might as well be explicit. | 46 | # but we might as well be explicit. |
| 45 | EMACSOPT = -batch --no-site-file --no-site-lisp -L "$(SEPCHAR)$(srcdir)" | 47 | EMACSOPT = -batch --no-site-file --no-site-lisp -L "$(SEPCHAR)$(srcdir)" $(EMACS_EXTRAOPT) |
| 46 | 48 | ||
| 47 | # Prevent any settings in the user environment causing problems. | 49 | # Prevent any settings in the user environment causing problems. |
| 48 | unexport EMACSDATA EMACSDOC EMACSPATH GREP_OPTIONS | 50 | unexport EMACSDATA EMACSDOC EMACSPATH GREP_OPTIONS |
diff --git a/test/automated/cl-generic-tests.el b/test/automated/cl-generic-tests.el index 46397fb7f51..1c01d9b164b 100644 --- a/test/automated/cl-generic-tests.el +++ b/test/automated/cl-generic-tests.el | |||
| @@ -29,12 +29,12 @@ | |||
| 29 | (cl-defgeneric cl--generic-1 (x y)) | 29 | (cl-defgeneric cl--generic-1 (x y)) |
| 30 | (cl-defgeneric (setf cl--generic-1) (v y z) "My generic doc.") | 30 | (cl-defgeneric (setf cl--generic-1) (v y z) "My generic doc.") |
| 31 | 31 | ||
| 32 | (ert-deftest cl-generic-test-0 () | 32 | (ert-deftest cl-generic-test-00 () |
| 33 | (cl-defgeneric cl--generic-1 (x y)) | 33 | (cl-defgeneric cl--generic-1 (x y)) |
| 34 | (cl-defmethod cl--generic-1 ((x t) y) (cons x y)) | 34 | (cl-defmethod cl--generic-1 ((x t) y) (cons x y)) |
| 35 | (should (equal (cl--generic-1 'a 'b) '(a . b)))) | 35 | (should (equal (cl--generic-1 'a 'b) '(a . b)))) |
| 36 | 36 | ||
| 37 | (ert-deftest cl-generic-test-1-eql () | 37 | (ert-deftest cl-generic-test-01-eql () |
| 38 | (cl-defgeneric cl--generic-1 (x y)) | 38 | (cl-defgeneric cl--generic-1 (x y)) |
| 39 | (cl-defmethod cl--generic-1 ((x t) y) (cons x y)) | 39 | (cl-defmethod cl--generic-1 ((x t) y) (cons x y)) |
| 40 | (cl-defmethod cl--generic-1 ((_x (eql 4)) _y) | 40 | (cl-defmethod cl--generic-1 ((_x (eql 4)) _y) |
| @@ -53,7 +53,7 @@ | |||
| 53 | (cl-defstruct (cl-generic-struct-child11 (:include cl-generic-struct-child1)) d) | 53 | (cl-defstruct (cl-generic-struct-child11 (:include cl-generic-struct-child1)) d) |
| 54 | (cl-defstruct (cl-generic-struct-child2 (:include cl-generic-struct-parent)) e) | 54 | (cl-defstruct (cl-generic-struct-child2 (:include cl-generic-struct-parent)) e) |
| 55 | 55 | ||
| 56 | (ert-deftest cl-generic-test-2-struct () | 56 | (ert-deftest cl-generic-test-02-struct () |
| 57 | (cl-defgeneric cl--generic-1 (x y) "My doc.") | 57 | (cl-defgeneric cl--generic-1 (x y) "My doc.") |
| 58 | (cl-defmethod cl--generic-1 ((x t) y) "Doc 1." (cons x y)) | 58 | (cl-defmethod cl--generic-1 ((x t) y) "Doc 1." (cons x y)) |
| 59 | (cl-defmethod cl--generic-1 ((_x cl-generic-struct-parent) y) | 59 | (cl-defmethod cl--generic-1 ((_x cl-generic-struct-parent) y) |
| @@ -73,7 +73,7 @@ | |||
| 73 | (should (equal (cl--generic-1 (make-cl-generic-struct-child11) nil) | 73 | (should (equal (cl--generic-1 (make-cl-generic-struct-child11) nil) |
| 74 | '("child11" "around""child1" "parent" a)))) | 74 | '("child11" "around""child1" "parent" a)))) |
| 75 | 75 | ||
| 76 | (ert-deftest cl-generic-test-3-setf () | 76 | (ert-deftest cl-generic-test-03-setf () |
| 77 | (cl-defmethod (setf cl--generic-1) (v (y t) z) (list v y z)) | 77 | (cl-defmethod (setf cl--generic-1) (v (y t) z) (list v y z)) |
| 78 | (cl-defmethod (setf cl--generic-1) (v (_y (eql 4)) z) (list v "four" z)) | 78 | (cl-defmethod (setf cl--generic-1) (v (_y (eql 4)) z) (list v "four" z)) |
| 79 | (should (equal (setf (cl--generic-1 'a 'b) 'v) '(v a b))) | 79 | (should (equal (setf (cl--generic-1 'a 'b) 'v) '(v a b))) |
| @@ -85,7 +85,7 @@ | |||
| 85 | '(v a b))) | 85 | '(v a b))) |
| 86 | (should (equal x '(3 2 1))))) | 86 | (should (equal x '(3 2 1))))) |
| 87 | 87 | ||
| 88 | (ert-deftest cl-generic-test-4-overlapping-tagcodes () | 88 | (ert-deftest cl-generic-test-04-overlapping-tagcodes () |
| 89 | (cl-defgeneric cl--generic-1 (x y) "My doc.") | 89 | (cl-defgeneric cl--generic-1 (x y) "My doc.") |
| 90 | (cl-defmethod cl--generic-1 ((y t) z) (list y z)) | 90 | (cl-defmethod cl--generic-1 ((y t) z) (list y z)) |
| 91 | (cl-defmethod cl--generic-1 ((_y (eql 4)) _z) | 91 | (cl-defmethod cl--generic-1 ((_y (eql 4)) _z) |
| @@ -98,7 +98,7 @@ | |||
| 98 | (should (equal (cl--generic-1 1 'b) '("integer" "number" 1 b))) | 98 | (should (equal (cl--generic-1 1 'b) '("integer" "number" 1 b))) |
| 99 | (should (equal (cl--generic-1 4 'b) '("four" "integer" "number" 4 b)))) | 99 | (should (equal (cl--generic-1 4 'b) '("four" "integer" "number" 4 b)))) |
| 100 | 100 | ||
| 101 | (ert-deftest cl-generic-test-5-alias () | 101 | (ert-deftest cl-generic-test-05-alias () |
| 102 | (cl-defgeneric cl--generic-1 (x y) "My doc.") | 102 | (cl-defgeneric cl--generic-1 (x y) "My doc.") |
| 103 | (defalias 'cl--generic-2 #'cl--generic-1) | 103 | (defalias 'cl--generic-2 #'cl--generic-1) |
| 104 | (cl-defmethod cl--generic-1 ((y t) z) (list y z)) | 104 | (cl-defmethod cl--generic-1 ((y t) z) (list y z)) |
| @@ -106,7 +106,7 @@ | |||
| 106 | (cons "four" (cl-call-next-method))) | 106 | (cons "four" (cl-call-next-method))) |
| 107 | (should (equal (cl--generic-1 4 'b) '("four" 4 b)))) | 107 | (should (equal (cl--generic-1 4 'b) '("four" 4 b)))) |
| 108 | 108 | ||
| 109 | (ert-deftest cl-generic-test-6-multiple-dispatch () | 109 | (ert-deftest cl-generic-test-06-multiple-dispatch () |
| 110 | (cl-defgeneric cl--generic-1 (x y) "My doc.") | 110 | (cl-defgeneric cl--generic-1 (x y) "My doc.") |
| 111 | (cl-defmethod cl--generic-1 (x y) (list x y)) | 111 | (cl-defmethod cl--generic-1 (x y) (list x y)) |
| 112 | (cl-defmethod cl--generic-1 (_x (_y integer)) | 112 | (cl-defmethod cl--generic-1 (_x (_y integer)) |
| @@ -117,7 +117,7 @@ | |||
| 117 | (cons "x&y-int" (cl-call-next-method))) | 117 | (cons "x&y-int" (cl-call-next-method))) |
| 118 | (should (equal (cl--generic-1 1 2) '("x&y-int" "x-int" "y-int" 1 2)))) | 118 | (should (equal (cl--generic-1 1 2) '("x&y-int" "x-int" "y-int" 1 2)))) |
| 119 | 119 | ||
| 120 | (ert-deftest cl-generic-test-7-apo () | 120 | (ert-deftest cl-generic-test-07-apo () |
| 121 | (cl-defgeneric cl--generic-1 (x y) | 121 | (cl-defgeneric cl--generic-1 (x y) |
| 122 | (:documentation "My doc.") (:argument-precedence-order y x)) | 122 | (:documentation "My doc.") (:argument-precedence-order y x)) |
| 123 | (cl-defmethod cl--generic-1 (x y) (list x y)) | 123 | (cl-defmethod cl--generic-1 (x y) (list x y)) |
| @@ -129,7 +129,7 @@ | |||
| 129 | (cons "x&y-int" (cl-call-next-method))) | 129 | (cons "x&y-int" (cl-call-next-method))) |
| 130 | (should (equal (cl--generic-1 1 2) '("x&y-int" "y-int" "x-int" 1 2)))) | 130 | (should (equal (cl--generic-1 1 2) '("x&y-int" "y-int" "x-int" 1 2)))) |
| 131 | 131 | ||
| 132 | (ert-deftest cl-generic-test-8-after/before () | 132 | (ert-deftest cl-generic-test-08-after/before () |
| 133 | (let ((log ())) | 133 | (let ((log ())) |
| 134 | (cl-defgeneric cl--generic-1 (x y)) | 134 | (cl-defgeneric cl--generic-1 (x y)) |
| 135 | (cl-defmethod cl--generic-1 ((_x t) y) (cons y log)) | 135 | (cl-defmethod cl--generic-1 ((_x t) y) (cons y log)) |
| @@ -144,7 +144,7 @@ | |||
| 144 | 144 | ||
| 145 | (defun cl--generic-test-advice (&rest args) (cons "advice" (apply args))) | 145 | (defun cl--generic-test-advice (&rest args) (cons "advice" (apply args))) |
| 146 | 146 | ||
| 147 | (ert-deftest cl-generic-test-9-advice () | 147 | (ert-deftest cl-generic-test-09-advice () |
| 148 | (cl-defgeneric cl--generic-1 (x y) "My doc.") | 148 | (cl-defgeneric cl--generic-1 (x y) "My doc.") |
| 149 | (cl-defmethod cl--generic-1 (x y) (list x y)) | 149 | (cl-defmethod cl--generic-1 (x y) (list x y)) |
| 150 | (advice-add 'cl--generic-1 :around #'cl--generic-test-advice) | 150 | (advice-add 'cl--generic-1 :around #'cl--generic-test-advice) |
| @@ -155,5 +155,16 @@ | |||
| 155 | (advice-remove 'cl--generic-1 #'cl--generic-test-advice) | 155 | (advice-remove 'cl--generic-1 #'cl--generic-test-advice) |
| 156 | (should (equal (cl--generic-1 4 5) '("integer" 4 5)))) | 156 | (should (equal (cl--generic-1 4 5) '("integer" 4 5)))) |
| 157 | 157 | ||
| 158 | (ert-deftest cl-generic-test-10-weird () | ||
| 159 | (cl-defgeneric cl--generic-1 (x &rest r) "My doc.") | ||
| 160 | (cl-defmethod cl--generic-1 (x &rest r) (cons x r)) | ||
| 161 | ;; This kind of definition is not valid according to CLHS, but it does show | ||
| 162 | ;; up in EIEIO's tests for no-next-method, so we should either | ||
| 163 | ;; detect it and signal an error or do something meaningful with it. | ||
| 164 | (cl-defmethod cl--generic-1 (x (y integer) &rest r) | ||
| 165 | `("integer" ,y ,x ,@r)) | ||
| 166 | (should (equal (cl--generic-1 'a 'b) '(a b))) | ||
| 167 | (should (equal (cl--generic-1 1 2) '("integer" 2 1)))) | ||
| 168 | |||
| 158 | (provide 'cl-generic-tests) | 169 | (provide 'cl-generic-tests) |
| 159 | ;;; cl-generic-tests.el ends here | 170 | ;;; cl-generic-tests.el ends here |
diff --git a/test/automated/eieio-test-methodinvoke.el b/test/automated/eieio-test-methodinvoke.el index b6d60b85815..3918fb904fe 100644 --- a/test/automated/eieio-test-methodinvoke.el +++ b/test/automated/eieio-test-methodinvoke.el | |||
| @@ -388,10 +388,13 @@ | |||
| 388 | (cons "CNM-0" (cl-call-next-method 7 y))) | 388 | (cons "CNM-0" (cl-call-next-method 7 y))) |
| 389 | (cl-defmethod eieio-test--1 ((_x CNM-1-1) _y) | 389 | (cl-defmethod eieio-test--1 ((_x CNM-1-1) _y) |
| 390 | (cons "CNM-1-1" (cl-call-next-method))) | 390 | (cons "CNM-1-1" (cl-call-next-method))) |
| 391 | (cl-defmethod eieio-test--1 ((_x CNM-1-2) y) | 391 | (cl-defmethod eieio-test--1 ((_x CNM-1-2) _y) |
| 392 | (cons "CNM-1-2" (cl-call-next-method))) | 392 | (cons "CNM-1-2" (cl-call-next-method))) |
| 393 | (cl-defmethod eieio-test--1 ((_x (subclass CNM-1-2)) _y) | ||
| 394 | (cons "subclass CNM-1-2" (cl-call-next-method))) | ||
| 393 | (should (equal (eieio-test--1 4 5) '(4 5))) | 395 | (should (equal (eieio-test--1 4 5) '(4 5))) |
| 394 | (should (equal (eieio-test--1 (make-instance 'CNM-0) 5) | 396 | (should (equal (eieio-test--1 (make-instance 'CNM-0) 5) |
| 395 | '("CNM-0" 7 5))) | 397 | '("CNM-0" 7 5))) |
| 396 | (should (equal (eieio-test--1 (make-instance 'CNM-2) 5) | 398 | (should (equal (eieio-test--1 (make-instance 'CNM-2) 5) |
| 397 | '("CNM-1-1" "CNM-1-2" "CNM-0" 7 5)))) | 399 | '("CNM-1-1" "CNM-1-2" "CNM-0" 7 5))) |
| 400 | (should (equal (eieio-test--1 'CNM-2 6) '("subclass CNM-1-2" CNM-2 6)))) | ||