diff options
| author | Stefan Monnier | 2000-07-05 22:07:21 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2000-07-05 22:07:21 +0000 |
| commit | 5e2dfaa48edd8fc566892fd3e72baa50a7dbe2b4 (patch) | |
| tree | f74f2e21b3225575b36606635cb6ed03499f504e | |
| parent | 8d9f77f43cce847c010bb63a8756dbf2d9154067 (diff) | |
| download | emacs-5e2dfaa48edd8fc566892fd3e72baa50a7dbe2b4.tar.gz emacs-5e2dfaa48edd8fc566892fd3e72baa50a7dbe2b4.zip | |
Require CL.
(copy-tree, remprop): Remove, it's provided by CL.
(map-keymap): Define in terms of cl-map-keymap.
(extent-property, set-extent-end-glyph): New functions.
| -rw-r--r-- | lisp/ChangeLog | 12 | ||||
| -rw-r--r-- | lisp/emacs-lisp/lucid.el | 67 |
2 files changed, 30 insertions, 49 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 455b94430fc..83df703356b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,10 +1,18 @@ | |||
| 1 | 2000-07-05 Stefan Monnier <monnier@cs.yale.edu> | ||
| 2 | |||
| 3 | * emacs-lisp/lucid.el: Require CL. | ||
| 4 | (copy-tree, remprop): Remove, it's provided by CL. | ||
| 5 | (map-keymap): Define in terms of cl-map-keymap. | ||
| 6 | (extent-property, set-extent-end-glyph): New functions. | ||
| 7 | |||
| 8 | * emacs-lisp/cl-extra.el (cl-map-keymap): Handle char-tables. | ||
| 9 | |||
| 1 | 2000-07-05 Gerd Moellmann <gerd@gnu.org> | 10 | 2000-07-05 Gerd Moellmann <gerd@gnu.org> |
| 2 | 11 | ||
| 3 | * Makefile.in (DONTCOMPILE): Add comment that the name may | 12 | * Makefile.in (DONTCOMPILE): Add comment that the name may |
| 4 | not be changed without changing the make-dist script. | 13 | not be changed without changing the make-dist script. |
| 5 | 14 | ||
| 6 | * emacs-lisp/cl-extra.el (cl-old-mapc): Removed; don't defalias | 15 | * emacs-lisp/cl-extra.el (cl-old-mapc): Removed; don't defalias mapc. |
| 7 | mapc. | ||
| 8 | (cl-mapc): Use mapc instead of cl-old-mapc. | 16 | (cl-mapc): Use mapc instead of cl-old-mapc. |
| 9 | 17 | ||
| 10 | 2000-07-05 Andrew Innes <andrewi@gnu.org> | 18 | 2000-07-05 Andrew Innes <andrewi@gnu.org> |
diff --git a/lisp/emacs-lisp/lucid.el b/lisp/emacs-lisp/lucid.el index 80c5973046c..11a246b0ea4 100644 --- a/lisp/emacs-lisp/lucid.el +++ b/lisp/emacs-lisp/lucid.el | |||
| @@ -21,33 +21,14 @@ | |||
| 21 | 21 | ||
| 22 | ;;; Code: | 22 | ;;; Code: |
| 23 | 23 | ||
| 24 | (defun copy-tree (tree) | 24 | ;; XEmacs autoloads CL so we might as well make use of it. |
| 25 | (if (consp tree) | 25 | (require 'cl) |
| 26 | (cons (copy-tree (car tree)) | ||
| 27 | (copy-tree (cdr tree))) | ||
| 28 | (if (vectorp tree) | ||
| 29 | (let* ((new (copy-sequence tree)) | ||
| 30 | (i (1- (length new)))) | ||
| 31 | (while (>= i 0) | ||
| 32 | (aset new i (copy-tree (aref new i))) | ||
| 33 | (setq i (1- i))) | ||
| 34 | new) | ||
| 35 | tree))) | ||
| 36 | 26 | ||
| 37 | (defalias 'current-time-seconds 'current-time) | 27 | (defalias 'current-time-seconds 'current-time) |
| 38 | 28 | ||
| 39 | (defun remprop (symbol prop) | ||
| 40 | (let ((plist (symbol-plist symbol))) | ||
| 41 | (while (eq (car plist) prop) | ||
| 42 | (setplist symbol (setq plist (cdr (cdr plist))))) | ||
| 43 | (while plist | ||
| 44 | (if (eq (nth 2 plist) prop) | ||
| 45 | (setcdr (cdr plist) (nthcdr 4 plist))) | ||
| 46 | (setq plist (cdr (cdr plist)))))) | ||
| 47 | |||
| 48 | (defun map-keymap (function keymap &optional sort-first) | 29 | (defun map-keymap (function keymap &optional sort-first) |
| 49 | "Call FUNCTION for every binding in KEYMAP. | 30 | "Call FUNCTION for every binding in KEYMAP. |
| 50 | This includes bindings inherited from a parent keymap. | 31 | This does not include bindings inherited from a parent keymap. |
| 51 | FUNCTION receives two arguments each time it is called: | 32 | FUNCTION receives two arguments each time it is called: |
| 52 | the character (more generally, the event type) that is bound, | 33 | the character (more generally, the event type) that is bound, |
| 53 | and the binding it has. | 34 | and the binding it has. |
| @@ -58,30 +39,19 @@ If your code does that, modify it to make a vector containing the event | |||
| 58 | type that you get. That will work in both versions of Emacs." | 39 | type that you get. That will work in both versions of Emacs." |
| 59 | (if sort-first | 40 | (if sort-first |
| 60 | (let (list) | 41 | (let (list) |
| 61 | (map-keymap (function (lambda (a b) | 42 | (cl-map-keymap (lambda (a b) (push (cons a b) list)) |
| 62 | (setq list (cons (cons a b) list)))) | 43 | keymap) |
| 63 | keymap) | ||
| 64 | (setq list (sort list | 44 | (setq list (sort list |
| 65 | (function (lambda (a b) | 45 | (lambda (a b) |
| 66 | (setq a (car a) b (car b)) | 46 | (setq a (car a) b (car b)) |
| 67 | (if (integerp a) | 47 | (if (integerp a) |
| 68 | (if (integerp b) (< a b) | 48 | (if (integerp b) (< a b) |
| 69 | t) | 49 | t) |
| 70 | (if (integerp b) t | 50 | (if (integerp b) t |
| 71 | (string< a b))))))) | 51 | (string< a b)))))) |
| 72 | (while list | 52 | (dolist (p list) |
| 73 | (funcall function (car (car list)) (cdr (car list))) | 53 | (funcall function (car p) (cdr p)))) |
| 74 | (setq list (cdr list)))) | 54 | (cl-map-keymap function keymap))) |
| 75 | (while (consp keymap) | ||
| 76 | (if (consp (car keymap)) | ||
| 77 | (funcall function (car (car keymap)) (cdr (car keymap))) | ||
| 78 | (if (vectorp (car keymap)) | ||
| 79 | (let ((i (1- (length (car keymap)))) | ||
| 80 | (vector (car keymap))) | ||
| 81 | (while (>= i 0) | ||
| 82 | (funcall function i (aref vector i)) | ||
| 83 | (setq i (1- i)))))) | ||
| 84 | (setq keymap (cdr keymap))))) | ||
| 85 | 55 | ||
| 86 | (defun read-number (prompt &optional integers-only) | 56 | (defun read-number (prompt &optional integers-only) |
| 87 | "Read a number from the minibuffer. | 57 | "Read a number from the minibuffer. |
| @@ -141,8 +111,8 @@ bottom of the buffer stack." | |||
| 141 | (defun make-extent (beg end &optional buffer) | 111 | (defun make-extent (beg end &optional buffer) |
| 142 | (make-overlay beg end buffer)) | 112 | (make-overlay beg end buffer)) |
| 143 | 113 | ||
| 144 | (defun extent-properties (extent) | 114 | (defun extent-properties (extent) (overlay-properties extent)) |
| 145 | (overlay-properties extent)) | 115 | (unless (fboundp 'extent-property) (defalias 'extent-property 'overlay-get)) |
| 146 | 116 | ||
| 147 | (defun extent-at (pos &optional object property before) | 117 | (defun extent-at (pos &optional object property before) |
| 148 | (with-current-buffer (or object (current-buffer)) | 118 | (with-current-buffer (or object (current-buffer)) |
| @@ -197,6 +167,9 @@ bottom of the buffer stack." | |||
| 197 | (defun set-extent-face (extent face) | 167 | (defun set-extent-face (extent face) |
| 198 | (set-extent-property extent 'face face)) | 168 | (set-extent-property extent 'face face)) |
| 199 | 169 | ||
| 170 | (defun set-extent-end-glyph (extent glyph) | ||
| 171 | (set-extent-property extent 'after-string glyph)) | ||
| 172 | |||
| 200 | (defun delete-extent (extent) | 173 | (defun delete-extent (extent) |
| 201 | (set-extent-property extent 'duplicable nil) | 174 | (set-extent-property extent 'duplicable nil) |
| 202 | (delete-overlay extent)) | 175 | (delete-overlay extent)) |