2022 Developer Survey is open! Take survey.
52 votes
Accepted

Synchronize packages between different machines

For emacs 25 or newer refer to this answer. For emacs < 25 there's no automatically generated manifest file that you can synchronize to achieve the desired effect. That said, something you can do ...
user avatar
  • 4,440
43 votes
Accepted

Is there a simplified version control system appropriate for non-coders writing in Emacs?

The problem with existing version control systems is not so much their complexity; it's the fact that there is such a wealth of information out there that it can be very difficult for beginners to see ...
user avatar
  • 14.2k
38 votes
Accepted

What should/shouldn't I do when keeping .emacs and .emacs.d in version control?

I store my Emacs configuration in Github because I use two different computers, one at work, one at home. Here is a list about things that I don't put into source control: Environment specified ...
user avatar
  • 957
35 votes

Synchronize packages between different machines

I keep my .emacs.d directory in version control. Then, in my init.el and subsequent files I use use-package to define package setup. Not only does use-package lazily load your packages, it will ...
user avatar
  • 581
31 votes

Is there an Emacs mode which highlights differences from the committed version?

Dmitry Gutov's diff-hl library provides diff-hl-mode, which gives you the fringe highlighting shown in the top window in the following screenshot (with the actual diff displayed in the bottom window ...
user avatar
  • 43.1k
18 votes

Synchronize packages between different machines

In Emacs-25, there is the variable package-selected-packages, so you can customize this variable and use package-install-selected-packages to make sure they're installed.
user avatar
  • 25.2k
15 votes
Accepted

Only doing whitespace-cleanup on the lines touched

The ws-butler package removes whitespace only from the touched lines. The package is available on Melpa. From that package's README on github: Only lines touched get trimmed. If the white space at ...
user avatar
  • 24.2k
12 votes

Is there a simplified version control system appropriate for non-coders writing in Emacs?

