abbrevlist.el 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. ;; List one abbrev table alphabetically ordered.
  2. ;; Copyright (C) 1986 Free Software Foundation, Inc.
  3. ;; Suggested by a previous version by Gildea.
  4. ;; This file is part of GNU Emacs.
  5. ;; GNU Emacs is distributed in the hope that it will be useful,
  6. ;; but WITHOUT ANY WARRANTY. No author or distributor
  7. ;; accepts responsibility to anyone for the consequences of using it
  8. ;; or for whether it serves any particular purpose or works at all,
  9. ;; unless he says so in writing. Refer to the GNU Emacs General Public
  10. ;; License for full details.
  11. ;; Everyone is granted permission to copy, modify and redistribute
  12. ;; GNU Emacs, but only under the conditions described in the
  13. ;; GNU Emacs General Public License. A copy of this license is
  14. ;; supposed to have been given to you along with GNU Emacs so you
  15. ;; can know your rights and responsibilities. It should be in a
  16. ;; file named COPYING. Among other things, the copyright notice
  17. ;; and this notice must be preserved on all copies.
  18. (provide 'abbrevlist)
  19. (defun list-one-abbrev-table (abbrev-table output-buffer)
  20. "Display alphabetical listing of ABBREV-TABLE in buffer BUFFER."
  21. (with-output-to-temp-buffer output-buffer
  22. (save-excursion
  23. (let ((abbrev-list nil) (first-column 0))
  24. (set-buffer standard-output)
  25. (mapatoms
  26. (function (lambda (abbrev)
  27. (setq abbrev-list (cons abbrev abbrev-list))))
  28. abbrev-table)
  29. (sort abbrev-list 'string-lessp)
  30. (while abbrev-list
  31. (if (> (+ first-column 40) (screen-width))
  32. (progn
  33. (insert "\n")
  34. (setq first-column 0)))
  35. (indent-to first-column)
  36. (insert (symbol-name (car abbrev-list)))
  37. (indent-to (+ first-column 8))
  38. (insert (symbol-value (car abbrev-list)))
  39. (setq first-column (+ first-column 40))
  40. (setq abbrev-list (cdr abbrev-list)))))))