--- /dev/null
+;;; -*-Scheme-*-
+;;;
+;;; $Id: debian-changelog.scm,v 1.1 2001/02/05 18:55:45 cph Exp $
+;;;
+;;; Copyright (c) 2001 Massachusetts Institute of Technology
+;;;
+;;; This program 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 of the
+;;; License, or (at your option) any later version.
+;;;
+;;; This program 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 this package; if not, write to the Free Software
+;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+;;; 02111-1307, USA.
+
+;;;; Debian changelog mode
+
+(declare (usual-integrations))
+\f
+(define-major-mode debian-changelog text "Debian changelog"
+ "Major mode for editing Debian-style change logs.
+Runs `debian-changelog-mode-hook' if it exists.
+
+Key bindings:
+
+\\{debian-changelog-mode-map}"
+ (lambda (buffer)
+ (local-set-variable! left-margin 2)
+ (local-set-variable! fill-prefix " ")
+ (local-set-variable! fill-column 74)
+
+ ;; Let each entry behave as one paragraph:
+ (local-set-variable! paragraph-start "\\*")
+ (local-set-variable! paragraph-separate "\\*\\|\\s-*$|\\S-")
+
+ ;; Let each version behave as one page.
+ ;; Match null string on the heading line so that the heading line
+ ;; is grouped with what follows.
+ (local-set-variable! page-delimiter "^\\<")
+ (local-set-variable! version-control 'NEVER)
+
+ (event-distributor/invoke! (ref-variable debian-changelog-mode-hook buffer)
+ buffer)))
+
+(define-variable debian-changelog-mode-hook
+ "An event distributor that is invoked when entering Debian changelog mode."
+ (make-event-distributor))
+
+(define-key 'debian-changelog '(#\C-c #\C-a) 'debian-changelog-add-entry)
+(define-key 'debian-changelog '(#\C-c #\C-f)
+ 'debian-changelog-finalize-last-version)
+(define-key 'debian-changelog '(#\C-c #\C-c)
+ 'debian-changelog-finalize-and-save)
+(define-key 'debian-changelog '(#\C-c #\C-v) 'debian-changelog-add-version)
+(define-key 'debian-changelog '(#\C-c #\C-d) 'debian-changelog-distribution)
+(define-key 'debian-changelog '(#\C-c #\C-u) 'debian-changelog-urgency)
+(define-key 'debian-changelog '(#\C-c #\C-e)
+ 'debian-changelog-unfinalize-last-version)
+\f
+(define-command debian-changelog-add-version
+ "Add a new version section to a debian-style changelog file."
+ ()
+ (lambda ()
+ (let ((buffer (selected-buffer)))
+ (if (not (version-finalized? buffer))
+ (error "Previous version not yet finalized."))
+ (let* ((finish
+ (lambda (package version)
+ (let ((m (mark-left-inserting-copy (buffer-start buffer))))
+ (insert-string package m)
+ (insert-string " (" m)
+ (insert-string version m)
+ (insert-string ") unstable; urgency=low" m)
+ (insert-newlines 2 m)
+ (insert-string " * " m)
+ (insert-newlines 2 m)
+ (insert-string " --" m)
+ (insert-newlines 2 m)
+ (mark-temporary! m))))
+ (prompt
+ (lambda ()
+ (let ((package (prompt-for-string "Package name" #f)))
+ (finish package
+ (prompt-for-string
+ "New version (including any revision)"
+ #f))))))
+ (if (match-title-line buffer #f)
+ (let ((package
+ (re-match-extract-string title-regexp-index:package-name))
+ (version
+ (re-match-extract-string title-regexp-index:version)))
+ (let ((regs
+ (re-string-search-forward "\\([0-9]+\\)$" version)))
+ (if regs
+ (finish
+ package
+ (string-append
+ (string-head version (re-match-start-index 1 regs))
+ (number->string
+ (+ (string->number (re-match-extract version regs 1))
+ 1))))
+ (prompt))))
+ (prompt))))))
+
+(define-command debian-changelog-add-entry
+ "Add a new change entry to a debian-style changelog."
+ ()
+ (lambda ()
+ (let ((buffer (selected-buffer)))
+ (if (version-finalized? buffer)
+ (error
+ (substitute-command-keys
+ (string-append
+ "Most recent version has been finalized - use "
+ "\\[debian-changelog-unfinalize-last-version] or "
+ "\\[debian-changelog-add-version]")
+ buffer)))
+ (let ((m (mark-left-inserting-copy (trailer-line buffer))))
+ (guarantee-newline m)
+ (insert-string " * " m)
+ (insert-newline m)
+ (mark-temporary! m)
+ (set-current-point! (mark-1+ m))))))
+\f
+(define-command debian-changelog-distribution
+ "Delete the current distribution and prompt for a new one."
+ ()
+ (lambda ()
+ (set-title-distribution (selected-buffer)
+ (prompt-for-alist-value
+ "Select distribution"
+ (map (lambda (s) (cons s s))
+ '("stable"
+ "frozen"
+ "unstable"
+ "stable frozen unstable"
+ "stable unstable frozen"
+ "unstable stable frozen"
+ "unstable frozen stable"
+ "frozen unstable stable"
+ "frozen stable unstable"
+ "frozen unstable"
+ "unstable frozen"
+ "stable frozen"
+ "frozen stable"
+ "stable unstable"
+ "unstable stable"))))))
+
+(define-command debian-changelog-urgency
+ "Delete the current urgency and prompt for a new one."
+ ()
+ (lambda ()
+ (set-title-urgency (selected-buffer)
+ (prompt-for-alist-value
+ "Select urgency"
+ (map (lambda (s) (cons s s))
+ '("low" "medium" "high" ))))))
+
+(define-command debian-changelog-finalize-and-save
+ "Finalize, if necessary, and then save a debian-style changelog file."
+ ()
+ (lambda ()
+ (let ((buffer (selected-buffer)))
+ (if (not (version-finalized? buffer))
+ (finalize-last-version buffer))
+ (save-buffer buffer #f))))
+
+(define-command debian-changelog-finalize-last-version
+ "Add the `finalization' information (maintainer's name and email
+address and release date)."
+ ()
+ (lambda () (finalize-last-version (selected-buffer))))
+
+(define (finalize-last-version buffer)
+ (let ((m (mark-left-inserting-copy (trailer-line buffer))))
+ (delete-string m (line-end m 0))
+ (insert-string " " m)
+ (insert-string (or (ref-variable add-log-full-name buffer)
+ (mail-full-name buffer))
+ m)
+ (insert-string " <" m)
+ (insert-string (or (ref-variable add-log-mailing-address buffer)
+ (user-mail-address buffer))
+ m)
+ (insert-string "> " m)
+ (insert-string (universal-time->string (get-universal-time)) m)
+ (mark-temporary! m)))
+
+(define-command debian-changelog-unfinalize-last-version
+ "Remove the `finalization' information (maintainer's name and email
+address and release date) so that new entries can be made."
+ ()
+ (lambda ()
+ (let ((buffer (selected-buffer)))
+ (if (not (version-finalized? buffer))
+ (error "Most recent version is not finalized."))
+ (let ((m (trailer-line buffer)))
+ (delete-string m (line-end m 0))))))
+\f
+(define (version-finalized? buffer)
+ (let ((m (trailer-line buffer)))
+ (cond ((re-match-forward
+ "[ \t]+\\S [^\n\t]+\\S <[^ \t\n<>]+> \\S [^\t\n]+\\S [ \t]*$"
+ m)
+ #t)
+ ((re-match-forward "[ \t]*$" m) #f)
+ (else (error "Malformed finalization line.")))))
+
+(define (trailer-line buffer)
+ (let ((start (buffer-start buffer))
+ (end (buffer-end buffer)))
+ (if (not (re-search-forward "\n\\S " start end))
+ (error "Unable to find version-end line."))
+ (let ((m (mark1+ (re-match-start 0))))
+ (if (re-search-backward "\n --" start)
+ (re-match-end 0)
+ (let ((m (mark-left-inserting-copy m)))
+ (insert-string " --" m)
+ (insert-newlines 2 m)
+ (mark-temporary! m)
+ (mark- m 2))))))
+
+(define (set-title-distribution buffer distribution)
+ (set-title-value buffer title-regexp-index:distribution distribution))
+
+(define (set-title-urgency buffer urgency)
+ (set-title-value buffer title-regexp-index:urgency urgency))
+
+(define (set-title-value buffer index value)
+ (match-title-line buffer #t)
+ (let ((s (mark-left-inserting-copy (re-match-start index)))
+ (e (re-match-end index)))
+ (delete-string s e)
+ (insert-string value s)
+ (mark-temporary! s)))
+
+(define (match-title-line buffer error?)
+ (or (let ((start (buffer-start buffer)))
+ (re-match-forward title-regexp start (line-end start 0)))
+ (and error? (error "Unable to match title line."))))
+
+(define title-regexp
+ (let ((package-name "[a-zA-Z0-9+.-]+")
+ (version "[a-zA-Z0-9+.:-]+"))
+ (string-append "^\\("
+ package-name
+ "\\) +(\\("
+ version
+ "\\)) \\( *"
+ package-name
+ "\\( +"
+ package-name
+ "\\)+ *\\);.*"
+ " urgency=\\([a-zA-Z0-9]+\\)")))
+(define title-regexp-index:package-name 1)
+(define title-regexp-index:version 2)
+(define title-regexp-index:distribution 3)
+(define title-regexp-index:urgency 5)
\ No newline at end of file
;;; -*-Scheme-*-
;;;
-;;; $Id: loadef.scm,v 1.42 2000/02/29 03:59:26 cph Exp $
+;;; $Id: loadef.scm,v 1.43 2001/02/05 18:55:56 cph Exp $
;;;
-;;; Copyright (c) 1986, 1989-2000 Massachusetts Institute of Technology
+;;; Copyright (c) 1986, 1989-2001 Massachusetts Institute of Technology
;;;
;;; This program is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU General Public License as
(declare (usual-integrations))
\f
-;;;; Major Mode Libraries
+;;; ****************
+
(define-library 'TECHINFO-MODE
'("techinfo" (EDWIN)))
(define-autoload-command 'techinfo 'TECHINFO-MODE
"Enter TechInfo mode.")
+;;; ****************
+
(define-library 'TELNET-MODE
'("telnet" (EDWIN)))
"An event distributor that is invoked when entering Telnet mode."
(make-event-distributor))
+;;; ****************
+
(define-library 'MIDAS-MODE
'("midas" (EDWIN)))
"An event distributor that is invoked when entering Midas mode."
(make-event-distributor))
+;;; ****************
+
(define-library 'PASCAL-MODE
'("pasmod" (EDWIN)))
This must be a regular expression, or #F to disable the option."
false)
\f
+;;; ****************
+
(define-library 'TEXINFO-MODE
'("tximod" (EDWIN)))
(define-autoload-major-mode 'texinfo 'text "Texinfo" 'TEXINFO-MODE
- "Major mode for editing Texinfo files.
-
- These are files that are used as input for TeX to make printed manuals
-and also to be turned into Info files by \\[texinfo-format-buffer] or
-`makeinfo'. These files must be written in a very restricted and
-modified version of TeX input format.
-
- Editing commands are like text-mode except that the syntax table is
-set up so expression commands skip Texinfo bracket groups.
-
- In addition, Texinfo mode provides commands that insert various
-frequently used @-sign commands into the buffer. You can use these
-commands to save keystrokes.")
+ "Major mode for editing Texinfo files.")
(define-autoload-command 'texinfo-mode 'TEXINFO-MODE
"Make the current mode be Texinfo mode.")
(define-variable texinfo-mode-hook
"An event distributor that is invoked when entering Texinfo mode."
(make-event-distributor))
-\f
-;;;; Other Libraries
+
+;;; ****************
(define-library 'manual
'("manual" (EDWIN)))
and the resulting string is provided to a shell running in a subprocess."
false
string-or-false?)
+\f
+;;; ****************
(define-library 'print
'("print" (EDWIN)))
(define-autoload-command 'print-region 'PRINT
"Print region contents as with Unix command `lpr -p'.")
-\f
+
+;;; ****************
+
(define-library 'SORT
'("sort" (EDWIN)))
(define-autoload-command 'sort-columns 'SORT
"Sort lines by the text in a range of columns.")
+\f
+;;; ****************
(define-library 'STEPPER
'("eystep" (EDWIN STEPPER)))
(define-autoload-command 'step-defun 'STEPPER
"Single-step the definition that the point is in or before.")
+;;; ****************
+
(define-library 'NEWS-READER
'("nntp" (EDWIN NNTP))
'("snr" (EDWIN NEWS-READER)))
but with a prefix arg prompts for the server name.
Only one News reader may be open per server; if a previous News reader
is open the that server, its buffer is selected.")
-\f
+
+;;; ****************
+
(define-library 'VERILOG-MODE
'("verilog" (EDWIN VERILOG)))
"Extra indent for continuation lines of structure headers."
4
exact-nonnegative-integer?)
+\f
+;;; ****************
(define-library 'VHDL-MODE
'("vhdl" (EDWIN VHDL)))
"Extra indent for lines not starting new statements."
2
exact-nonnegative-integer?)
-\f
-;;;; Webster
+
+;;; ****************
(define-library 'WEBSTER
'("webster" (EDWIN)))
(define-autoload-major-mode 'webster 'read-only "Webster" 'WEBSTER
- "Major mode for interacting with webster server.
-Commands:
-
-\\[webster-define] look up the definition of a word
-\\[webster-spellings] look up possible correct spellings for a word
-\\[webster-define] look up possible endings for a word
-\\[webster-quit] close connection to the Webster server
-
-Use webster-mode-hook for customization.")
+ "Major mode for interacting with webster server.")
(define-autoload-command 'webster 'WEBSTER
"Look up a word in Webster's dictionary.")
"*webster*"
string?)
\f
-;;;; Password Editor
+;;; ****************
(define-library 'PASSWORD-EDIT
'("pwedit" (EDWIN PASSWORD-EDIT))
(define-autoload-command 'mouse-toggle-pw-form 'PASSWORD-EDIT
"Toggle the body of the password form under mouse.")
+
+;;; ****************
+
+(define-library 'DEBIAN-CHANGELOG
+ '("debian-changelog" (EDWIN DEBIAN-CHANGELOG)))
+
+(define-autoload-major-mode 'debian-changelog 'text "Debian changelog"
+ 'DEBIAN-CHANGELOG
+ "Major mode for editing Debian-style change logs.")
+
+(define-variable add-log-full-name
+ "Full name of user, for inclusion in ChangeLog headers.
+This defaults to the value `mail-full-name'."
+ #f
+ string-or-false?)
+
+(define-variable add-log-mailing-address
+ "Electronic mail address of user, for inclusion in ChangeLog headers.
+This defaults to the value of `user-mail-address'."
+ #f
+ string-or-false?)
\f
;;;; DOS-specific commands