Giter Site home page Giter Site logo

gxref's Introduction

MELPA MELPA Stable License: GPL v3

gxref - GNU Emacs xref backend using GNU Global

A pretty simple (but, at least for me, effective) backend for Emacs 25 xref library using GNU Global.

Overview

Emacs 25 introduces a new (and experimental) `xref' package. The package aims to provide a standardized access to cross-referencing operations, while allowing the implementation of different back-ends which implement that cross-referencing using different mechanisms. The gxref package implements an xref backend using the GNU Global tool.

Prerequisites:

  • GNU Global.
  • Emacs version >= 25.1

Installation

Gxref is now available on MELPA. Once you get MELPA set up, you can install gxref by typing

M-x package-install RET gxref RET

See here if you prefer to install manually.

Setting up.

Add something like the following to your init.el file:

(add-to-list 'xref-backend-functions 'gxref-xref-backend)

This will add gxref as a backend for xref functions. The backend will be used whenever a GNU Global project is detected. That is, whenever a GTAGS database file exists in the current directory or above it, or an explicit project was set.

Usage

Using gxref to locate tags

After setup, invoking any of the xref functions will use GNU Global whenever a GTAGS file can be located. By default, xref functions are bound as follows:

Function Binding
xref-find-definitions M-.
xref-find-references M-?
xref-find-apropos C-M-.
xref-pop-marker-stack M-,

If a GTAGS file can't be located for the current buffer, xref will fall back to whatever other backends it's configured to try.

Project root directory.

By default, gxref searches for the root directory of the project, and the GTAGS database file, by looking in the current directory, and then upwards through parent directories until the database is located. If you prefer, you can explicitly set the project directory. This can be done either interactively, by typing M-x gxref-set-project-dir RET, or by setting the variable gxref-gtags-root-dir to the GTAGS directory. You can also set up gxref-gtags-root-dir as a file-local or a dir-local variable.

Configuring gxref

gxref can be customized in several ways. use M-x customize-group RET gxref RET to start.

Additionally, the following variables can be used to affect the execution of GNU Global. You can set them either globally, or as file-local or dir-local variables:

  • gxref-gtags-conf The GTAGS/GLOBAL configuration file to use.

  • gxref-gtags-label GTAGS/GLOBAL Configuration label

  • gxref-gtags-lib-path the library path. Passed to GNU Global using the GTAGSLIBPATH environment variable.

Bug reports

If you find any bugs, please tell me about it at the gxref home page

Disclaimers:

Because the xref API in Emacs 25.1 is experimental, it's likely to change in ways that will break this package. I will try to keep up with API changes.

Source and License

Package source can be found in the github repository here.

It is released under version 3 of the GPL, which you can find here

gxref's People

Contributors

dedi avatar dedih avatar rish-lakish avatar

Watchers

James Cloos avatar Joakim Jalap avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.