/browse-at-remote

Browse target page on github/bitbucket from emacs buffers

Primary LanguageEmacs Lisp

browse-at-remote.el

This package is easiest way to open particular link on github/gitlab/bitbucket/stash/git.savannah.gnu.org/sourcehut from Emacs. It supports various kind of emacs buffer, like:

  • file buffer
  • dired buffer
  • magit-mode buffers representing code
  • vc-annotate mode (use get there by pressing C-x v g by default)

Installation:

Add browse-at-remote to your Cask file::

(depends-on "browse-at-remote")

Manual

Simply add this package to your emacs path, and add to .emacs,:

(require 'browse-at-remote)

Active keybindings for browse-at-remote function::

(global-set-key (kbd "C-c g g") 'browse-at-remote)

Customization

By default browse-at-remote knows how to work with popular remote types (github/gitlab..). Knowledge how to work with certain remote-type comes from mapping browse-at-remote-remote-type-domains. It defines that github.com should be treat in github manner, bitbucket.org in bitbucket manner and so on. In your development you may have some specific git-url, and browse-at-remote will before confuse which remote-type map to your domain.

Two solution available:

  1. In that case you can to customize that. (M-x customize ... browse-at-remote-remote-type-domains). For now our package supports next remote-types:

    • bitbucket.com
    • gitlab.com
    • github.com
    • Stash
    • git.savannah.gnu.org
    • gist.github.com
    • Phabricator
    • git.sr.ht
  2. Set specific remote-type directly in git repo. For example, if your repository is hosted on GitHub enterprise, you should add following setting to its config:

    git config --add browseAtRemote.type "github"
    

    or for private Stash repository use command:

    git config --add browseAtRemote.type "stash"
    

Adding new remote type

You can your own remote if you need - PRs are welcome! Please see good examples here: gnu-savannah-remote, or stash-remote.

Usage:

  1. Call function from emacs buffer:

    M-x browse-at-remote
    

    or:

    M-x bar-browse
    
    http://i.imgur.com/rmAky8e.png

    or just call C-c g g if you've already added binding before. You can use this command in dired buffers too.

  2. Target page at github/bitbucket will be opened using your default browser:

    http://i.imgur.com/wBW9Gov.pngalt:screenshotofpageatgithub

    or same here is folder view at bitbucket:

    http://i.imgur.com/XuzLhcR.pngalt:screenshotpagetreeatbibucket
  3. Opening github commit's page at magit-commit-mode, magit-log-mode:

    http://i.imgur.com/NzlIHYr.pngalt:screenshotof*magit-log-mode*
  4. Open last commit which added target line:

    http://i.imgur.com/lpmOAz2.pngalt:screenof*vc-annotate-mode*
    • Press C-x v g to call standard vc-annotate
    • Call browse-at-remote on target line

Contributors:

Changelog:

0.13.0

New remote type added Sourcehut by @microamp.

0.12.0

New remote type added Phabricator by @kuba-orlik.

0.11.0

New remote type added gist.github.com by @CyberShadow.

0.10.0

New remote type added git.savannah.gnu.org by @wigust.

0.9.0

Minor fixes, added Stash (bitbucket support) by @yauhen-l.

0.8.0

Drop clojure-style function namings. Add abbrev methods like bar-browse and bar-to-clipoboard (where bar is browse-at-remote abbrev.)

0.7.0

Major refactorings by @ieure. Main function renamed to browse-at-remote/browse. (renamed in 0.8.0 to bar-browse)

0.6.0

  • Added support of Gitlab by @env0der. Thanks!

0.5.0

  • Added support of Github Enterprice. Special thanks for @env0der for this feature.

0.4.0

  • Function browse-at-remote/to-clipboard were added (renamed in 0.8.0 to bar-to-clibpoard)

TODO:

  • Add mercurial support