abbrevlist.el 1.91 KB
Newer Older
1
;;; abbrevlist.el --- list one abbrev table alphabetically ordered
Eric S. Raymond's avatar
Eric S. Raymond committed
2

Glenn Morris's avatar
Glenn Morris committed
3
;; Copyright (C) 1986, 1992, 2001, 2002, 2003, 2004,
4
;;   2005, 2006 Free Software Foundation, Inc.
Jim Blandy's avatar
Jim Blandy committed
5
;; Suggested by a previous version by Gildea.
Eric S. Raymond's avatar
Eric S. Raymond committed
6

Eric S. Raymond's avatar
Eric S. Raymond committed
7 8
;; Maintainer: FSF
;; Keywords: abbrev
Jim Blandy's avatar
Jim Blandy committed
9 10 11 12 13

;; 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
Eric S. Raymond's avatar
Eric S. Raymond committed
14
;; the Free Software Foundation; either version 2, or (at your option)
Jim Blandy's avatar
Jim Blandy committed
15 16 17 18 19 20 21 22
;; 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
Erik Naggum's avatar
Erik Naggum committed
23
;; along with GNU Emacs; see the file COPYING.  If not, write to the
Lute Kamstra's avatar
Lute Kamstra committed
24 25
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
Jim Blandy's avatar
Jim Blandy committed
26

27 28
;;; Commentary:

Eric S. Raymond's avatar
Eric S. Raymond committed
29
;;; Code:
Jim Blandy's avatar
Jim Blandy committed
30

31
;;;###autoload
Jim Blandy's avatar
Jim Blandy committed
32 33 34 35 36 37
(defun list-one-abbrev-table (abbrev-table output-buffer)
  "Display alphabetical listing of ABBREV-TABLE in buffer OUTPUT-BUFFER."
  (with-output-to-temp-buffer output-buffer
    (save-excursion
      (let ((abbrev-list nil) (first-column 0))
	(set-buffer standard-output)
Pavel Janík's avatar
Pavel Janík committed
38
	(mapatoms
Jim Blandy's avatar
Jim Blandy committed
39 40 41 42 43
	  (function (lambda (abbrev)
		      (setq abbrev-list (cons abbrev abbrev-list))))
	  abbrev-table)
	(setq abbrev-list (sort abbrev-list 'string-lessp))
	(while abbrev-list
44
	  (if (> (+ first-column 40) (window-width))
Jim Blandy's avatar
Jim Blandy committed
45 46 47 48 49 50 51 52 53
	      (progn
		(insert "\n")
		(setq first-column 0)))
	  (indent-to first-column)
	  (insert (symbol-name (car abbrev-list)))
	  (indent-to (+ first-column 8))
	  (insert (symbol-value (car abbrev-list)))
	  (setq first-column (+ first-column 40))
	  (setq abbrev-list (cdr abbrev-list)))))))
Jim Blandy's avatar
Jim Blandy committed
54 55 56

(provide 'abbrevlist)

Miles Bader's avatar
Miles Bader committed
57
;;; arch-tag: 178f0638-6597-4c16-bcee-576c3d8e9217
Eric S. Raymond's avatar
Eric S. Raymond committed
58
;;; abbrevlist.el ends here