On this page... (hide)
- Native Emacs “versioning” - backups, etc.
- Using CVS inside of Emacs
- Using RCS in GNU Emacs
- Mercurial integration
- Log files
- See Also
- Add Comment
TODO: more notes
;; scattered all over the file system!
(defvar autosave-dir "~/autosaves/")
(make-directory autosave-dir t)
(defun auto-save-file-name-p (filename)
(string-match "^#.*#$" (file-name-nondirectory filename)))
(defun make-auto-save-file-name ()
(concat "#" (file-name-nondirectory buffer-file-name) "#")
(concat "#%" (buffer-name) "#")))))
;; Put backup files (ie foo~) in one place too. (The backup-directory-alist
;; list contains regexp=>directory mappings; filenames matching a regexp are
;; backed up in the corresponding directory. Emacs will mkdir it if necessary.)
(defvar backup-dir "~/backups/")
(setq backup-directory-alist (list (cons "." backup-dir)))
I had issues with RCS under my WinXP EmacsW32 set-up. Usually it wouldn’t work; sometimes it would. It would always work from the command-line (cmd-shell outside of Emacs). Finally, I found some some other installation of
ci.exe (etc.) that had a higher-priority in my path. Or at least the Emacs path. I re-orged my PATH environment-variable to put the RCS/bin directory much earlier than it was. But if that were the problem/solution, it never would have worked from the command-shell in the first place. Hunh. My other thought was that Cygwin was interfering, somehow -- but that isn’t even in the path. So, I am left with RCS working, but no definitive answer for how I fixed it. Aaaargh. cargo-cult programming, once again....
If anybody asks “why on earth use RCS when, since you have a local server installed, you could use CVS?”, I would respond that I prefer using CVS for projects, but RCS is handier for one-off files here and there. Or so it seems to me.
(adapted from http://agave.garden.org/~aaronh/rcs/emacs.html)
Emacs has integrated support for RCS (and other version control systems). Emacs looks for RCS comma-v (
,v) files in the current directory or in an RCS subdirectory.
Version Control Commands in Emacs
Commands are located in the menu system in Tools...Version Control. The keyboard command prefix for all version control commands is
To check in a new file to RCS - Register command (keyboard sequence
C-x v i or
C-x v v.
Files that are using RCS will have the following status line:
--1-:%%-F1 strntok.c (C RCS-1.2)--L1--Top-------
%% indicates the buffer is read-only. The
RCS-1.2 indicates that this file is under RCS control, and you are viewing revision 1.2.
To checkout and be able to edit the file - Check In/Out command
C-x v v The status line will now be:
--1-:---F1 strntok.c (C RCS:1.2)--L1--Top------
%% means the file is writeable, and the semicolon (: after RCS, resulting in RCS:, means the file is locked.
To compare the current version of the file you’re editing with the last version in RCS - Compare to Last Version
C-v =, which opens a buffer with the output of the rcsdiff command.
To check in files use the same command as check out - Register command
C-x v v
Checking in files results in Emacs asking to save the buffer it hasn’t been saved, and creates a window (buffer *VC-log*)to enter a change comment. Emacs tells you to type
C-c C-c when done.
To undo all the changes to a file - Revert to Last Version
C-x v u
The meta revision information of a file - Show History
C-x v l
View another revision of a file in another window - Show Other Version
C-x v ~
Stack Overflow: best Emacs mode for Mercurial
I used Mercurial (from Emacs, mostly) for a few months at work. Ultimately, I ran afoul of case-sensitivity issues. Windows is not case-sensitive, Mercurial is. And since it allowed me to enter the same file in different casings (eg myFile.txt and MyFile.txt) - case-sensitive M Ercurial? insisted they were different files, yet part of the same archive-file (however it internally works) and wouldn’t let me retrieve anything. Several weeks of commits lost to a case issue. Aaaaargh. I found a reference to somebody facing the same problem, who got around it by patching and recompiling the source. I lost the reference, and didn’t attempt it, either. :::sigh:
The problem is that the relation between version control software and ChangeLog files isn't automatic enough as it should be. [....] In Emacs, ChangeLog support is quite successful.
No comments yet.