AnswerBun.com

Can Emacs be set to auto-stage (preferably with --intent-to-add) new files?

Emacs Asked by Tom Dalziel on December 12, 2020

I often add a new file to a repo, make some other changes, then stage all, and commit all, forgetting that the new file is not yet tracked, so is not included in the stage all step. At least one editor (IntelliJ) has an option to auto-stage new files, which would be very helpful to me in Emacs. I guess this would be particularly helpful if it invoked –intent-to-add.

Is this feature present in magit or built-in in Emacs?

If not, I’d be interested in writing some elisp. Is there a hook run when magit sees a new untracked file, or would I have to add to the after-save-hook and query the git status?

One Answer

Magit does not implement this and as far as I know VC/Emacs does not do so either.

Magit also does not provide a hook that is run "when it sees a new untracked" file but you could use find-file-hook, which is run when you see a untracked file. ;D

You probably want to use magit-file-tracked-p in your hook function.

Correct answer by tarsius on December 12, 2020

Add your own answers!

Related Questions

Adding Spacemacs documented layers fails

1  Asked on September 2, 2021 by samusz

   

Easily accessing org files

1  Asked on September 2, 2021 by fraxture

 

View multiple emails at the same time with mu4e

1  Asked on September 2, 2021 by tyler

 

How can I set default paths for INCLUDE blocks under each heading in orgmode?

0  Asked on September 2, 2021 by scientific_explorer

 

In-line latex fragment position in org-mode

0  Asked on September 2, 2021 by a-blizzard

   

Filter list by regexps

2  Asked on September 2, 2021 by lorem-ipsum

       

Get a table of org-mode file from elisp to be passed to R

1  Asked on September 2, 2021 by omar113

 

Styling lists in org-export (html)

1  Asked on March 5, 2021 by user2699

   

Is there a way to show/open a file from a URI/URL

3  Asked on February 27, 2021 by carsten

   

cursor color depending on insert or overwrite mode

1  Asked on February 19, 2021 by tamifo

   

Syntax highlighting in C++ fails in user-defined literals

1  Asked on February 19, 2021 by vroomfondel

   

org-set-effort fast effort selection?

1  Asked on February 19, 2021 by whoever

 

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir