Commit graph

128 commits

Author SHA1 Message Date
Dmitry Gutov
bcfdfd2568 xref--insert-xrefs: Tweak the faces
* lisp/progmodes/xref.el (xref--insert-xrefs): Tweak the faces.
Always insert a newline at the end (to avoid mouse-face background
tail at the last line).
2015-05-04 00:39:06 +03:00
Dmitry Gutov
c50499edab ; * xref.el (xref-collect-references): Simplify. 2015-05-02 01:04:26 +03:00
Dmitry Gutov
fed6a0d6b1 Implement xref-find-references in etags and elisp-mode
* lisp/progmodes/elisp-mode.el (elisp--xref-find-references): New function.
(elisp-xref-find): Use it.

* lisp/progmodes/etags.el (etags-xref-find): Use `xref-collect-references'.

* lisp/progmodes/xref.el (xref-collect-references):
(xref--collect-reference): New functions.
2015-05-01 23:41:27 +03:00
Helmut Eller
fa175b4495 Set next-error-* in xref--xref-buffer-mode
* xref.el (xref--xref-buffer-mode): Set `next-error-function' and
`next-error-last-buffer'.
(xref--next-error-function): New function.
(http://lists.gnu.org/archive/html/emacs-devel/2015-04/msg01311.html)
2015-04-30 03:41:42 +03:00
Dmitry Gutov
2f3b409a28 Introduce xref-prompt-for-identifier
* lisp/progmodes/xref.el (xref-prompt-for-identifier): New option.
(xref--read-identifier): Use it
(http://lists.gnu.org/archive/html/emacs-devel/2015-04/msg01205.html).
2015-04-26 18:08:56 +03:00
Dmitry Gutov
fddff05e88 Pass id' to completing-read' as def instead of initial input
* xref.el (xref--read-identifier): Pass `id' to `completing-read'
as the default value instead of initial input
(http://lists.gnu.org/archive/html/emacs-devel/2015-04/msg01182.html).
2015-04-26 06:39:34 +03:00
Leo Liu
85c3e1be24 * lisp/progmodes/xref.el (xref-push-marker-stack): Add optional arg. 2015-04-17 12:32:33 +08:00
Dmitry Gutov
f6bb2ccb9b Introduce `xref-etags-mode'
Fixes: debbugs:19466

* lisp/progmodes/xref.el (xref-etags-mode--saved): New variable.
(xref-etags-mode): New minor mode.
2015-02-23 04:00:01 +02:00
Dmitry Gutov
03346fb074 xref: Replace defgeneric and defmethod with cl- counterparts
* lisp/progmodes/xref.el (xref-location-marker, xref-location-group):
Use `cl-defgeneric' and `cl-defmethod' instead of the EIEIO
counterparts.

* lisp/progmodes/etags.el (xref-location-marker): Same.
2015-01-22 04:24:31 +02:00
Dmitry Gutov
a17a5daebf xref: Input history and minor tweaks
* lisp/progmodes/xref.el (xref--current): Rename from `xref--selected'.
(xref--inhibit-mark-current): Rename from
`xref--inhibit-mark-selected'.  Update the usages.
(xref-quit): Reword the docstring.  Kill buffers after quitting
windows instead of before.
(xref--insert-xrefs): Tweak help-echo.
(xref--read-identifier-history, xref--read-pattern-history):
New variables.
(xref--read-identifier, xref-find-apropos): Use them.
2015-01-22 04:09:23 +02:00
Dmitry Gutov
e7697d9763 Remap quit-window to xref-quit in xref buffers
Fixes: debbugs:19466

* lisp/progmodes/xref.el (xref--xref-buffer-mode-map): Define before
the major mode.  Remap `quit-window' to `xref-quit'.
(xref--xref-buffer-mode): Inherit from special-mode.
2015-01-21 09:20:04 +02:00
Dmitry Gutov
956b13c527 xref: Keep track of temporary buffers
Fixes: debbugs:19466

xref: Keep track of temporary buffers.
* lisp/progmodes/xref.el (xref--temporary-buffers, xref--selected)
(xref--inhibit-mark-selected): New variables.
(xref--mark-selected): New function.
(xref--show-location): Maybe add the buffer to
`xref--temporary-buffers', add `xref--mark-selected' to
`buffer-list-update-hook' there.
(xref--window): Add docstring.
(xref-quit): Rename from `xref--quit'.  Update both references.
Add KILL argument.  When it's non-nil, kill the temporary buffers
that haven't been selected by the user.
(xref--show-xref-buffer): Change the second argument to alist,
extract the values for `xref--window' and
`xref--temporary-buffers' from it.  Add `xref--mark-selected' to
`buffer-list-update-hook' to each buffer in the list.
(xref--show-xrefs): Move the logic of calling `xref-find-function'
here.  Save the difference between buffer lists before and after
it's called as "temporary buffers", and `pass it to
`xref-show-xrefs-function'.
(xref--find-definitions, xref-find-references)
(xref-find-apropos): Update accordingly.
2015-01-21 08:43:39 +02:00
Dmitry Gutov
3ca37be9e7 Expand xref help-echo string
* lisp/progmodes/xref.el (xref--insert-xrefs): Expand help-echo string.
2015-01-20 04:52:48 +02:00
Dmitry Gutov
05fb53a16c Use etags-goto-tag-location in etags xref backend
* progmodes/etags.el (xref-etags-location): New class.
(xref-make-etags-location): New function.
(etags--xref-find-definitions): Use it.
(xref-location-marker): New method implementation.

* lisp/progmodes/xref.el: Mention that xref-location is an EIEIO class.
2015-01-20 04:32:25 +02:00
Dmitry Gutov
9592a014df xref: Use other-window-scroll-buffer and user-error
* lisp/progmodes/xref.el (xref--display-position):
Set `other-window-scroll-buffer'.
(xref-goto-xref): Use `user-error'.
2015-01-19 05:29:37 +02:00
Dmitry Gutov
36bfd6947f Use quit-window to hide buffers temporarily displayed by xref
* lisp/progmodes/xref.el (xref--display-history): New variable.
(xref--window-configuration): Remove.
(xref--save-to-history): New function.
(xref--display-position): Use it.  Add new argument.
(xref--restore-window-configuration): Remove.
(xref--show-location, xref-show-location-at-point): Update
accordingly.
(xref--xref-buffer-mode): Don't use `pre-command-hook'.
(xref--quit): New command.
(xref-goto-xref): Use it.
(xref--xref-buffer-mode-map): Bind `q' to it.
2015-01-19 04:19:32 +02:00
Dmitry Gutov
b87d7cc249 Perform xref jump even inside indentation or at eol
* lisp/progmodes/xref.el (xref-goto-xref): Perform xref jump even inside
indentation or at eol.
2015-01-19 01:11:25 +02:00
Martin Rudalics
cc59a3e577 Add autoload cookie for xref-marker-stack-empty-p (Bug#19554).
* progmodes/xref.el (xref-marker-stack-empty-p): Add autoload
cookie (Bug#19554).
2015-01-12 18:26:39 +01:00
Dmitry Gutov
f5afaf9ce7 Add help-echo to xrefs
* lisp/progmodes/xref.el (xref--insert-xrefs): Add `help-echo' property
to the references.
2015-01-06 02:47:58 +03:00
Dmitry Gutov
c477f20730 Add mouse interaction to xref
* lisp/progmodes/xref.el (xref--button-map): New variable.
(xref--mouse-2): New command.
(xref--insert-xrefs): Add `mouse-face' and `keymap' properties to
the inserted references.
2015-01-05 02:45:30 +03:00
Dmitry Gutov
8bef7b6ad1 Only show "Back" when the marker stack is non-empty
* lisp/menu-bar.el (menu-bar-goto-menu): Use it.

* lisp/progmodes/xref.el (xref-marker-stack-empty-p): New function.
2015-01-03 23:10:36 +02:00
Dmitry Gutov
5496236583 Don't remap next-line' and previous-line' in xref keymap
* lisp/progmodes/xref.el (xref--window-configuration): New variable.
(xref-show-location-at-point): New command.
(xref--restore-window-configuration): New function.
(xref-next-line, xref-prev-line): Delegate to
`xref-show-location-at-point'.
(xref--location-at-point): Don't signal the error.
(xref-goto-xref): Do that here instead.
(xref--xref-buffer-mode): Add `xref--restore-window-configuration'
to `pre-command-hook'.
(xref--xref-buffer-mode-map): Don't remap `next-line' and
`previous-line'.  Additionally bind `xref-next-line' and
`xref-prev-line' to `n' and `p' respectively.  Bind
`xref-show-location-at-point' to `C-o'.
2015-01-03 23:10:36 +02:00
Paul Eggert
7e09ef09a4 Update copyright year to 2015
Run admin/update-copyright.
2015-01-01 14:26:41 -08:00
Dmitry Gutov
0d7f85fbca (xref-find-definitions): Mention "no identifier at point" case
* lisp/progmodes/xref.el (xref-find-definitions): Mention "no
identifier at point" case in the docstring.
2014-12-30 21:54:03 +02:00
Dmitry Gutov
6d14e0d361 elisp-xref-find: Don't create buffers eagerly
* lisp/emacs-lisp/find-func.el (find-function-library): New function,
extracted from `find-function-noselect'.

* lisp/progmodes/elisp-mode.el (elisp--identifier-location): Fold back
into `elisp--company-location'.
(elisp--identifier-completion-table): Rename to
`elisp--identifier-completion-table', and do not include just any
symbols with a property list.
(elisp-completion-at-point): Revert the 2014-12-25 change.
(elisp--xref-identifier-file): New function.
(elisp--xref-find-definitions): Use it.

* lisp/progmodes/xref.el (xref-elisp-location): New class.
(xref-make-elisp-location): New function.
(xref-location-marker): New implementation.
2014-12-27 16:07:31 +02:00
Dmitry Gutov
807c3413c4 Add basic xref apropos implementation to elisp-mode
* lisp/progmodes/elisp-mode.el (elisp--xref-find-definitions):
Filter out nil results.
(elisp--xref-find-apropos): New function.
(elisp-xref-find): Use it.

* lisp/progmodes/xref.el (xref--show-xrefs): Use `user-error'.
2014-12-26 18:34:47 +02:00
Paul Eggert
b3946c9b9a Spelling fixes 2014-12-25 18:19:28 -08:00
Dmitry Gutov
394ce9514f Consolidate cross-referencing commands
Move autoloaded bindings for `M-.', `M-,', `C-x 4 .' and
`C-x 5 .' from etags.el to xref.el.

* progmodes/xref.el: New file.

* progmodes/elisp-mode.el (elisp--identifier-types): New variable.
(elisp--identifier-location): New function, extracted from
`elisp--company-location'.
(elisp--company-location): Use it.
(elisp--identifier-completion-table): New variable.
(elisp-completion-at-point): Use it.
(emacs-lisp-mode): Set the local values of `xref-find-function'
and `xref-identifier-completion-table-function'.
(elisp-xref-find, elisp--xref-find-definitions)
(elisp--xref-identifier-completion-table): New functions.

* progmodes/etags.el (find-tag-marker-ring): Mark obsolete in
favor of `xref--marker-ring'.
(tags-lazy-completion-table): Autoload.
(tags-reset-tags-tables): Use `xref-clear-marker-stack'.
(find-tag-noselect): Use `xref-push-marker-stack'.
(pop-tag-mark): Make an alias for `xref-pop-marker-stack'.
(etags--xref-limit): New constant.
(etags-xref-find, etags--xref-find-definitions): New functions.
2014-12-25 22:19:28 +02:00