1 ;;; makesum.el --- generate key binding summary for Emacs
4 ;; Last-Modified: 09 May 1991
7 ;; Copyright (C) 1985 Free Software Foundation, Inc.
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to
23 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
28 (defun make-command-summary ()
29 "Make a summary of current key bindings in the buffer *Summary*.
30 Previous contents of that buffer are killed first."
32 (message "Making command summary...")
33 ;; This puts a description of bindings in a buffer called *Help*.
34 (save-window-excursion
36 (with-output-to-temp-buffer "*Summary*"
38 (let ((cur-mode mode-name
))
39 (set-buffer standard-output
)
41 (insert-buffer-substring "*Help*")
42 (goto-char (point-min))
43 (delete-region (point) (progn (forward-line 1) (point)))
44 (while (search-forward " " nil t
)
46 (goto-char (point-min))
47 (while (search-forward "-@ " nil t
)
48 (replace-match "-SP"))
49 (goto-char (point-min))
50 (while (search-forward " .. ~ " nil t
)
51 (replace-match "SP .. ~"))
52 (goto-char (point-min))
53 (while (search-forward "C-?" nil t
)
54 (replace-match "DEL"))
55 (goto-char (point-min))
56 (while (search-forward "C-i" nil t
)
57 (replace-match "TAB"))
58 (goto-char (point-min))
59 (if (re-search-forward "^Local Bindings:" nil t
)
62 (insert " for " cur-mode
" Mode")
63 (while (search-forward "??\n" nil t
)
64 (delete-region (point)
68 (goto-char (point-min))
69 (insert "Emacs command summary, " (substring (current-time-string) 0 10)
71 ;; Delete "key binding" and underlining of dashes.
72 (delete-region (point) (progn (forward-line 2) (point)))
73 (forward-line 1) ;Skip blank line
76 (or (re-search-forward "^$" nil t
)
77 (goto-char (point-max)))
78 (double-column beg
(point))
80 (goto-char (point-min)))))
81 (message "Making command summary...done"))
83 (defun double-column (start end
)
87 (from-end (- (point-max) end
)))
88 (setq nlines
(count-lines start end
))
91 (setq half
(/ (1+ nlines
) 2))
95 (while (< half nlines
)
97 (setq line
(buffer-substring (point) (save-excursion (end-of-line) (point))))
98 (setq lines
(cons line lines
))
99 (delete-region (point) (progn (forward-line 1) (point)))))
100 (setq lines
(nreverse lines
))
106 (setq lines
(cdr lines
))))
107 (goto-char (- (point-max) from-end
))))
109 ;;; makesum.el ends here