Code Monkey home page Code Monkey logo

git-gutter's Introduction

git-gutter.el

melpa badge melpa stable badge gh actions badge

Introduction

git-gutter.el is an Emacs port of the Sublime Text plugin GitGutter.

Features

Screenshot

Screenshot of git-gutter.el

Requirements

  • Emacs 25.1 or higher
  • Git(1.7.0 or higher)

git-gutter.el vs git-gutter-fringe.el

git-gutter.el git-gutter-fringe.el
Work in tty frame OK unsupported
Work with linum-mode OK(experimental) OK
Show on right side unsupported OK
configurable more configurable less configurable

Installation

You can install git-gutter.el from MELPA with package.el (M-x package-install git-gutter), with el-get, or with another package manager of your choice

Global Minor Mode and Minor Mode

git-gutter.el provides a global minor-mode(global-git-gutter-mode) and minor-mode(git-gutter-mode).

If you want to use git-gutter for files in git repository. You add following s-exp in your configuration file(~/.emacs.d/init.el or ~/.emacs).

(global-git-gutter-mode +1)

Other case, you want to use git-gutter for some files, you can use git-gutter-mode. Following example of enabling git-gutter for some mode.

(add-hook 'ruby-mode-hook 'git-gutter-mode)
(add-hook 'python-mode-hook 'git-gutter-mode)

Commands

git-gutter.el provides following commands. Obsoleted interfaces will be removed when 1.0 released.

git-gutter:next-hunk

Jump to next hunk

git-gutter:previous-hunk

Jump to previous hunk

git-gutter:end-of-hunk

Move to end of current hunk

git-gutter:mark-hunk

Mark current hunk.

git-gutter:set-start-revision

Set the start revision from which git-gutter performs the diffs.

You can also set the variable git-gutter:start-revision as a directory-local variable.

git-gutter:popup-hunk

Popup current diff hunk(alias git-gutter:popup-diff)

git-gutter:next-hunk and git-gutter:previous-hunk update content of buffer popuped by git-gutter:popup-diff to current hunk.

git-gutter:stage-hunk

Stage current hunk. You can use this command like git add -p. This command is supported only for git.

git-gutter:revert-hunk

Revert current hunk

git-gutter

Show changes from last commit or Update change information. Please execute this command if diff information is not be updated.

git-gutter:linum-setup

Setup for working with linum-mode.

git-gutter:update-all-windows

Update git-gutter information of buffers in all visible window.

Sample Configuration

