1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-10 00:00:39 -08:00
Commit graph

378 commits

Author SHA1 Message Date
Juri Linkov
3ea0a334dc New commands xref-next-line-no-show and xref-prev-line-no-show (bug#44611)
* lisp/progmodes/xref.el (xref-next-line-no-show)
(xref-prev-line-no-show): New commands.
(xref-next-line, xref-prev-line): Use them.
2021-03-16 20:07:34 +02:00
Juri Linkov
04c43bb047 * lisp/progmodes/xref.el (xref-after-update-hook): New defcustom (bug#46992).
(xref--insert-xrefs): Use run-hooks on it.
2021-03-08 19:48:28 +02:00
Dmitry Gutov
8e103ebef1 Speed up xref rendering for matches on very long lines
* lisp/progmodes/xref.el (xref--insert-xrefs): Cut up the current
line into pieces here for multiple matches's summaries, so that
xref--insert-xrefs can do less work (bug#46859).
(xref--insert-xrefs): Do less work.
(xref--outdated-p):
Update accordingly to how the summary creation logic changed.
(xref--buf-pairs-iterator): Update to the new calling convention.
(xref-location-column): Effectively rename back to
xref-file-location-column since the generic version is now unused.

* test/lisp/progmodes/xref-tests.el
(xref-matches-in-directory-finds-two-matches-on-the-same-line)
(xref-matches-in-directory-finds-an-empty-line-regexp-match):
Adjust to the xref-location-column change.
(xref-matches-in-files-trims-summary-for-matches-on-same-line):
New test.

* test/lisp/progmodes/xref-resources/file1.txt:
Change contents slightly to test the new xref--outdated-p code.
2021-03-08 04:25:15 +02:00
Dmitry Gutov
e86b30d6fd (xref-revert-buffer): Also 'erase-buffer' when handling a user-error
* lisp/progmodes/xref.el (xref-revert-buffer):
Also 'erase-buffer' when handling a user-error (bug#46042).
2021-01-29 15:53:28 +02:00
João Távora
2a71831eb3 Allow project/xref packages to be used in Emacs 26.1
* lisp/progmodes/project.el: Change Package-Requires to Emacs 26.1
(bug#44671).

* lisp/progmodes/xref.el: Ditto.
2021-01-28 04:18:12 +01:00
Dmitry Gutov
cc98d0bf52 ; xref-revert-buffer: Drop the (goto-char) at the end 2021-01-23 02:58:53 +02:00
Dmitry Gutov
5821dee094 Erase the buffer only after fetching the new contents
* lisp/progmodes/xref.el (xref-revert-buffer):
Erase the buffer only after fetching the new contents (bug#46042).
2021-01-23 02:53:12 +02:00
Dmitry Gutov
4ca808ee7a Make sure the new window is not too tall
* lisp/progmodes/xref.el (xref-show-definitions-buffer-at-bottom):
Make sure the new window is not too tall (bug#45945).
2021-01-19 03:05:44 +02:00
Dmitry Gutov
17bd039539 New command xref-quit-and-pop-marker-stack
* lisp/progmodes/xref.el (xref-quit-and-pop-marker-stack):
New command.
(xref--xref-buffer-mode-map): Binding for it.
2021-01-11 00:45:21 +02:00
Dmitry Gutov
6e73e07a6f Make sure default-directory relates to the originating buffer
* lisp/progmodes/xref.el (xref--show-xref-buffer):
Pick up default-directory value from the caller
(https://lists.gnu.org/archive/html/emacs-devel/2021-01/msg00551.html).
(xref-show-definitions-buffer-at-bottom): Same.
2021-01-09 02:10:06 +02:00
Dmitry Gutov
665b4e7c4e Proof some searches and file listings against symlinks
* lisp/progmodes/project.el (project--files-in-directory):
Make sure the directory includes the trailing slash in case it's
a symlink, discussed in
https://lists.gnu.org/archive/html/emacs-devel/2021-01/msg00345.html.

* lisp/progmodes/xref.el (xref-matches-in-directory): Same.

* lisp/cedet/semantic/symref/grep.el (semantic-symref-perform-search):
Same.
2021-01-06 23:07:22 +02:00
Stefan Monnier
825b4ec338 * lisp/progmodes/xref.el (xref--show-defs-buffer-at-bottom): Fix missing arg 2021-01-02 23:12:10 -05:00
Dmitry Gutov
6b10ce867f xref--show-pos-in-buf: Don't set other-window-scroll-buffer
* lisp/progmodes/xref.el (xref--show-pos-in-buf):
Don't set other-window-scroll-buffer (bug#45581).
2021-01-02 20:52:31 +02:00
Dmitry Gutov
a516e69863 xref-show-definitions-completing-read: Default to the first location
* lisp/progmodes/xref.el (xref-show-definitions-completing-read):
Default to the first location.
2021-01-01 15:18:41 +02:00
Paul Eggert
ba05d005e5 Update copyright year to 2021
Run "TZ=UTC0 admin/update-copyright".
2021-01-01 01:13:56 -08:00
Dmitry Gutov
13b59c690a Add 'project-relative' as value for 'xref-file-name-display'
* lisp/progmodes/xref.el (xref-file-name-display): Document new value.
(xref-location-group ((l xref-file-location))): Handle the new value.
(xref--project-root): Extract from the default method of
'xref-backend-references' so it can be used in above's new code.
Also fix an old bug in the "backward compat" branch.

* lisp/progmodes/xref.el (xref--project-root-memo): New variable.

* test/lisp/progmodes/xref-tests.el: Add test cases for the three
possible settings of 'xref-file-name-display'.

Co-authored-by: Tobias Rittweiler <trittweiler@gmail.com>
2020-12-30 13:48:55 +02:00
Dmitry Gutov
3e80653d29 xref-show-definitions-completing-read: Tune up completion
* lisp/minibuffer.el (completion-category-defaults)
Use 'substring' completion style for 'xref-location' category by
default.

* lisp/progmodes/xref.el (xref-show-definitions-completing-read):
Assign the 'xref-location' category to the completions. Pass
REQUIRE-MATCH=t.
2020-12-29 20:25:03 +02:00
Dmitry Gutov
8c38345629 Rename and document the built-in xref-show-definitions-function's
* lisp/progmodes/xref.el (xref-show-definitions-buffer): Rename
from 'xref--show-defs-buffer'.
(xref-show-definitions-buffer-at-bottom): Rename from
'xref--show-defs-buffer-at-bottom'.
2020-12-28 02:30:09 +02:00
Dmitry Gutov
759ec25769 Generic-ify xref-location-column
* lisp/progmodes/xref.el (xref-location-column):
Create a generic from xref-file-location-column, to use in the
common rendering code (bug#36967).
(xref--insert-xrefs): Update accordingly.

* test/lisp/progmodes/xref-tests.el
(xref-matches-in-directory-finds-two-matches-on-the-same-line)
(xref-matches-in-directory-finds-an-empty-line-regexp-match):
Ditto.
2020-12-21 03:38:37 +02:00
Juri Linkov
c3ad28c290 De-duplicate lines in Xref buffers
* lisp/progmodes/xref.el (xref--insert-xrefs):
Render matches coming from the same line together (bug#36967).
(xref--item-at-point): Account for the above.
2020-12-21 03:22:23 +02:00
Dmitry Gutov
1047f80f1c * lisp/progmodes/xref.el: Bump the version. 2020-12-09 23:38:18 +02:00
Dmitry Gutov
ea8ff97536 Add missing defcustom keywords to new variables
* lisp/progmodes/xref.el (xref-search-program-alist)
(xref-search-program): Add :version and :package-version.
2020-12-09 22:56:48 +02:00
Daniel Martín
6e0080e755 Add commands xref-next-group and xref-prev-group
* lisp/progmodes/xref.el (xref-next-group): New command that navigates
to the first item of the next xref group (typically a file).
(xref-prev-group): New command that navigates
to the first item of the next xref group (typically a file).
(xref--xref-buffer-mode-map): Bound the new commands to 'N' and 'P',
respectively.
* doc/emacs/maintaining.texi (Xref Commands): Document the new
commands in the Emacs manual.
* etc/NEWS: Announce them (bug#45089).
2020-12-07 17:01:35 +01:00
Dmitry Gutov
c86dc8d488 Always show the summary
* lisp/progmodes/xref.el (xref--show-defs-minibuffer):
Always show the summary (at least for now).
2020-12-05 03:01:34 +02:00
Dmitry Gutov
940bb6e984 Fontify the group and the line number
* lisp/progmodes/xref.el (xref--show-defs-minibuffer):
Fontify the group and the line number.
2020-12-05 03:01:34 +02:00
Dmitry Gutov
2945fe74a9 Hide the common parent directory, if any
* lisp/progmodes/xref.el (xref--show-defs-minibuffer):
Hide the common parent directory, if any.
2020-12-05 03:01:34 +02:00
William Xu
469f0a6516 xref--show-defs-minibuffer: new "show definitions" UI
* lisp/progmodes/xref.el (xref--show-defs-minibuffer):
New function to use as xref-show-definitions-function
(https://lists.gnu.org/archive/html/emacs-devel/2020-11/msg00824.html).
2020-12-05 03:00:38 +02:00
Dmitry Gutov
27af17b9ee Improve docstrings
* lisp/progmodes/xref.el (xref-search-program-alist)
(xref-search-program): Improve docstrings.
2020-12-04 23:23:03 +02:00
Dmitry Gutov
db26a84481 ; Fix line number sorting 2020-12-04 04:46:52 +02:00
Dmitry Gutov
f2a3d6e28d Support using ripgrep in project-find-regexp and friends
Performance results vary here.  Some projects and search terms
don't see much of a change, but for some (including Emacs sources
checkout and case-insensitive search) the switch to ripgrep shows
~2-3x speed improvement.  Another piece of anecdata here:
https://lists.gnu.org/archive/html/emacs-devel/2020-06/msg00802.html

* lisp/progmodes/xref.el (xref-search-program-alist)
(xref-search-program): New user options.
(xref-matches-in-files): Use them.
2020-12-04 03:47:49 +02:00
Juri Linkov
ad29bc74ca * lisp/progmodes/xref.el (xref-goto-xref): Prefix arg quits the *xref* buffer.
(bug#44611)
2020-11-14 22:36:13 +02:00
Stefan Kangas
dd16e46bb9 ; Prefer https to http in more URLs
These were all tested and confirmed working.
2020-10-24 20:23:27 +02:00
Dmitry Gutov
36b3abc672 ; Add the necessary argument (bug#42967) 2020-08-27 11:33:52 +03:00
Dmitry Gutov
1a167f5a7a ; Bump xref version 2020-08-27 00:56:16 +03:00
Dmitry Gutov
c601211e0d Unbreak dired-do-find-regexp in Emacs 26
* lisp/progmodes/xref.el (xref--show-xrefs):
Support the old convention (bug#42967).
2020-08-27 00:56:16 +03:00
Dmitry Gutov
7f6dba00ed Unbreak xref-goto-xref in Emacs 26
* lisp/progmodes/xref.el (xref-goto-xref):
Call next-error-found only if it's defined (bug#42981).
2020-08-27 00:56:16 +03:00
Dmitry Gutov
319463920c Unbreak project-find-regexp in Emacs 26.3 (bug#42765)
* lisp/progmodes/project.el: Depend on xref.  Bump the version.

* lisp/progmodes/xref.el: Remove 'project' from the list of
dependencies.  Depending on Emacs 26.3 already ensures that some
version is available.  Bump the version.
(xref--process-file-region): Move from project.el with a rename.
Update the sole caller.
(xref-backend-references): Make compatible with old project.el.
Update the docstring.
2020-08-14 17:21:55 +03:00
Basil L. Contovounesios
a4d3897d8f Replace some uses of cl-mapcan with mapcan
* lisp/progmodes/project.el (project-files, project-files):
* lisp/progmodes/xref.el (xref-backend-references)
(xref--convert-hits):
* test/lisp/emacs-lisp/package-tests.el
(package-test-strip-version): Replace cl-mapcan with equivalent
calls to mapcan.
2020-06-21 14:33:16 +01:00
Dmitry Gutov
f929258646 Change xref-find-apropos to pass PATTERN to backend verbatim
* lisp/progmodes/xref.el (xref-backend-apropos): Rename this
generic's second arg to PATTERN, to clarify that it should be
handled entirely in the backend, with no pre-processing by the
command.
(xref-find-apropos): Update accordingly, but keep compatibility
with backends in older Emacs versions.
(xref-apropos-regexp): Extract from xref-find-apropos.

* lisp/progmodes/etags.el (xref-backend-apropos): Use it here.

* lisp/progmodes/elisp-mode.el (xref-backend-apropos): And here.
2020-06-01 05:28:43 +03:00
Dmitry Gutov
5044c19001 project.el: A project has only one main root now
Practice shows that the vast majority of projects only use one main
root.  The users of this API very often make this assumption as well.
The rest of the "roots" should be possible to express through
project-external-roots.

* lisp/progmodes/project.el: Update the commentary.
Only 4 non-obsolete generics now.
(project-root): Replacement for `project-roots'.
All callers updated.  Implementations too.
(project-roots): Declare obsolete.
(project-external-roots): Simplify the docstring.
(project-ignores): Update the docstring.
(project-find-regexp): Omit the second arg to project-files.
(project--dir-ignores): Simplify.
(project-compile): Simplify, remove outdated comment.

* lisp/cedet/ede.el: Add a FIXME.
2020-05-23 04:54:42 +03:00
Stefan Monnier
b5ec24a4f1 * lisp/progmodes/xref.el: Fix first line syntax
(xref--find-ignores-arguments): Simplify.
2020-05-15 14:49:46 -04:00
João Távora
5d97d2683a ; Tweak version numbers in lisp/progmodes/xref.el
Hopefully this aids in getting the package correctly listed in GNU
ELPA.

* lisp/progmodes/xref.el (Version): Bump to 1.0.1
(Package-Requires): Require project 0.1.1.
2020-05-15 15:20:54 +01:00
João Távora
9ebf51999c Turn Eldoc, Xref and Project into GNU ELPA :core packages
The new packages state they require Emacs 26.3 to function, but a
small part of project.el breaks this "soft" rule: the two functions
requiring fileloop.el are incompatible with Emacs 26.3.

* lisp/jsonrpc.el: Tweak comment near Package-Requires.

* lisp/emacs-lisp/eldoc.el: Add Version and Package-Requires.

* lisp/progmodes/flymake.el: Add comment near Package-Requires.

* lisp/progmodes/project.el: Add Version and Package-Requires.

* lisp/progmodes/xref.el: Add Version and Package-Requires.
2020-05-13 11:31:35 +01:00
Dmitry Gutov
ac3da1dd96 Handle project--files-in-directory finding no files better
* lisp/progmodes/project.el (project--find-regexp-in-files):
Signal user-error when passed an empty list of files.

* lisp/progmodes/xref.el (xref-matches-in-files):
Make sure FILES is not empty.
2020-03-30 23:16:27 +03:00
Dmitry Gutov
e898442be3 Honor tags-case-fold-search during xref identifer completion
* etc/NEWS: New entry.

* lisp/progmodes/etags.el (tags-case-fold-search):
Mark as safe-local.
(find-tag--completion-ignore-case):
Extract from tags-completion-at-point-function, find-tag-tag and
etags--xref-find-definitions.
(xref-backend-identifier-completion-ignore-case):
New method. Use it here as well.

* lisp/progmodes/xref.el
(xref-backend-identifier-completion-ignore-case): New generic.
(xref--read-identifier): Use it here.
2020-01-18 00:23:46 +03:00
Dmitry Gutov
b46c75b16c xref-matches-in-files: Big Tramp speed-up
* lisp/progmodes/xref.el (xref-matches-in-files):
Greatly improve performance with remote files using Tramp
(bug#34343).
2020-01-07 16:30:37 +03:00
Paul Eggert
365e01cc9f Update copyright year to 2020
Run "TZ=UTC0 admin/update-copyright $(git ls-files)".
2020-01-01 00:59:52 +00:00
Dmitry Gutov
70fe552c61 ; xref-references-in-directory: Autoload as well 2019-12-29 15:46:44 +03:00
Dmitry Gutov
43f66c3368 Extract xref-matches-in-files from project--find-regexp-in-files
* lisp/progmodes/xref.el (xref-matches-in-files): Extract from
project--find-regexp-in-files.

* lisp/dired-aux.el (dired-do-find-regexp): Also use it here.
2019-12-29 15:46:44 +03:00
Dmitry Gutov
65af18d86e Rename xref-collect-references and xref-collect-matches
* lisp/progmodes/xref.el (xref-references-in-directory): Rename
from xref-collect-references.  Update the sole caller.
(xref-matches-in-directory): Rename from xref-collect-matches.
Update all callers (all of them are in the /tests/ dir).

* test/lisp/progmodes/xref-tests.el (xref-tests-data-dir):
Don't use the EMACS_TEST_DIRECTORY env var. It doesn't work when
running interactively.
2019-12-29 15:46:44 +03:00