From: Dmitry Gutov Date: Mon, 23 Feb 2015 02:00:01 +0000 (+0200) Subject: Introduce `xref-etags-mode' X-Git-Tag: emacs-25.0.90~2564^2~317 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f6bb2ccb9b4b3c50049512d2d0664b44fc7bcc70;p=emacs.git Introduce `xref-etags-mode' Fixes: debbugs:19466 * lisp/progmodes/xref.el (xref-etags-mode--saved): New variable. (xref-etags-mode): New minor mode. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b4c6d0be8ef..ced342baeb9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2015-02-23 Dmitry Gutov + + Introduce `xref-etags-mode'. + * progmodes/xref.el (xref-etags-mode--saved): New variable. + (xref-etags-mode): New minor mode. (Bug#19466) + 2015-02-22 Lars Magne Ingebrigtsen * dom.el (dom-previous-sibling): New function. diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 55405b63fe0..fe72b3f778c 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -627,6 +627,29 @@ The argument has the same meaning as in `apropos'." ;;;###autoload (define-key ctl-x-4-map "." #'xref-find-definitions-other-window) ;;;###autoload (define-key ctl-x-5-map "." #'xref-find-definitions-other-frame) + +;;; Helper functions + +(defvar xref-etags-mode--saved nil) + +(define-minor-mode xref-etags-mode + "Minor mode to make xref use etags again. + +Certain major modes install their own mechanisms for listing +identifiers and navigation. Turn this on to undo those settings +and just use etags." + :lighter "" + (if xref-etags-mode + (progn + (setq xref-etags-mode--saved + (cons xref-find-function + xref-identifier-completion-table-function)) + (kill-local-variable 'xref-find-function) + (kill-local-variable 'xref-identifier-completion-table-function)) + (setq-local xref-find-function (car xref-etags-mode--saved)) + (setq-local xref-identifier-completion-table-function + (cdr xref-etags-mode--saved)))) + (provide 'xref)