In addition to magit (as @itsjeyd's answer ably demonstrates), you can also try git-timemachine, which provides facilities for quick cycling through older versions of a file under git version control. ...
user avatar
  • 31k
11 votes

Is there an Emacs mode which highlights differences from the committed version?

You don't specify what version control system you're using, but if it's git, ou can use git-gutter to put an indicator in the margins when a line has been added, deleted or modified. It's available ...
user avatar
  • 12.1k
10 votes

What should/shouldn't I do when keeping .emacs and .emacs.d in version control?

tl;dr use .emacs.d/init.el instead of .emacs make your .gitignore a white list use a package manager .emacs.d/init.el I use .emacs.d/init.el instead of .emacs since this setup allows me to put ....
user avatar
10 votes

Is there an Emacs mode which highlights differences from the committed version?

You should check out Ediff. It can both display diffs and act as a (3-way) merge tool. It lets you easily revert changes, and also highlights refined differences to show you only the parts of each ...
user avatar
10 votes
Accepted

Anatomy of ~/.emacs.d

There are lots of different ways to organize your .emacs.d. You should probably have a look at some of the great examples here and here. Most of the time, what you want to keep under version control ...
user avatar
  • 5,981
10 votes
Accepted

Merge specific files with magit

As noted in many answers to the question you have linked to and even more so in comments on those answers, git checkout source_branch -- <paths>... does not perform a merge. Never-the-less ...
user avatar
  • 24.2k
9 votes

Synchronize packages between different machines

What you want to use is Cask, which lets you create a Cask file specifying which packages to install on cask install. It can be used to manage dependencies of a package, and "dependencies" of your ...
user avatar
  • 398
8 votes

What should/shouldn't I do when keeping .emacs and .emacs.d in version control?

Just make sure no generated stuff (like @rangi-lin notes) is in the repo and, if you're sharing your dotfiles with others, no related security stuff (like passwords and API keys). For the later I've ...
user avatar
  • 551
8 votes

Is there a simplified version control system appropriate for non-coders writing in Emacs?

I suspect you'll find Backups Mode and/or Backup Walker very interesting. Both aim to leverage the existing backup mechanisms in Emacs, and provide better access to and visibility of your file ...
user avatar
  • 43.1k
8 votes
Accepted

How to abbreviate version control information in the mode line?

Here is a piece of advice that shortens Git to G, while leaving mode line strings for other version control systems unchanged: (defun my-shorten-vc-mode-line (string) (cond ((string-prefix-p "...
user avatar
  • 5,786
7 votes

How do I ediff a buffer against a revision?

When using magit: Use l -al l to view the revisions of all branches in your history go to the line containing the revision you want to compare your current buffer content against. Type d and you are ...
user avatar
  • 1,734
7 votes
Accepted

How do I ediff a buffer against a revision?

Emacs is doing what you told it to do instead of what you meant. ediff-revision asks for three pieces of information: The file to work on — default: the file that the current buffer is visiting. The ...
user avatar
7 votes

Synchronize packages between different machines

An alternative approach would be the following: since I do not only want to synchronise my Emacs packages, but also other files (e.g. .emacs, .bashrc, but also other directories) between my server and ...
user avatar
  • 1,069
7 votes

Is there a simplified version control system appropriate for non-coders writing in Emacs?

As was mentioned, a simple way to have different versions of a file is Emacs backup system. (setq backup-directory-alist '(("." . "~/emacs-backups")) version-control 'numbered make-backup-...
user avatar
  • 3,276
7 votes
Accepted

Why does magit give so many "reverting buffer" messages?

Magit should only revert a file-visiting buffer if the file has actually changed on disk, see magit-revert-buffers. That function uses verify-visited-file-modtime to determine whether that is the case....
user avatar
  • 24.2k
7 votes
Accepted

version control using the usual backup system of Emacs

Here are two alternative answers, which both come from reading the Emacs manual, node Backup Names: Set variable version-control to nil, and then create a numbered backup for each of your "important" ...
user avatar
  • 69.2k
6 votes

What should/shouldn't I do when keeping .emacs and .emacs.d in version control?

I have the following things in my .hgignore emacs server file recentf file: File paths on one machine do not make sense on another elpa/melpa directory: Use init file to automatically install ...
user avatar
  • 3,816
6 votes
Accepted

Auto-indent without creating indentation in empty lines

Perhaps an even better idea is to use ws-butler, a mode that unobtrusively trims the relevant trailing whitespace whenever the buffer is saved (be it from auto-indentation or some other source). Even ...
user avatar
  • 9,993
5 votes

Why does my *vc-log* buffer start with "Summary:" in Emacs 24.4?

Since around Emacs-24, the vc-log buffer supports/expects an RFC822-style format, with some headers handled specially (e.g. Author:, Fixes:, and Summary:). In Emacs-24.4, the default message content ...
user avatar
  • 25.2k
5 votes

Synchronize packages between different machines

I use a little trick "stolen" from emacs-starter-kit (I think): (defun maybe-install-and-require (p) (when (not (package-installed-p p)) (package-install p)) (require p)) So when I require a ...
user avatar
5 votes

Synchronize packages between different machines

While package.el is the standard way to install packages, you might also want to try el-get which is very useful for installing packages which are not (or cannot be) on elpa. This answer deals with ...
user avatar
  • 7,278
5 votes
Accepted

Version control information out of sync with certain modes

When using diff-hl and magit => v2.4.0 you have to add this: (add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh) As far as the information in the mode-line is concerned, I would ...
user avatar
  • 24.2k
5 votes
Accepted

Is there a way to add a new VC mode for a different tool?

Yes, VC is structured so as to be easy to add new backends. The main code is in vc.el, and then each backend has a vc-<backend>.el file. Check all the vc-<backend>.el provided with Emacs ...
user avatar
  • 25.2k

Only top scored, non community-wiki answers of a minimum length are eligible