Package: dpkg-dev-el I find myself wanting to use outline commands in debian-changelog-mode more and more often. This patch adds C-c C-n and C-c C-p to move from heading to heading, which will make changelog browsing much more convenient. I also took the liberty of moving the heading regexp to a separate defvar form. Tested on current emacs-snapshot, emacs21 and xemacs21.
--- /usr/share/emacs/site-lisp/dpkg-dev-el/debian-changelog-mode.el 2005-06-09 03:52:36.000000000 +0200 +++ /tmp/debian-changelog-mode.el 2005-08-13 23:21:59.000000000 +0200 @@ -364,6 +364,24 @@ (defvar debian-changelog-local-variables-maybe-remove-done nil "Internal flag so we prompt only once.") +(defvar debian-changelog-heading-regexp +;;; The following is not strictly correct. The upstream version may actually +;;; contain a hyphen if a debian version number also exists, making two hyphens +;;; I'm assuming it begins with a digit, which is not enforced + "^\\(\\S-+\\) +(\\([0-9]:\\)?\\([0-9][0-9a-zA-Z.+:]*\\)\\(-\\([0-9a-zA-Z.+]+\\)\\)*)" +;; ^ +;; Note the asterix above, allowing more than one hyphen in the version +;; number, but wrongly assuming that all of it is the Debian version +;; instead of only the bit past the last hyphen. I might get NMUs wrongly +;; for version numbers with multiple hyphens. + +;; match 1: package name +;; match 2: epoch, if it exists +;; match 3: upstream version number +;; match 4: debian version number exists if matched +;; match 5: debian version number + "Regular expression to match a changelog entry heading.") + (autoload 'debian-bug-web-bug "debian-bug") (autoload 'debian-bug-web-bugs "debian-bug") (autoload 'debian-bug-web-packages "debian-bug") @@ -533,6 +551,30 @@ (debian-changelog-setheadervalue ") \\(.*\\)\\;" val)) (set-window-configuration window-config)))))) +(defun debian-changelog-next-heading (arg) + "Move to the next changelog entry heading. +With argument, repeats or can move backward if negative." + (interactive "p") + (if (< arg 0) + (beginning-of-line) + (end-of-line)) + (while (and (not (bobp)) (< arg 0)) + (while (and (not (bobp)) + (re-search-backward debian-changelog-heading-regexp + nil 'move) nil)) + (setq arg (1+ arg))) + (while (and (not (eobp)) (> arg 0)) + (while (and (not (eobp)) + (re-search-forward debian-changelog-heading-regexp + nil 'move) nil)) + (setq arg (1- arg))) + (beginning-of-line)) + +(defun debian-changelog-previous-heading (arg) + "Move to the previous changelog entry heading." + (interactive "p") + (debian-changelog-next-heading (- arg))) + ;; ;; keymap table definition ;; @@ -557,7 +599,11 @@ (define-key debian-changelog-mode-map "\C-c\C-u" 'debian-changelog-urgency) (define-key debian-changelog-mode-map "\C-c\C-e" - 'debian-changelog-unfinalise-last-version)) + 'debian-changelog-unfinalise-last-version) + (define-key debian-changelog-mode-map "\C-c\C-n" + 'debian-changelog-next-heading) + (define-key debian-changelog-mode-map "\C-c\C-p" + 'debian-changelog-previous-heading)) ;; ;; menu definition (Chris Waters) @@ -1322,22 +1368,7 @@ 2 -> native vsn number 3 -> non-native vsn number 4 -> non-native NMU vsn number" - (when (re-search-forward -;;; The following is not strictly correct. The upstream version may actually -;;; contain a hyphen if a debian version number also exists, making two hyphens -;;; I'm assuming it begins with a digit, which is not enforced - "^\\(\\S-+\\) +(\\([0-9]:\\)?\\([0-9][0-9a-zA-Z.+:]*\\)\\(-\\([0-9a-zA-Z.+]+\\)\\)*)" nil t) -;; ^ -;; Note the asterix above, allowing more than one hyphen in the version -;; number, but wrongly assuming that all of it is the Debian version -;; instead of only the bit past the last hyphen. I might get NMUs wrongly -;; for version numbers with multiple hyphens. - -;; match 1: package name -;; match 2: epoch, if it exists -;; match 3: upstream version number -;; match 4: debian version number exists if matched -;; match 5: debian version number + (when (re-search-forward debian-changelog-heading-regexp nil t) (cond ((not (match-string 4)) ;; No Debian version number -> Debian native package -- ,''`. : :' : Romain Francoise <[EMAIL PROTECTED]> `. `' http://people.debian.org/~rfrancoise/ `- -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]