diff options
| -rw-r--r-- | doc/lispref/files.texi | 12 | ||||
| -rw-r--r-- | lisp/progmodes/elisp-mode.el | 8 | ||||
| -rw-r--r-- | test/automated/elisp-mode-tests.el | 44 |
3 files changed, 36 insertions, 28 deletions
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index 735e08eb324..edfb045a795 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi | |||
| @@ -2421,11 +2421,13 @@ the file, which in some cases may cause a security hole. | |||
| 2421 | This section describes low-level subroutines for completing a file | 2421 | This section describes low-level subroutines for completing a file |
| 2422 | name. For higher level functions, see @ref{Reading File Names}. | 2422 | name. For higher level functions, see @ref{Reading File Names}. |
| 2423 | 2423 | ||
| 2424 | @defun file-name-all-completions partial-filename directory | 2424 | @defun file-name-all-completions partial-filename directory &optional predicate |
| 2425 | This function returns a list of all possible completions for a file | 2425 | This function returns a list of all possible completions for a file in |
| 2426 | whose name starts with @var{partial-filename} in directory | 2426 | directory @var{directory} whose name starts with |
| 2427 | @var{directory}. The order of the completions is the order of the files | 2427 | @var{partial-filename} and for which @var{predicate} (called with the |
| 2428 | in the directory, which is unpredictable and conveys no useful | 2428 | filename) returns non-nil. If @var{predicate} is nil (the default), it |
| 2429 | is ignored. The order of the completions is the order of the files in | ||
| 2430 | the directory, which is unpredictable and conveys no useful | ||
| 2429 | information. | 2431 | information. |
| 2430 | 2432 | ||
| 2431 | The argument @var{partial-filename} must be a file name containing no | 2433 | The argument @var{partial-filename} must be a file name containing no |
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 8afae150a1d..7614bacf1bb 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el | |||
| @@ -720,10 +720,15 @@ non-nil result supercedes the xrefs produced by | |||
| 720 | (dolist (method (cl--generic-method-table generic)) | 720 | (dolist (method (cl--generic-method-table generic)) |
| 721 | (let* ((info (cl--generic-method-info method));; qual-string combined-args doconly | 721 | (let* ((info (cl--generic-method-info method));; qual-string combined-args doconly |
| 722 | (specializers (cl--generic-method-specializers method)) | 722 | (specializers (cl--generic-method-specializers method)) |
| 723 | (non-default nil) | ||
| 723 | (met-name (cons symbol specializers)) | 724 | (met-name (cons symbol specializers)) |
| 724 | (file (find-lisp-object-file-name met-name 'cl-defmethod))) | 725 | (file (find-lisp-object-file-name met-name 'cl-defmethod))) |
| 726 | (dolist (item specializers) | ||
| 727 | ;; default method has all 't' in specializers | ||
| 728 | (setq non-default (or non-default (not (equal t item))))) | ||
| 729 | |||
| 725 | (when (and file | 730 | (when (and file |
| 726 | (or specializers ;; default method has null specializers | 731 | (or non-default |
| 727 | (nth 2 info))) ;; assuming only co-located default has null doc string | 732 | (nth 2 info))) ;; assuming only co-located default has null doc string |
| 728 | (if specializers | 733 | (if specializers |
| 729 | (let ((summary (format elisp--xref-format-extra 'cl-defmethod symbol (nth 1 info)))) | 734 | (let ((summary (format elisp--xref-format-extra 'cl-defmethod symbol (nth 1 info)))) |
| @@ -800,6 +805,7 @@ non-nil result supercedes the xrefs produced by | |||
| 800 | (declare-function project-current "project") | 805 | (declare-function project-current "project") |
| 801 | 806 | ||
| 802 | (defun elisp--xref-find-references (symbol) | 807 | (defun elisp--xref-find-references (symbol) |
| 808 | "Find all references to SYMBOL (a string) in the current project." | ||
| 803 | (cl-mapcan | 809 | (cl-mapcan |
| 804 | (lambda (dir) | 810 | (lambda (dir) |
| 805 | (xref-collect-references symbol dir)) | 811 | (xref-collect-references symbol dir)) |
diff --git a/test/automated/elisp-mode-tests.el b/test/automated/elisp-mode-tests.el index 7886b557141..2f6675a2804 100644 --- a/test/automated/elisp-mode-tests.el +++ b/test/automated/elisp-mode-tests.el | |||
| @@ -258,7 +258,7 @@ to (xref-elisp-test-descr-to-target xref)." | |||
| 258 | (cl-defstruct (xref-elisp-root-type) | 258 | (cl-defstruct (xref-elisp-root-type) |
| 259 | slot-1) | 259 | slot-1) |
| 260 | 260 | ||
| 261 | (cl-defgeneric xref-elisp-generic-no-methods () | 261 | (cl-defgeneric xref-elisp-generic-no-methods (arg1 arg2) |
| 262 | "doc string generic no-methods" | 262 | "doc string generic no-methods" |
| 263 | ;; No default implementation, no methods, but fboundp is true for | 263 | ;; No default implementation, no methods, but fboundp is true for |
| 264 | ;; this symbol; it calls cl-no-applicable-method | 264 | ;; this symbol; it calls cl-no-applicable-method |
| @@ -269,44 +269,44 @@ to (xref-elisp-test-descr-to-target xref)." | |||
| 269 | ;; causes the batch mode test to fail; the symbol shows up as | 269 | ;; causes the batch mode test to fail; the symbol shows up as |
| 270 | ;; ‘this’. It passes in interactive tests, so I haven't been able to | 270 | ;; ‘this’. It passes in interactive tests, so I haven't been able to |
| 271 | ;; track down the problem. | 271 | ;; track down the problem. |
| 272 | (cl-defmethod xref-elisp-generic-no-default ((this xref-elisp-root-type)) | 272 | (cl-defmethod xref-elisp-generic-no-default ((this xref-elisp-root-type) arg2) |
| 273 | "doc string generic no-default xref-elisp-root-type" | 273 | "doc string generic no-default xref-elisp-root-type" |
| 274 | "non-default for no-default") | 274 | "non-default for no-default") |
| 275 | 275 | ||
| 276 | ;; defgeneric after defmethod in file to ensure the fallback search | 276 | ;; defgeneric after defmethod in file to ensure the fallback search |
| 277 | ;; method of just looking for the function name will fail. | 277 | ;; method of just looking for the function name will fail. |
| 278 | (cl-defgeneric xref-elisp-generic-no-default () | 278 | (cl-defgeneric xref-elisp-generic-no-default (arg1 arg2) |
| 279 | "doc string generic no-default generic" | 279 | "doc string generic no-default generic" |
| 280 | ;; No default implementation; this function calls the cl-generic | 280 | ;; No default implementation; this function calls the cl-generic |
| 281 | ;; dispatching code. | 281 | ;; dispatching code. |
| 282 | ) | 282 | ) |
| 283 | 283 | ||
| 284 | (cl-defgeneric xref-elisp-generic-co-located-default () | 284 | (cl-defgeneric xref-elisp-generic-co-located-default (arg1 arg2) |
| 285 | "doc string generic co-located-default" | 285 | "doc string generic co-located-default" |
| 286 | "co-located default") | 286 | "co-located default") |
| 287 | 287 | ||
| 288 | (cl-defmethod xref-elisp-generic-co-located-default ((this xref-elisp-root-type)) | 288 | (cl-defmethod xref-elisp-generic-co-located-default ((this xref-elisp-root-type) arg2) |
| 289 | "doc string generic co-located-default xref-elisp-root-type" | 289 | "doc string generic co-located-default xref-elisp-root-type" |
| 290 | "non-default for co-located-default") | 290 | "non-default for co-located-default") |
| 291 | 291 | ||
| 292 | (cl-defgeneric xref-elisp-generic-separate-default () | 292 | (cl-defgeneric xref-elisp-generic-separate-default (arg1 arg2) |
| 293 | "doc string generic separate-default" | 293 | "doc string generic separate-default" |
| 294 | ;; default implementation provided separately | 294 | ;; default implementation provided separately |
| 295 | ) | 295 | ) |
| 296 | 296 | ||
| 297 | (cl-defmethod xref-elisp-generic-separate-default () | 297 | (cl-defmethod xref-elisp-generic-separate-default (arg1 arg2) |
| 298 | "doc string generic separate-default default" | 298 | "doc string generic separate-default default" |
| 299 | "separate default") | 299 | "separate default") |
| 300 | 300 | ||
| 301 | (cl-defmethod xref-elisp-generic-separate-default ((this xref-elisp-root-type)) | 301 | (cl-defmethod xref-elisp-generic-separate-default ((this xref-elisp-root-type) arg2) |
| 302 | "doc string generic separate-default xref-elisp-root-type" | 302 | "doc string generic separate-default xref-elisp-root-type" |
| 303 | "non-default for separate-default") | 303 | "non-default for separate-default") |
| 304 | 304 | ||
| 305 | (cl-defmethod xref-elisp-generic-implicit-generic () | 305 | (cl-defmethod xref-elisp-generic-implicit-generic (arg1 arg2) |
| 306 | "doc string generic implicit-generic default" | 306 | "doc string generic implicit-generic default" |
| 307 | "default for implicit generic") | 307 | "default for implicit generic") |
| 308 | 308 | ||
| 309 | (cl-defmethod xref-elisp-generic-implicit-generic ((this xref-elisp-root-type)) | 309 | (cl-defmethod xref-elisp-generic-implicit-generic ((this xref-elisp-root-type) arg2) |
| 310 | "doc string generic implicit-generic xref-elisp-root-type" | 310 | "doc string generic implicit-generic xref-elisp-root-type" |
| 311 | "non-default for implicit generic") | 311 | "non-default for implicit generic") |
| 312 | 312 | ||
| @@ -327,9 +327,9 @@ to (xref-elisp-test-descr-to-target xref)." | |||
| 327 | (xref-make-elisp-location | 327 | (xref-make-elisp-location |
| 328 | 'xref-elisp-generic-no-default 'cl-defgeneric | 328 | 'xref-elisp-generic-no-default 'cl-defgeneric |
| 329 | (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) | 329 | (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) |
| 330 | (xref-make "(cl-defmethod xref-elisp-generic-no-default ((this xref-elisp-root-type)))" | 330 | (xref-make "(cl-defmethod xref-elisp-generic-no-default ((this xref-elisp-root-type) arg2))" |
| 331 | (xref-make-elisp-location | 331 | (xref-make-elisp-location |
| 332 | '(xref-elisp-generic-no-default xref-elisp-root-type) 'cl-defmethod | 332 | '(xref-elisp-generic-no-default xref-elisp-root-type t) 'cl-defmethod |
| 333 | (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) | 333 | (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) |
| 334 | )) | 334 | )) |
| 335 | 335 | ||
| @@ -340,9 +340,9 @@ to (xref-elisp-test-descr-to-target xref)." | |||
| 340 | (xref-make-elisp-location | 340 | (xref-make-elisp-location |
| 341 | 'xref-elisp-generic-co-located-default 'cl-defgeneric | 341 | 'xref-elisp-generic-co-located-default 'cl-defgeneric |
| 342 | (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) | 342 | (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) |
| 343 | (xref-make "(cl-defmethod xref-elisp-generic-co-located-default ((this xref-elisp-root-type)))" | 343 | (xref-make "(cl-defmethod xref-elisp-generic-co-located-default ((this xref-elisp-root-type) arg2))" |
| 344 | (xref-make-elisp-location | 344 | (xref-make-elisp-location |
| 345 | '(xref-elisp-generic-co-located-default xref-elisp-root-type) 'cl-defmethod | 345 | '(xref-elisp-generic-co-located-default xref-elisp-root-type t) 'cl-defmethod |
| 346 | (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) | 346 | (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) |
| 347 | )) | 347 | )) |
| 348 | 348 | ||
| @@ -353,26 +353,26 @@ to (xref-elisp-test-descr-to-target xref)." | |||
| 353 | (xref-make-elisp-location | 353 | (xref-make-elisp-location |
| 354 | 'xref-elisp-generic-separate-default 'cl-defgeneric | 354 | 'xref-elisp-generic-separate-default 'cl-defgeneric |
| 355 | (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) | 355 | (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) |
| 356 | (xref-make "(cl-defmethod xref-elisp-generic-separate-default ())" | 356 | (xref-make "(cl-defmethod xref-elisp-generic-separate-default (arg1 arg2))" |
| 357 | (xref-make-elisp-location | 357 | (xref-make-elisp-location |
| 358 | '(xref-elisp-generic-separate-default) 'cl-defmethod | 358 | '(xref-elisp-generic-separate-default t t) 'cl-defmethod |
| 359 | (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) | 359 | (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) |
| 360 | (xref-make "(cl-defmethod xref-elisp-generic-separate-default ((this xref-elisp-root-type)))" | 360 | (xref-make "(cl-defmethod xref-elisp-generic-separate-default ((this xref-elisp-root-type) arg2))" |
| 361 | (xref-make-elisp-location | 361 | (xref-make-elisp-location |
| 362 | '(xref-elisp-generic-separate-default xref-elisp-root-type) 'cl-defmethod | 362 | '(xref-elisp-generic-separate-default xref-elisp-root-type t) 'cl-defmethod |
| 363 | (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) | 363 | (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) |
| 364 | )) | 364 | )) |
| 365 | 365 | ||
| 366 | (xref-elisp-deftest find-defs-defgeneric-implicit-generic | 366 | (xref-elisp-deftest find-defs-defgeneric-implicit-generic |
| 367 | (elisp--xref-find-definitions 'xref-elisp-generic-implicit-generic) | 367 | (elisp--xref-find-definitions 'xref-elisp-generic-implicit-generic) |
| 368 | (list | 368 | (list |
| 369 | (xref-make "(cl-defmethod xref-elisp-generic-implicit-generic ())" | 369 | (xref-make "(cl-defmethod xref-elisp-generic-implicit-generic (arg1 arg2))" |
| 370 | (xref-make-elisp-location | 370 | (xref-make-elisp-location |
| 371 | '(xref-elisp-generic-implicit-generic) 'cl-defmethod | 371 | '(xref-elisp-generic-implicit-generic t t) 'cl-defmethod |
| 372 | (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) | 372 | (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) |
| 373 | (xref-make "(cl-defmethod xref-elisp-generic-implicit-generic ((this xref-elisp-root-type)))" | 373 | (xref-make "(cl-defmethod xref-elisp-generic-implicit-generic ((this xref-elisp-root-type) arg2))" |
| 374 | (xref-make-elisp-location | 374 | (xref-make-elisp-location |
| 375 | '(xref-elisp-generic-implicit-generic xref-elisp-root-type) 'cl-defmethod | 375 | '(xref-elisp-generic-implicit-generic xref-elisp-root-type t) 'cl-defmethod |
| 376 | (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) | 376 | (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) |
| 377 | )) | 377 | )) |
| 378 | 378 | ||