The Emacs command C-x 4 a adds a new entry to the change log
file for the file you are editing
add-change-log-entry-other-window). If that file is actually
a backup file, it makes an entry appropriate for the file’s
parent—that is useful for making log entries for functions that
have been deleted in the current version.
C-x 4 a visits the change log file and creates a new entry unless the most recent entry is for today’s date and your name. It also creates a new item for the current file. For many languages, it can even guess the name of the function or other object that was changed.
To find the change log file, Emacs searches up the directory tree from
the file you are editing. By default, it stops if it finds a
directory that seems to be the root of a version-control repository.
To change this, customize
When the variable
nil, C-x 4 a adds to any existing item for the file,
rather than starting a new item.
You can combine multiple changes of the same nature. If you don’t enter any text after the initial C-x 4 a, any subsequent C-x 4 a adds another symbol to the change log entry.
add-log-always-start-new-record is non-
C-x 4 a always makes a new entry, even if the last entry
was made by you and on the same date.
If the value of the variable
nil, C-x 4 a adds the file’s version number to the
change log entry. It finds the version number by searching the first
ten percent of the file, using regular expressions from the variable
The change log file is visited in Change Log mode. In this major mode, each bunch of grouped items counts as one paragraph, and each entry is considered a page. This facilitates editing the entries. C-j and auto-fill indent each new line like the previous line; this is convenient for entering the contents of an entry.
You can use the command
change-log-goto-source (by default
bound to C-c C-c) to go to the source location of the change log
entry near point, when Change Log mode is on. Then subsequent
invocations of the
next-error command (by default bound to
M-g M-n and C-x `) will move between entries in the change
log. You will jump to the actual site in the file that was changed,
not just to the next change log entry. You can also use
previous-error to move back through the change log entries.
You can use the command M-x change-log-merge to merge other log files into a buffer in Change Log Mode, preserving the date ordering of entries.
Version control systems are another way to keep track of changes in
your program and keep a change log. Many projects that use a VCS don’t
keep a separate versioned change log file nowadays, so you may wish to
avoid having such a file in the repository. If the value of
add-log-dont-create-changelog-file is non-
like C-x 4 a (
record changes in a suitably named temporary buffer instead of a file,
if such a file does not already exist.
Whether you have a change log file or use a temporary buffer for
change logs, you can type C-c C-a
log-edit-insert-changelog) in the VC Log buffer to insert the
relevant change log entries, if they exist. See Features of the Log Entry Buffer.