summaryrefslogtreecommitdiff
path: root/lisp/progmodes/xref.el
Commit message (Collapse)AuthorAgeFilesLines
...
* * lisp/progmodes/xref.el: Bump version.Dmitry Gutov2021-09-051-1/+1
|
* Xref: automatic jumping to the first definition or referenceDmitry Gutov2021-09-051-8/+52
| | | | | | | | | | * lisp/progmodes/xref.el (xref-auto-jump-to-first-definition) (xref-auto-jump-to-first-xref): New user options. Discussed in bug#50067. (xref--show-xrefs, xref--show-defs): Use them here. (xref--auto-jump-first): New function, handles different values. (xref-show-definitions-buffer) (xref-show-definitions-buffer-at-bottom): Use it.
* Rename xref-select-and-{goto,show}-xrefDmitry Gutov2021-09-051-3/+4
| | | | | | * lisp/progmodes/xref.el (xref-select-and-show-xref): Rename from xref-select-and-goto-xref (bug#35376). Update all references.
* Rename xref--mouse-2 and adjust documentationLars Ingebrigtsen2021-08-311-3/+6
| | | | | | | | | * doc/emacs/maintaining.texi (Xref Commands): `mouse-1' is bound to `xref-goto-xref', not `mouse-2' (bug#35376). (Xref Commands): Mention what `mouse-2' does. * lisp/progmodes/xref.el (xref--button-map): Adjust. (xref-select-and-goto-xref): Rename from xref--mouse-2 (bug#35376).
* Use overlay arrow to indicate current *xref* selectionMattias Engdegård2021-08-211-0/+10
| | | | | | | * lisp/progmodes/xref.el (xref--set-arrow): New function. (xref-show-location-at-point, xref-goto-xref) (xref--next-error-function): Call it. (xref--show-common-initialize): Remove arrow.
* Add "Find References" to context menu (bug#50067)Mattias Engdegård2021-08-211-0/+14
| | | | | | | | | The new entry appears next to "Find Definition" and like it only appears when the context menu was invoked on an identifier. * lisp/progmodes/prog-mode.el (prog-context-menu): New menu entry. * lisp/progmodes/xref.el (xref-find-references-at-mouse): New function, analogous to `xref-find-definitions-at-mouse`.
* Indicate progress while searching for references in xrefMattias Engdegård2021-08-211-1/+5
| | | | | | * lisp/progmodes/xref.el (xref-backend-references): Add messages to show the user that something is happening instead of silently freezing during the frequently long synchronous searches for references.
* Re-type the :location slot in `xref-match-item` to `xref-location`Mattias Engdegård2021-08-211-1/+1
| | | | | | | * lisp/progmodes/xref.el (xref-match-item): Change type for :location from `xref-file-location`, which was likely a mistake, to `xref-location`. This allows `xref-make-match` to take arguments of any subtype of `xref-location` (bug#50067).
* Improve doc string of 'M-.'Eli Zaretskii2021-08-211-1/+3
| | | | | * lisp/progmodes/xref.el (xref-find-definitions): Mention 'M-,' in the doc string.
* Fix xref {prev,next}-error target buffer match highlighting extentMattias Engdegård2021-08-201-1/+2
| | | | | | * lisp/progmodes/xref.el (xref--next-error-function): Bind `xref--current-item` during the call to `xref--show-location` so that `xref-pulse-momentarily` finds the match extent.
* * lisp/progmodes/xref.el (xref--collect-matches): Widen temporarily.Juri Linkov2021-08-181-6/+8
|
* Provide a default for xref-find-apropos patternDmitry Gutov2021-08-061-1/+3
| | | | | * lisp/progmodes/xref.el (xref-find-apropos): Provide a default for the pattern (bug#49731).
* Change the xref-goto-xref error messageDmitry Gutov2021-08-061-1/+1
| | | | | * lisp/progmodes/xref.el (xref-goto-xref): Change the error message (bug#49846).
* Fix printing of multiple items in one group without line numbersDmitry Gutov2021-07-291-1/+2
| | | | | | * lisp/progmodes/xref.el (xref--insert-xrefs): Fix printing of multiple items in one group without line numbers (mentioned in bug#49731).
* (xref--insert-xrefs): Fix printing of line numbersDmitry Gutov2021-07-061-1/+3
| | | | | | * lisp/progmodes/xref.el (xref--insert-xrefs): Fix printing of line numbers when we have multiple files with (e.g.) single match on the same line.
* Support old BSD find and "root dir symlink" betterDmitry Gutov2021-06-071-1/+1
| | | | | | | | | | | | | | * lisp/progmodes/grep.el (grep-compute-defaults): Add '-H' to grep-find-template (bug#48471). * lisp/cedet/semantic/symref/grep.el (semantic-symref-perform-search): Pass the root directory name without the trailing slash. * lisp/progmodes/xref.el (xref-matches-in-directory): Ditto. * test/lisp/progmodes/xref-tests.el (xref--xref-file-name-display-is-abs) (xref--xref-file-name-display-is-relative-to-project-root): Make tests more strict again.
* (completing-read): Add `group-function` to the completion metadataDaniel Mendler2021-05-201-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A completion table can specify a `group-function` in its metadata. The group function takes two arguments, a completion candidate and a transform argument. The group function is used to group the candidates after sorting and to enhance the completion UI with group titles. If the transform argument is nil, the function must return the title of the group to which the completion candidate belongs. The function may also return nil if the candidate does not belong to a group. If the transform argument is non-nil, the function must return the transformed candidate. For example, the transformation allows to remove a redundant part of the candidate, which is then displayed in the title. The grouping functionality is guarded by the customizable variable `completions-group` and turned off by default for the *Completions* buffer. The specific form of the `group-function` has been chosen in order to allow allocation-free grouping. This is important for completion UIs, which continously update the displayed set of candidates (Icomplete, Vertico, Ivy, etc.). Only when the transform argument is non-nil the candidate transformation is performed, which may involve a string allocation as done in the function `xref--completing-read-group`. The function `xref-show-definitions-completing-read` makes use of the `group-function`, by moving the file name prefix to the title. If grouping is enabled, the *Completions* are displayed as "linenum:summary" instead of "file:linenum:summary". This way the *Completions* buffer resembles the *Occur* buffer. * doc/lispref/minibuf.texi: Add documentation. * lisp/minibuffer.el (completion-metadata): Describe the `group-function` in the docstring. (completions-group): Add guard variable, off by default. (completions-group-format): Add variable defining the format string for the group titles. (completions-group-title): Add face used by `completions-group-format` for the group titles. (completions-group-separator): Add face used by `completions-group-format` for the group separator lines. (minibuffer--group-by): New grouping function. (minibuffer-completion-help): Use it. (display-completion-list): Add optional GROUP-FUN argument. (completion--insert-strings): Add optional GROUP-FUN argument. Insert group titles if `completions-format` is `one-column`. Transform each candidate with the GROUP-FUN. Attach the untransformed candidate to the property `completion--string`. * lisp/simple.el (choose-completion): Retrieve the untransformed completion candidate from the property `completion--string`. * lisp/progmodes/xref.el: (xref--completing-read-group): New grouping function. (xref-show-definitions-completing-read): Use it.
* Visually truncate excessively long lines in XrefDmitry Gutov2021-05-181-0/+44
| | | | | | * lisp/progmodes/xref.el (xref-truncation-width): New option. (xref--apply-truncation): New function. (xref--insert-xrefs): Use it (bug#46859).
* * lisp/progmodes/xref.el: Bump version.Dmitry Gutov2021-04-291-1/+1
|
* Obsolete the TAB binding in *xref* buffersEli Zaretskii2021-04-241-2/+2
| | | | | | | | | | * doc/emacs/maintaining.texi (Xref Commands): Remove the description of the TAB binding. Enhance the description of the RET binding. (Bug#44611) * etc/NEWS: Announce the obsolescence of TAB binding in XREF. * lisp/progmodes/xref.el (xref-goto-xref): Improve doc string.
* Revert "Remove the binding for xref-quit-and-goto-xref"Eli Zaretskii2021-04-231-0/+1
| | | | | | | This reverts commit 522c34f0e80f60969861b0dc34bc7105249f9994. Making changes to which there was an explicit disagreement and a long discussion is unacceptable. (Bug#44611)
* * lisp/progmodes/xref.el: Remove the "still experimental" note.Dmitry Gutov2021-04-231-5/+0
|
* Remove the binding for xref-quit-and-goto-xrefDmitry Gutov2021-04-231-1/+0
| | | | | | | * lisp/progmodes/xref.el (xref--xref-buffer-mode-map): Remove the binding for xref-quit-and-goto-xref (bug#44611). * doc/emacs/maintaining.texi (Xref Commands): Update.
* Move part of the fix from project to xrefDmitry Gutov2021-04-221-0/+2
| | | | | | | | * lisp/progmodes/project.el (project--find-regexp-in-files): Don't unquote file names here. * lisp/progmodes/xref.el (xref-matches-in-files): Do it here. And only if the first element in the list is quoted (bug#47799).
* Improve quoting of directory names in project/xrefDmitry Gutov2021-04-161-1/+2
| | | | | | | | | * lisp/progmodes/project.el (project--files-in-directory): Quote LOCALDIR a bit earlier, to affect xref--find-ignores-arguments as well (bug#47799). * lisp/progmodes/xref.el (xref-matches-in-directory): Quote the dir passed to xref--rgrep-command.
* * lisp/progmodes/xref.el: Change xref-file-name-display and xref-match face.Juri Linkov2021-04-021-2/+2
| | | | | | * lisp/progmodes/xref.el (xref-file-name-display): Change the default value to 'project-relative' (bug#47012). (xref-match)<face>: Inherit from 'match'.
* xref.el: Keep Emacs 26 compatibilityDmitry Gutov2021-03-241-5/+10
| | | | | | | * lisp/progmodes/xref.el (xref--read-identifier) (xref-find-definitions, xref-find-definitions-other-window) (xref-find-definitions-other-frame, xref-find-references): Undo the latest change for Emacs 26 compatibility (bug#47286).
* Replace "(default %s)" with 'format-prompt'Gabriel do Nascimento Ribeiro2021-03-241-10/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/cmuscheme.el (scheme-load-file, scheme-compile-file): * lisp/comint.el (comint-get-source): * lisp/emulation/viper-cmd.el (viper-quote-region, viper-kill-buffer) (viper-query-replace, viper-read-string-with-history): * lisp/eshell/esh-mode.el (eshell-find-tag): * lisp/gnus/gnus-sum.el (gnus-articles-to-read) (gnus-summary-search-article-forward) (gnus-summary-search-article-backward): * lisp/international/mule-cmds.el (set-input-method, toggle-input-method) (describe-input-method, set-language-environment) (describe-language-environment): * lisp/mh-e/mh-gnus.el (mh-mml-minibuffer-read-disposition): * lisp/mh-e/mh-letter.el (mh-insert-letter): * lisp/mh-e/mh-mime.el (mh-display-with-external-viewer) (mh-mime-save-parts, mh-mh-forward-message) (mh-mml-query-cryptographic-method, mh-minibuffer-read-type): * lisp/mh-e/mh-seq.el (mh-read-seq, mh-read-range): * lisp/mh-e/mh-utils.el (mh-prompt-for-folder): * lisp/progmodes/etags.el (find-tag-tag): (find-tag-noselect, find-tag, find-tag-other-window) (find-tag-other-frame, find-tag-regexp): * lisp/progmodes/idlwave.el (idlwave-find-module): * lisp/progmodes/inf-lisp.el (lisp-load-file, lisp-compile-file): * lisp/progmodes/tcl.el (tcl-load-file, tcl-restart-with-file): * lisp/progmodes/xref.el (xref--read-identifier): (xref-find-definitions, xref-find-definitions-other-window) (xref-find-definitions-other-frame, xref-find-references): * lisp/ses.el (ses-read-printer): (ses-read-cell-printer, ses-read-column-printer) (ses-read-default-printer, ses-define-local-printer): * lisp/subr.el (read-number): * lisp/term.el (term-get-source): * src/minibuf.c (read-buffer): Remove prompt suffix and use 'format-prompt'. * lisp/minibuffer.el (format-prompt): Ignore DEFAULT empty strings (bug#47286).
* New commands xref-next-line-no-show and xref-prev-line-no-show (bug#44611)Juri Linkov2021-03-161-2/+12
| | | | | | * lisp/progmodes/xref.el (xref-next-line-no-show) (xref-prev-line-no-show): New commands. (xref-next-line, xref-prev-line): Use them.
* * lisp/progmodes/xref.el (xref-after-update-hook): New defcustom (bug#46992).Juri Linkov2021-03-081-1/+8
| | | | (xref--insert-xrefs): Use run-hooks on it.
* Speed up xref rendering for matches on very long linesDmitry Gutov2021-03-081-46/+64
| | | | | | | | | | | | | | | | | | | | | | * 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.
* (xref-revert-buffer): Also 'erase-buffer' when handling a user-errorDmitry Gutov2021-01-291-0/+1
| | | | | * lisp/progmodes/xref.el (xref-revert-buffer): Also 'erase-buffer' when handling a user-error (bug#46042).
* Allow project/xref packages to be used in Emacs 26.1João Távora2021-01-281-1/+1
| | | | | | | * lisp/progmodes/project.el: Change Package-Requires to Emacs 26.1 (bug#44671). * lisp/progmodes/xref.el: Ditto.
* ; xref-revert-buffer: Drop the (goto-char) at the endDmitry Gutov2021-01-231-2/+1
|
* Erase the buffer only after fetching the new contentsDmitry Gutov2021-01-231-3/+3
| | | | | * lisp/progmodes/xref.el (xref-revert-buffer): Erase the buffer only after fetching the new contents (bug#46042).
* Make sure the new window is not too tallDmitry Gutov2021-01-191-3/+8
| | | | | * lisp/progmodes/xref.el (xref-show-definitions-buffer-at-bottom): Make sure the new window is not too tall (bug#45945).
* New command xref-quit-and-pop-marker-stackDmitry Gutov2021-01-111-0/+7
| | | | | | * lisp/progmodes/xref.el (xref-quit-and-pop-marker-stack): New command. (xref--xref-buffer-mode-map): Binding for it.
* Make sure default-directory relates to the originating bufferDmitry Gutov2021-01-091-2/+6
| | | | | | | * 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.
* Proof some searches and file listings against symlinksDmitry Gutov2021-01-061-1/+2
| | | | | | | | | | | | * 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.
* * lisp/progmodes/xref.el (xref--show-defs-buffer-at-bottom): Fix missing argStefan Monnier2021-01-021-2/+2
|
* xref--show-pos-in-buf: Don't set other-window-scroll-bufferDmitry Gutov2021-01-021-5/+1
| | | | | * lisp/progmodes/xref.el (xref--show-pos-in-buf): Don't set other-window-scroll-buffer (bug#45581).
* xref-show-definitions-completing-read: Default to the first locationDmitry Gutov2021-01-011-2/+5
| | | | | * lisp/progmodes/xref.el (xref-show-definitions-completing-read): Default to the first location.
* Update copyright year to 2021Paul Eggert2021-01-011-1/+1
| | | | Run "TZ=UTC0 admin/update-copyright".
* Add 'project-relative' as value for 'xref-file-name-display'Dmitry Gutov2020-12-301-8/+40
| | | | | | | | | | | | | | | * 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>
* xref-show-definitions-completing-read: Tune up completionDmitry Gutov2020-12-291-3/+11
| | | | | | | | | | * 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.
* Rename and document the built-in xref-show-definitions-function'sDmitry Gutov2020-12-281-9/+38
| | | | | | | * 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'.
* Generic-ify xref-location-columnDmitry Gutov2020-12-211-2/+6
| | | | | | | | | | | | * 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.
* De-duplicate lines in Xref buffersJuri Linkov2020-12-211-4/+18
| | | | | | * 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.
* * lisp/progmodes/xref.el: Bump the version.Dmitry Gutov2020-12-091-1/+1
|
* Add missing defcustom keywords to new variablesDmitry Gutov2020-12-091-2/+6
| | | | | * lisp/progmodes/xref.el (xref-search-program-alist) (xref-search-program): Add :version and :package-version.