My upload of dpkg 1.3.0 didn't include the file below. It is an Emacs
mode for editing the changelogs that dpkg-parsechangelog understands.
Try it (on your own packages or on the changelog from hello 1.3-7) and
let me know what you think.
When I know where to put the autoload definitions I'll release a dpkg
version with this file. I don't propose to use the auto-mode-alist:
the file is named simply `changelog' because it is in the `debian'
subdirectory of the source tree, and binding that filename to
dpkg-changelog-mode would IMO be too obnoxious. Instead people can
perhaps use a local variables clause to set the mode.
There are facilities in dpkg 1.3.0 for defining a parser for a
different changelog format. I put this in because people seemed so
hung up on the Emacs format, which I think is dreadful. However, if
someone defines a standard way of representing the required
information in an Emacs-style changelog and writes the parser for it
I'll distribute it.
Of course I'd be far happier if there were a (possibly rough)
consensus that we should stick to my format so that I can write that
into the policy manual, but for the moment I'll just mandate that you
have to use a format that the latest dpkg supports (so that people
don't need to find your home-grown parser to build your package).
Ian.
;; dpkg-changelog.el --- change log maintenance for dpkg-style changelogs
;; Keywords: maint
;; Copyright (C) 1996 Ian Jackson
;; This file is part of dpkg.
;;
;; It is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;;
;; dpkg is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with your Debian installation, in /usr/doc/copyright/GPL.
;; If not, write to the Free Software Foundation, 675 Mass Ave,
;; Cambridge, MA 02139, USA.
(require 'add-log)
(defvar dpkg-changelog-urgencies
'((?l.LOW) (?m.MEDIUM) (?h.HIGH))
alist of keystrokes vs. urgency values dpkg-changelog-urgency ^c^u.)
(defvar dpkg-changelog-distributions
'((?s.stable) (?u.unstable) (?c.contrib) (?n.non-free)
(?e.experimental))
alist of keystrokes vs. distribution values for dpkg-changelog-distribution
^c^d.)
(defvar dpkg-changelog-mode-map nil
Keymap for dpkg changelog major mode.)
(if dpkg-changelog-mode-map
nil
(setq dpkg-changelog-mode-map (make-sparse-keymap))
(define-key dpkg-changelog-mode-map \C-c\C-a 'dpkg-changelog-add-entry)
(define-key dpkg-changelog-mode-map \C-c\C-f
'dpkg-changelog-finalise-last-version)
(define-key dpkg-changelog-mode-map \C-c\C-c
'dpkg-changelog-finalise-and-save)
(define-key dpkg-changelog-mode-map \C-c\C-v 'dpkg-changelog-add-version)
(define-key dpkg-changelog-mode-map \C-c\C-d 'dpkg-changelog-distribution)
(define-key dpkg-changelog-mode-map \C-c\C-u 'dpkg-changelog-urgency)
(define-key dpkg-changelog-mode-map \C-c\C-e
'dpkg-changelog-unfinalise-last-version))
(defun dpkg-changelog-add-entry ()
Add a new change entry to a dpkg-style changelog.
(interactive)
(if (eq (dpkg-changelog-finalised-p) t)
(error most recent version has been finalised - use ^c^e or ^c^v))
(goto-char (point-min))
(re-search-forward \n --)
(backward-char 5)
(if (prog1 (looking-at \n) (forward-char 1))
nil
(insert \n))
(insert * )
(save-excursion (insert \n)))
(defun dpkg-changelog-headervalue (arg re alist)
(let (a b v k
(lineend (save-excursion (end-of-line) (point
(save-excursion
(goto-char (point-min))
(re-search-forward re lineend)
(setq a (match-beginning 1)
b (match-end 1))
(goto-char a)
(if arg nil
(message (mapconcat
(function (lambda (x) (format %c:%s (car x) (cdr x
alist ))
(while (not v)
(setq k (read-char))
(setq v (assoc k alist
(delete-region a b)
(if arg nil (insert (cdr v
(if arg (goto-char a
(defun dpkg-changelog-urgency (arg)
Without argument, prompt for a key for a new urgency value (using
dpkg-changelog-urgencies). With argument, delete the current urgency
and position the cursor to type a new one.
(interactive P)
(dpkg-changelog-headervalue
arg
\\;[^\n]* urgency=\\(\\sw+\\)
dpkg-changelog-urgencies))
(defun dpkg-changelog-distribution (arg)
Without argument, prompt for a key for a new distribution value (using
dpkg-changelog-distributions). With argument, delete the current distribution
and position the cursor to type a new one.
(interactive P)
(dpkg-changelog-headervalue
arg
) \\(.*\\)\\;
dpkg-changelog-distributions))