(require 'git-gutter)

;; If you enable global minor mode
(global-git-gutter-mode t)

;; If you would like to use git-gutter.el and linum-mode
(git-gutter:linum-setup)

;; If you enable git-gutter-mode for some modes
(add-hook 'ruby-mode-hook 'git-gutter-mode)

(global-set-key (kbd "C-x C-g") 'git-gutter)
(global-set-key (kbd "C-x v =") 'git-gutter:popup-hunk)

;; Jump to next/previous hunk
(global-set-key (kbd "C-x p") 'git-gutter:previous-hunk)
(global-set-key (kbd "C-x n") 'git-gutter:next-hunk)

;; Stage current hunk
(global-set-key (kbd "C-x v s") 'git-gutter:stage-hunk)

;; Revert current hunk
(global-set-key (kbd "C-x v r") 'git-gutter:revert-hunk)

;; Mark current hunk
(global-set-key (kbd "C-x v SPC") #'git-gutter:mark-hunk)

Directory-local variables

Set starting revision for diffs

Using directory-local variables, you can set the start revision for diffs for any file in the current directory:

;;; .dir-locals.el
((prog-mode . ((git-gutter:start-revision . "my-branch"))))

Customize

Live updating

If you set git-gutter:update-interval seconds larger than 0, git-gutter updates diff information in real-time by idle timer.

(custom-set-variables
 '(git-gutter:update-interval 2))

You can stop timer by git-gutter:cancel-update-timer and starts by git-gutter:start-update-timer.

Look and feel

Screenshot of multiple characters in gutter

You can change the signs and those faces.

(custom-set-variables
 '(git-gutter:modified-sign "  ") ;; two space
 '(git-gutter:added-sign "++")    ;; multiple character is OK
 '(git-gutter:deleted-sign "--"))

(set-face-background 'git-gutter:modified "purple") ;; background color
(set-face-foreground 'git-gutter:added "green")
(set-face-foreground 'git-gutter:deleted "red")

You can change minor-mode name in mode-line to set git-gutter:lighter. Default is " GitGutter"

;; first character should be a space
(custom-set-variables
 '(git-gutter:lighter " GG"))

Using full width characters

Screenshot of using full-width character as diff sign

Emacs has char-width function which returns character width. git-gutter.el uses it for calculating character length of the signs. But char-width does not work for some full-width characters. So you should explicitly specify window width, if you use full-width character.

(custom-set-variables
 '(git-gutter:window-width 2)
 '(git-gutter:modified-sign "")
 '(git-gutter:added-sign "")
 '(git-gutter:deleted-sign ""))

Backends

git-gutter.el supports following version control systems

You can set backends which git-gutter.el will be used. Default value of git-gutter:handled-backends is '(git). If you want to use git-gutter.el for other VCS, please change value of git-gutter:handled-backends as below.

;; Use for 'Git'(`git`), 'Mercurial'(`hg`), 'Bazaar'(`bzr`), and 'Subversion'(`svn`) projects
(custom-set-variables
 '(git-gutter:handled-backends '(git hg bzr svn)))

Updates hooks

diff information is updated at hooks in git-gutter:update-hooks.

(add-to-list 'git-gutter:update-hooks 'focus-in-hook)

Updates commands

diff information is updated after command in git-gutter:update-commands executed.

(add-to-list 'git-gutter:update-commands 'other-window)

Disabled modes

If you use global-git-gutter-mode, you may want some modes to disable git-gutter-mode. You can make it by setting git-gutter:disabled-modes to non-nil.

;; inactivate git-gutter-mode in asm-mode and image-mode
(custom-set-variables
 '(git-gutter:disabled-modes '(asm-mode image-mode)))

Default is nil.

Show signs at gutter by visual lines

Emacs folds long line if truncate-lines is nil. If git-gutter:visual-line is non-nil, git-gutter puts sign by visual lines.

(custom-set-variables
 '(git-gutter:visual-line t))

Default bahavior is that signs are put by logical lines. value of git-gutter:visual-line is nil.

Show Unchanged Information

Screenshot of highlighting unchanged lines

git-gutter.el can view unchanged information by setting git-gutter:unchanged-sign. Like following.

(custom-set-variables
 '(git-gutter:unchanged-sign " "))
(set-face-background 'git-gutter:unchanged "yellow")

Default value of git-gutter:unchanged-sign is nil.

Show a separator column

Screenshot of showing separator between buffer and gutter

git-gutter.el can display an additional separator character at the right of the changed signs. This is mostly useful when running emacs in a console.

(custom-set-variables
 '(git-gutter:separator-sign "|"))
(set-face-foreground 'git-gutter:separator "yellow")

Default value of git-gutter:separator-sign is nil.

Please set git-gutter:always-show-separator to non-nil, if you want to show separator always.

Hide gutter if there are no changes

Hide gutter when there are no changes if git-gutter:hide-gutter is non-nil. (Default is nil)

(custom-set-variables
 '(git-gutter:hide-gutter t))

Pass option to 'git diff' command

You can pass git diff option to set git-gutter:diff-option.

;; ignore all spaces
(custom-set-variables
 '(git-gutter:diff-option "-w"))

Don't ask whether commit/revert or not

git-gutter.el always asks you whether commit/revert or not. If you don't want, please set git-gutter:ask-p to nil.

;; Don't ask me!!
(custom-set-variables
 '(git-gutter:ask-p nil))

Log/Message Level

;; Don't need log/message.
(custom-set-variables
 '(git-gutter:verbosity 0))

Default value is 4(0 is lowest, 4 is highest).

Run hook

Run hook git-gutter-mode-on-hook when git-gutter-mode is turn on, and run hook git-gutter-mode-off-hook when git-gutter-mode is turn off.

Statistic

git-gutter.el provides some statistic API. This is useful for knowing how much code you changed etc. To display them in mode-line is also useful.

(git-gutter:buffer-hunks)

Count unstaged hunks in current buffer.

(git-gutter:all-hunks)

Count unstaged hunks in all buffers

(git-gutter:statistic)

Return statistic unstaged hunks in current buffer. Return value is dot-list. First element is total added lines, second element is total deleted lines.

See Also

GitGutter is Sublime Text plugin.

Vim version of GitGutter

diff-hl is similar tool based on vc.

Fork of git-gutter.el. Some features which are not provided git-gutter.el provides. However git-gutter-plus updates diff information synchronously.

git-gutter's People

Contributors

alpha22jp avatar benj02 avatar brownts avatar chaoyi avatar dalanicolai avatar dependabot[bot] avatar doitian avatar domtronn avatar edkolev avatar f-frhs avatar gonewest818 avatar hikmet517 avatar hirose31 avatar jado4810 avatar jcs090218 avatar jschaf avatar laampui avatar leungbk avatar paradoxxxzero avatar pavllick avatar rkaercher avatar rossabaker avatar rski avatar sabof avatar sawyergardner avatar seanfarley avatar sqrtminusone avatar syohex avatar thierryvolpiatto avatar thomasf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

git-gutter's Issues

Gutter not truly persistent

With (global-git-gutter-mode t), it still requires a buffer to be saved before the gutter appears.

Also, if the changes are reverted, the gutter disappears but the space of the gutter remains.

In my opinion, with global-git-gutter-mode on, the gutter should always be there for files that are associated with a git repo.

Segfault when scrolling

On latest (0.79, SHA: 07cab97), using in conjunction with linum-mode in a tty, if I scroll up and down repeatedly, I get a segfault from GNU Emacs 24.3.1. I'm literally just starting out with emacs, so I don't know exactly what further information is going to be useful to you!

My ~/.emacs.d/init.el contains

(add-to-list 'load-path "~/.emacs.d/emacs-git-gutter")
(require 'git-gutter)
(global-git-gutter-mode +1)           

I'm also using viper, evil and go-mode.

git-gutter and linum-mode

Is there a way to use both minor mode ? When I have linum-mode and git-gutter-mode, the latest screwed up the first and when scrolling down/up, linum deletes git-gutter indicators.

display the line number

one issue is the line number is almost gone. only the leftest digit is visible.

If possible, could you display the rightest digit instead of leftest digit instead?

The reason I need this feature is the new feature of evil-matchit 1.4.0. I need see the rightest digit to comment to the line.

Similar project

A few months ago I wrote diff-hl, which is a similar minor mode that has some additional features.

Check it out, you might like it.

with org mode, the indention is dancing around crazily.

I think this may not be a bug in here rather a bug in emacs. But when ever I am org-mode file(with org-indent-mode), with git-gutter-fringe is enabled and visible, org indention is going crazy.

org-indent-mode uses overlays heavily, I wonder why it happens with git-gutter-fringe, since this wont use overlay at all, would it?

other question, is there a way i can disable git-gutter-fringe on a particular mode basis. like git-gutter-dont-enable-modes or something like that.

Thanks.

feature request, can you also display the hunk of HEAD commit

use case:
when working on a minor feature, I prefer putting everything tested into the HEAD commit of my local branch. Next day when I start working, I can use jump the hunk directly.

The reason I prefer put code into lots of dirty small commits is because I use rebase and branch switching often.

any chance you can update marmalade?

You can use the marmalade-client package from marmalade and then it's easy from emacs.

Or you can use a shell method that you could put in a git hook if you like.

feature request: jump to the file I edited

sometimes I just want to go to the hunk of specific file.

So I need jump to that file at first. Can you add a new command to jump the file edited compared with HEAD? I mean the files from git dff --stat

After calling that command, I got a list of files in the buffer, when I select that file, that file is open, then I can use next-hunk or previous hunk command to jump to the desired hunk.

besides, maybe you can also provide optional parameter, so I can also jump the files from git diff --stat --cached and git show commit --stat

Git-gutter will open external diff program

Installed and ran git-gutter, it opened FileMerge. I have FileMerge set in my .gitconfig under the diff directive. Not sure if it will do what you want, but --no-ext-diff seems to be the flag to pass to git diff

Unable to open a file if current buffer is not git manager

I'm reading my mail with Gnus, so I've buffer that are not associated with any files. I've also file that are not managed by git.

And when I do C-x C-f in such file, git-gutter throws errors using error function, and that totally blocks the process of doing C-x C-f, which is a real problem as you might now.

Basically, you shouldn't return error to the top-level calling function if it's not an error. Not being able to git diff my mail isn't an error, so you should catch this at some point the in hook that's being run.

Otherwise, thanks for this mode, it's awesome.

not always refreshing when commiting outside of emacs?

I'm not using (yet?) magit for committing, but rather commiting in a terminal outside of emacs.
As a result, git-gutter still reflects the status of before the commit, does not pick up the change.

I have added this to my emacs config and was sure it would help, but it does not:
(require 'git-gutter)
(add-to-list 'git-gutter:update-hooks 'focus-in-hook)

Also when git-gutter is displaying obsolete information, running "git-gutter:update-all-windows" still does not get rid of the obsolete information.

I'm pretty sure I misconfigured something... I'm using spacemacs otherwise, and I put the focus-in-hook thing in the:

(defun dotspacemacs/config ()
"Configuration function.
This function is called at the very end of Spacemacs initialization after
layers configuration."

Have emacs gutter mode

I was thinking if it makes sense to make emacs-gutter mode as base infrastructure for git-gutter mode. My motivation was there are multitude of version control systems emacs users will be using. No doubt git being most common but I end up using perforce and I hacked the first commit of the project to get it working for p4.
So I was thinking can there be base infrastructure for showing additions from last revision.
Comments?

Failed to stage on ms-windows

I am failing to stage on my windows machine. When navigating through hunks, the only successful staged hunks are new lines. And changes or deleted lines result in the error: Failed stating this hunk. The popup and prompt show the correct changes that I intend to stage. I have tried git-gutter+ and staging works, but it seems like the internals between the two versions are pretty different at this point. So I don't know where to look at next.

Error wrong-type-argument stringp

Hello, I recently updated to:

$ emacs --version
GNU Emacs 24.4.1
Copyright (C) 2014 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

And running tag 0.83 I got a problem with the live update:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  file-name-nondirectory(nil)
  (let ((file (file-name-nondirectory (git-gutter:base-file))) (now (make-temp-file "git-gutter-cur")) (original (make-temp-file "git-gutter-orig"))) (if (git-gutter:write-original-content original file) (progn (git-gutter:write-current-content now) (git-gutter:start-live-update file original now))))
  (progn (let ((file (file-name-nondirectory (git-gutter:base-file))) (now (make-temp-file "git-gutter-cur")) (original (make-temp-file "git-gutter-orig"))) (if (git-gutter:write-original-content original file) (progn (git-gutter:write-current-content now) (git-gutter:start-live-update file original now)))))
  (if (git-gutter:should-update-p) (progn (let ((file (file-name-nondirectory (git-gutter:base-file))) (now (make-temp-file "git-gutter-cur")) (original (make-temp-file "git-gutter-orig"))) (if (git-gutter:write-original-content original file) (progn (git-gutter:write-current-content now) (git-gutter:start-live-update file original now))))))
  (progn (if (git-gutter:should-update-p) (progn (let ((file (file-name-nondirectory (git-gutter:base-file))) (now (make-temp-file "git-gutter-cur")) (original (make-temp-file "git-gutter-orig"))) (if (git-gutter:write-original-content original file) (progn (git-gutter:write-current-content now) (git-gutter:start-live-update file original now)))))))
  (if (and git-gutter:enabled (buffer-modified-p)) (progn (if (git-gutter:should-update-p) (progn (let ((file (file-name-nondirectory ...)) (now (make-temp-file "git-gutter-cur")) (original (make-temp-file "git-gutter-orig"))) (if (git-gutter:write-original-content original file) (progn (git-gutter:write-current-content now) (git-gutter:start-live-update file original now))))))))
  git-gutter:live-update()
  apply(git-gutter:live-update nil)
  byte-code("r\301�\302H�\303H\"\210)\301\207" [timer apply 5 6] 4)
  timer-event-handler([t 0 1 0 2 git-gutter:live-update nil idle 0])

Has somebody had the same problem? Any hint?

Optimization

Emacs is slow when git-gutter-mode is enable. because a function git-gutter is called
a lot of times at window-configuration-change-hook.

I should optimization it.

Unchanged face not applying?

I'm trying to get the background face of git-gutter to match my linum background. Working great for added, modified, however unchanged doesn't seem to be working:

Given: (set-face-background 'git-gutter:unchanged "red"), I still see the default frame background color there.

screen shot 2016-01-08 at 11 30 06 am

Am I using the wrong face or something here? I also tried setting the unchanged character to " " and setting the background/foreground with no luck.

"Here is not Git work tree" on Windows platform

Is it possible works on windows platform?
When i open a file in my git repository, emacs always show the message "Here is not Git work tree". Is there any extra configuration i need to make?

My emacs environment is below:

  • Windows 7
  • emacs 23.4.1
  • msysgit 1.8

Text Moves to the Right with linum-mode

On GNU Emacs 25.1.50.1, with linum-mode enabled, I'm experiencing behavior where the text movies right as as I navigate up/down/left/right within a buffer.

It only happens when the file is modified and saved (and a status symbol is displayed in the gutter). If I disable linum-mode (which hides the gutter) or disable git-gutter-mode, the text doesn't move right as I navigate.

I first noticed this a few weeks ago on a fresh Gentoo box with GNU Emacs 25.x but it wasn't happening on my Mac, which had an early HEAD installation of GNU Emacs 25.x. Today, I installed the latest HEAD on my Mac and now the same thing is happening.

Is this a known issue and do you have any suggestions for debugging?

init.el: https://github.com/osxi/emacs-dotfiles/blob/master/init.el

Note: On Linux and OS X, I use Emacs in the terminal, not the GUI. On Linux, I start Emacs with ZSH inside of i3. On Mac, I run Emacs with ZSH inside of tmux. I've ensured that I'm running the latest version at the time of writing this issue (20160126.1947 from MELPA).

RFE - view diff

Perhaps this request is beyond the scope of this project - if so please ignore it.

However, now I know which lines have been modified, I really would love to be able to see (for each line or consecutive set of lines) the previous state in a way that I can compare with the current state. Some way of toggling between the two, or displaying the previous state above the modified version would be very, very useful indeed.

git-gutter:toggle doesn't persist over saves

If I use git-gutter:toggle to turn off git gutter, then save the file, git gutter re-appears. It would be awesome if there was some buffer-local state which kept the gutter either visible or invisible regardless of saves.

Error in post-command hook after `C-x C-f`

I use GNU Emacs 24.3.1 on Mac Book and I do not install mercurial.
When I open a file by using C-x C-f, I saw the following message in minibuffer:

Error in post-command hook (global-git-gutter-mode-check-buffers): (file error "Searching for program" "No such file or directory" "hg")

If mercurial is installed, this issue does not occur but emacs should not show such message even if mercurial is not installed.

I think the same issue will occur if git is not installed.

feature-request (?): highlighting of truncated lines

Hi, I was wondering if it is possible to also get margin highlights for truncated lines (M-x toggle-truncate-lines)? Currently only the first line is marked in the margin and subsequent lines get no highlight. The same happens for visual-line-mode which soft-breaks long lines.

RFE - revert diff

When viewing the diff of a specific hunk, it would be nice to be able to have a shortcut to replace the new modified value with the original committed value thus reverting back.

Is staging from region a likely future feature?

Selectively staging lines by region/selection is a very useful for some workflows. Is this feature planned or every likely to be developed here?

I'm aware there is another project with this feature, but this one seems to be better supported/tested (eg on TRAMP) and more widely used.

git-gutter:stage-hunk broken for me

I'm not quite sure what the reason for this could be but whenever I run M-x git-gutter:stage-hunk the confirmation popup appears, I hit y but nothing is being added to the staging area (checking with git status).

Any idea what could be wrong with my setup? This is basically everything git-gutter related in my init.el:

(require 'git-gutter)
(git-gutter:linum-setup)
(global-git-gutter-mode +1)

I tried with and without linum-mode but in both cases same behaviour.
Here is a list of other packages I have installed in case they might produce any known conflicts I'm not aware of.

'(cider clojure-mode evil evil-leader evil-paredit paredit
exec-path-from-shell flx-ido projectile rainbow-delimiters
magit git-gutter solarized-theme zenburn-theme)

Most likely this is unrelated but for the small chance it's not: sometimes I get "Here is not Git/Mercurial work tree" messages even though I'm in a repo and the gutter properly indicates changed lines.

Breaks emacs after file is moved

Trying to reproduce a bug in a refactoring which moves source files around, I got into this unfortunate situation:

Debugger entered--Lisp error: (file-error "Setting current directory" "no such file or directory" "/home/expez/git/test/src/clj/test/core/")
  call-process("git" nil t nil "rev-parse" "--is-inside-work-tree")
  apply(call-process "git" nil t nil ("rev-parse" "--is-inside-work-tree"))
  process-file("git" nil t nil "rev-parse" "--is-inside-work-tree")
  apply(process-file "git" nil t nil ("rev-parse" "--is-inside-work-tree"))
  git-gutter:in-git-repository-p()
  git-gutter()

The directory has been renamed and I can't kill the buffer which is now no longer associated with a file nor visit another buffer. I just keep getting this file-error.

I now have to kill my emacs instance, loosing all kinds of wonderful state :p

Mercurial support.

Is it any chance for moving to "vcs-gutter"? Currently I would like to help with hg support. If you don't consider such possibility please close this issue.

Feature Request - git-gutter:unchanged

It would be great to have a symbol and face for unchanged lines in the gutter. I'd also like to make the gutter always be visible so when diff symbols appear, the whole buffer doesn't shift to the right to make room.

Problem for test with submodules

If emacs-git-gutter is checked out as a sudmodule one of the tests fail.

The test seems to assume that there's a directory under .git/ but that's not the case for submodules. I don't think there's a bug in the actual mode, just the test.

git rev-parse --git-dir will do the right thing for submodules.

Test failure:

 ((0.53))[src_private][abakken@hub:~/dev/private/rc/emacs/emacs-git-gutter] make 
make: Entering directory `/home/abakken/dev/private/rc/emacs/emacs-git-gutter'
emacs -Q -batch -L . -l test-git-gutter.el -f ert-run-tests-batch-and-exit
Source file `/home/abakken/dev/private/rc/emacs/emacs-git-gutter/git-gutter.el' newer than byte-compiled file
Running 19 tests (2014-01-21 19:24:43-0800)
Loading vc-git...
   passed   1/19  git-gutter
   passed   2/19  git-gutter-mode-failed
   passed   3/19  git-gutter-mode-success
   passed   4/19  git-gutter:changes-to-number
   passed   5/19  git-gutter:collect-deleted-line
   passed   6/19  git-gutter:diff-command
   passed   7/19  git-gutter:diff-content
   passed   8/19  git-gutter:file-path
Test git-gutter:in-git-repository-p backtrace:
  call-process("/bin/bash" nil t nil "-c" "git rev-parse --is-inside-w
  call-process-shell-command("git rev-parse --is-inside-work-tree" nil
  git-gutter:execute-command("git rev-parse --is-inside-work-tree" "~/
  git-gutter:in-git-repository-p("~/dev/private/rc/emacs/emacs-git-gut
  (list (git-gutter:in-git-repository-p file))
  (let ((fn-80 (function null)) (args-81 (list (git-gutter:in-git-repo
  (save-current-buffer (set-buffer buf) (let ((fn-80 (function null)) 
  (let ((buf (find-file-noselect ".git/config"))) (save-current-buffer
  (let ((file (concat default-directory "test-git-gutter.el"))) (let (
  (lambda nil (let ((file (concat default-directory "test-git-gutter.e
  byte-code("\306\307!�q\210\310\216\311 �\312\216\313\314\315\316\3
  ert--run-test-internal([cl-struct-ert--test-execution-info [cl-struc
  byte-code("\306\307!\211�\211�r\310\311!q\210\312 d\313\223)L\210)\3
  ert-run-test([cl-struct-ert-test git-gutter:in-git-repository-p "Sho
  ert-run-or-rerun-test([cl-struct-ert--stats t [[cl-struct-ert-test g
  ert-run-tests(t #[(event-type &rest event-args) "\30\307\"\203G   \
  ert-run-tests-batch(nil)
  ert-run-tests-batch-and-exit()
  command-line-1(("-L" "." "-l" "test-git-gutter.el" "-f" "ert-run-tes
  command-line()
  normal-top-level()
Test git-gutter:in-git-repository-p condition:
    (file-error "Setting current directory" "Not a directory" "/home/abakken/dev/private/rc/emacs/emacs-git-gutter/.git/")
   FAILED   9/19  git-gutter:in-git-repository-p
   passed  10/19  git-gutter:insert-deleted-lines
   passed  11/19  git-gutter:make-diffinfo
   passed  12/19  git-gutter:propertized-sign
Test git-gutter:root-directory backtrace:
  call-process("/bin/bash" nil t nil "-c" "git rev-parse --show-toplev
  call-process-shell-command("git rev-parse --show-toplevel" nil t)
  git-gutter:execute-command("git rev-parse --show-toplevel" "~/dev/pr
  git-gutter:root-directory("~/dev/private/rc/emacs/emacs-git-gutter/t
  (list (git-gutter:root-directory file))
  (let ((fn-10 (function null)) (args-11 (list (git-gutter:root-direct
  (let ((default-directory (concat default-directory ".git/"))) (let (
  (let ((file (concat default-directory "test-git-gutter.el"))) (let (
  (lambda nil (let ((file (concat default-directory "test-git-gutter.e
  byte-code("\306\307!�q\210\310\216\311 �\312\216\313\314\315\316\3
  ert--run-test-internal([cl-struct-ert--test-execution-info [cl-struc
  byte-code("\306\307!\211�\211�r\310\311!q\210\312 d\313\223)L\210)\3
  ert-run-test([cl-struct-ert-test git-gutter:root-directory "helper f
  ert-run-or-rerun-test([cl-struct-ert--stats t [[cl-struct-ert-test g
  ert-run-tests(t #[(event-type &rest event-args) "\30\307\"\203G   \
  ert-run-tests-batch(nil)
  ert-run-tests-batch-and-exit()
  command-line-1(("-L" "." "-l" "test-git-gutter.el" "-f" "ert-run-tes
  command-line()
  normal-top-level()
Test git-gutter:root-directory condition:
    (file-error "Setting current directory" "No child processes" "~/dev/private/rc/emacs/emacs-git-gutter/.git/")
   FAILED  13/19  git-gutter:root-directory
   passed  14/19  git-gutter:select-face
   passed  15/19  git-gutter:select-sign
   passed  16/19  git-gutter:set-window-margin
   passed  17/19  git-gutter:sign-width
   passed  18/19  global-git-gutter-mode-failed
   passed  19/19  global-git-gutter-mode-success

Ran 19 tests, 17 results as expected, 2 unexpected (2014-01-21 19:24:43-0800)

2 unexpected results:
   FAILED  git-gutter:in-git-repository-p
   FAILED  git-gutter:root-directory

make: *** [test] Error 1
make: Leaving directory `/home/abakken/dev/private/rc/emacs/emacs-git-gutter'

Thanks for an awesome mode btw.

repository root でないと動かない

こんにちは。git-gutter かっこいいので気に入っております。ありがとうございます。

で、いま update したところ、レポジトリルートにあるファイル以外でうごかなくなってしまいました。

たぶん git diff にレポジトリルートからの相対パスでファイル名をわたしている感じですが、これだとしたのディレクトリで動かないのではないでしょうか

diff --git a/git-gutter.el b/git-gutter.el
index 57f54f7..aa02f1a 100644
--- a/git-gutter.el
+++ b/git-gutter.el
@@ -222,8 +222,7 @@ character for signs of changes"
   (interactive)
   (git-gutter:delete-overlay)
   (let* ((repoinfo (git-gutter:repo-info))
-         (curfile (file-relative-name
-                   (buffer-file-name) (git-gutter:repoinfo-root repoinfo))))
+         (curfile (buffer-file-name)))
     (git-gutter:process-diff curfile)
     (setq git-gutter:enabled t)))

みたいので単純にファイル名渡せば十分な気がしておりますが、いかがでしょうか

Why do you use window-configuration-change-hook?

先ほどからあれこれ試し始めたばかりで恐縮です。

window-configuration-change-hookはなぜ使っているんでしょうか?
素人目には
git-gutter:update-hooksは'(find-file-hooks after-save-hook after-revert-hook) で
良さそうなですが、何か理由があるんでしょうね。

displaying separator column even when there are no changes

Is it possible to display the separator column even when there are no changes in the current file? I have the separator-sign and git-gutter:separator foreground and background faces set, but the separator column only is rendered when there is a change in the file for git-gutter to display.

I'm using 20141112.2120 from elpa with emacs 24.3 on Ubuntu 14.04.1.

Quit the hunk popup window with q

Various other modes that present temporary/popup-style windows (e.g. dired, help, buffer list) bind q to quit-window. This makes it quick and easy to hide the buffer/window without affecting layout.

For example, I sometimes have two windows side by side, and sometimes only one window. In this setup, it's cumbersome to hide the git-gutter diff hunk popup, as I need to either type C-x o (other-window) C-x k (kill-buffer) to kill the buffer if I have two windows side by side, or kill the other window with C-x 1 if I have only one window.

With all the other popup-style windows, it's enough to do C-x o q, and I find this very convenient. Could git-gutter support this, too?

Wrong positions with narrow-to-region

Hi there,

First of all git-gutter is wonderful and thank you for the project! It is working perfect for me in the usual case. However I've just noticed that while using narrow-to-region (and an indirect buffer) the positions seem to be off. It looks as though the gutter is taking into account lines above the buffer (that aren't there when narrowed). I will investigate a little further soon myself and see if I can find and provide a fix.

Regards,
Zane

Performance issue with Emacs 24.3.91

With Emacs 24.3.91 (git commit "0f0917d") in Linux, when git-gutter-mode is turned on in a 3 MB bytes org-mode buffer, every operation slows down dramatically. With Emacs 24.3.1 (git commit "3a1ce06") however, the speed was acceptable. I know it might be hard to address the issue, I will appreciate it if you could have some idea on how I could help track down the issue. Thanks in advance.

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.