view lisp/makesum.el @ 66354:cf99ce27df54

* mh-comp.el (mh-letter-menu): Rename mh-mhn-compose-external-compressed-tar to mh-mh-compose-external-compressed-tar. Rename mh-mhn-compose-anon-ftp to mh-mh-compose-anon-ftp. Rename mh-edit-mhn to mh-mh-to-mime. Rename mh-mhn-directive-present-p to mh-mh-directive-present-p. Rename mh-revert-mhn-edit to mh-mh-to-mime-undo. Rename mh-gnus-pgp-support-flag to mh-pgp-support-flag. Rename mh-compose-insertion value from 'mhn to 'mh. (mh-insert-signature): Rename mh-mhn-directive-present-p to mh-mh-directive-present-p. (mh-send-letter): Rename mh-mhn-directive-present-p to mh-mh-directive-present-p. Rename mh-edit-mhn to mh-mh-to-mime. (mh-letter-mode-map): Rename mh-edit-mhn to mh-mh-to-mime. Rename mh-mhn-compose-anon-ftp to mh-mh-compose-anon-ftp. Rename mh-mhn-compose-external-compressed-tar to mh-mh-compose-external-compressed-tar. Rename mh-revert-mhn-edit to mh-mh-to-mime-undo. Rename mh-mhn-compose-external-type to mh-mh-compose-external-type. Rename mh-mhn-compose-anon-ftp to mh-mh-compose-anon-ftp. Rename mh-mhn-compose-external-compressed-tar to mh-mh-compose-external-compressed-tar. Rename mh-revert-mhn-edit to mh-mh-to-mime-undo. Rename mh-mhn-compose-external-type to mh-mh-compose-external-type. (mh-send-letter, mh-letter-mode-map): Rename mh-edit-mhn to mh-mh-to-mime, mh-revert-mhn-edit to mh-mh-to-mime-undo. (mh-reply, mh-yank-cur-msg, mh-insert-prefix-string): Rename mh-yank-from-start-of-msg to mh-yank-behavior. (mh-letter-mode, mh-to-field, mh-to-fcc, mh-insert-signature) (mh-check-whom, mh-insert-auto-fields, mh-send-letter) (mh-insert-letter, mh-yank-cur-msg, mh-insert-prefix-string) (mh-fully-kill-draft, mh-open-line, mh-letter-complete) (mh-letter-complete-or-space, mh-letter-confirm-address) (mh-letter-next-header-field-or-indent) (mh-letter-previous-header-field) (mh-letter-toggle-header-field-display): Sync docstrings with manual. * mh-customize.el (mh-edit-mhn-hook): Rename to mh-mh-to-mime-hook. (mh-yank-from-start-of-msg): Rename to mh-yank-behavior. (mh-compose-insertion): Rename values from 'gnus and 'mhn to 'mh and user-visible values from mhn and Gnus to MH and MML. (mh-before-send-letter-hook): Added 'ispell-message option. (mh-mml-method-default): Rename mh-gnus-pgp-support-flag to mh-pgp-support-flag. (mh-compose-insertion, mh-compose-space-does-completion-flag) (mh-delete-yanked-msg-window-flag) (mh-extract-from-attribution-verb, mh-ins-buf-prefix) (mh-letter-complete-function, mh-letter-fill-column) (mh-mml-method-default, mh-signature-file-name) (mh-signature-separator-flag, mh-x-face-file) (mh-yank-behavior, mail-citation-hook) (mh-before-send-letter-hook, mh-mh-to-mime-hook): Sync docstrings with manual. * mh-gnus.el (mml-minibuffer-read-disposition): New function provided for Emacs 21 environments that lack it. * mh-mime.el (mh-mml-query-cryptographic-method): Use default prompt convention. (mh-compose-forward): mh-mh-forward-message requires string arg. (mh-minibuffer-read-type): New function. (mh-mhn-args): Rename to mh-mh-to-mime-args. (mh-mhn-compose-insertion): Rename to mh-mh-attach-file. (mh-mhn-compose-forw): Rename to mh-mh-forward-message. (mh-mhn-compose-type): Rename to mh-mh-compose-type. (mh-mhn-compose-anon-ftp): Rename to mh-mh-compose-anon-ftp. Rename mh-mhn-compose-external-type to mh-mh-compose-external-type. (mh-mhn-compose-external-compressed-tar): Rename to mh-mh-compose-external-compressed-tar. Rename mh-mhn-compose-external-type to mh-mh-compose-external-type. (mh-mhn-compose-external-type): Rename to mh-mh-compose-external-type. (mh-edit-mhn): Rename to mh-mh-to-mime. Rename mh-mhn-args to mh-mh-to-mime-args. Rename mh-edit-mhn-hook to mh-mh-to-mime-hook. Use correct program in message. (mh-mhn-directive-present-p): Rename to mh-mh-directive-present-p. (mh-mml-directive-present-p): Rename to mh-mml-tag-present-p. (mh-compose-forward, mh-mh-attach-file) (mh-mh-compose-anon-ftp, mh-mh-compose-external-compressed-tar) (mh-mh-compose-external-type, mh-mh-forward-message) (mh-mml-attach-file): Use mml-minibuffer-read-description, mh-minibuffer-read-type. (mh-mime-content-types): Moved comment about only being used in Emacs 20 to docstring. (mh-mh-compose-external-type): Rename extra-param argument to parameters. (mh-mml-to-mime, mh-secure-message) (mh-mml-unsecure-message, mh-mime-display-part) (mh-mime-display-single): Rename mh-gnus-pgp-support-flag to mh-pgp-support-flag. (mh-compose-insertion): Rename mh-mhn-compose-insertion to mh-mh-attach-file. (mh-compose-forward): Rename mh-mhn-compose-forw to mh-mh-forward-message. (mh-mhn-compose-insertion): Rename mh-mhn-compose-type to mh-mh-compose-type. (mh-compose-insertion, mh-compose-forward, mh-mh-to-mime-args) (mh-mh-attach-file, mh-mh-compose-type) (mh-mh-compose-anon-ftp, mh-mh-compose-external-compressed-tar) (mh-mh-compose-external-compressed-tar) (mh-mh-compose-external-type, mh-mh-forward-message) (mh-mh-to-mime, mh-mh-quote-unescaped-sharp, (mh-mh-to-mime-undo, mh-mh-directive-present-p, mh-mml-to-mime) (mh-mml-attach-file, mh-secure-message, mh-mml-unsecure-message) (mh-mml-secure-message-sign, mh-mml-secure-message-encrypt) (mh-mml-directive-present-p, mh-destroy-postponed-handles) (mh-display-smileys, mh-display-emphasis, mh-mime-save-parts): Sync docstrings with manual. * mh-utils.el (mh-gnus-pgp-support-flag): Rename to mh-pgp-support-flag.
author Bill Wohler <wohler@newt.com>
date Sun, 23 Oct 2005 21:26:17 +0000
parents 41bb365f41c4
children 3bd95f4f2941 2d92f5c9d6ae
line wrap: on
line source

;;; makesum.el --- generate key binding summary for Emacs

;; Copyright (C) 1985, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.

;; Maintainer: FSF
;; Keywords: help

;; This file is part of GNU Emacs.

;; GNU Emacs 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.

;; GNU Emacs 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 GNU Emacs; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.

;;; Commentary:

;; Displays a nice human-readable summary of all keybindings in a
;; two-column format.

;;; Code:

;;;###autoload
(defun make-command-summary ()
  "Make a summary of current key bindings in the buffer *Summary*.
Previous contents of that buffer are killed first."
  (interactive)
  (message "Making command summary...")
  ;; This puts a description of bindings in a buffer called *Help*.
  (save-window-excursion
   (describe-bindings))
  (with-output-to-temp-buffer "*Summary*"
    (save-excursion
     (let ((cur-mode mode-name))
       (set-buffer standard-output)
       (erase-buffer)
       (insert-buffer-substring "*Help*")
       (goto-char (point-min))
       (delete-region (point) (progn (forward-line 1) (point)))
       (while (search-forward "         " nil t)
	 (replace-match "  "))
       (goto-char (point-min))
       (while (search-forward "-@ " nil t)
	 (replace-match "-SP"))
       (goto-char (point-min))
       (while (search-forward "  .. ~ " nil t)
	 (replace-match "SP .. ~"))
       (goto-char (point-min))
       (while (search-forward "C-?" nil t)
	 (replace-match "DEL"))
       (goto-char (point-min))
       (while (search-forward "C-i" nil t)
	 (replace-match "TAB"))
       (goto-char (point-min))
       (if (re-search-forward "^Local Bindings:" nil t)
	   (progn
	    (forward-char -1)
	    (insert " for " cur-mode " Mode")
	    (while (search-forward "??\n" nil t)
	      (delete-region (point)
			     (progn
			      (forward-line -1)
			      (point))))))
       (goto-char (point-min))
       (insert "Emacs command summary, " (substring (current-time-string) 0 10)
	       ".\n")
       ;; Delete "key    binding" and underlining of dashes.
       (delete-region (point) (progn (forward-line 2) (point)))
       (forward-line 1)			;Skip blank line
       (while (not (eobp))
	 (let ((beg (point)))
	   (or (re-search-forward "^$" nil t)
	       (goto-char (point-max)))
	   (double-column beg (point))
	   (forward-line 1)))
       (goto-char (point-min)))))
  (message "Making command summary...done"))

(defun double-column (start end)
  (interactive "r")
  (let (half cnt
        line lines nlines
	(from-end (- (point-max) end)))
    (setq nlines (count-lines start end))
    (if (<= nlines 1)
	nil
      (setq half (/ (1+ nlines) 2))
      (goto-char start)
      (save-excursion
       (forward-line half)
       (while (< half nlines)
	 (setq half (1+ half))
	 (setq line (buffer-substring (point) (save-excursion (end-of-line) (point))))
	 (setq lines (cons line lines))
	 (delete-region (point) (progn (forward-line 1) (point)))))
      (setq lines (nreverse lines))
      (while lines
	(end-of-line)
	(indent-to 41)
	(insert (car lines))
	(forward-line 1)
	(setq lines (cdr lines))))
    (goto-char (- (point-max) from-end))))

(provide 'makesum)

;;; arch-tag: c2383336-fc89-46ad-8110-ded42bffaee3
;;; makesum.el ends here