annotate lisp/emacs-lisp/lucid.el @ 24649:ce2b5ccac297

(which-func-mode-global): Doc fix.
author Dave Love <fx@gnu.org>
date Tue, 27 Apr 1999 19:02:58 +0000
parents ce11e3471a36
children 1b5db0f1b8b7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2484
6ddf357bd36c Add copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 2388
diff changeset
1 ;;; lucid.el --- Emulate some Lucid Emacs functions.
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 11235
diff changeset
2
11235
e6bdaaa6ce1b Update copyright.
Karl Heuer <kwzh@gnu.org>
parents: 10596
diff changeset
3 ;; Copyright (C) 1993, 1995 Free Software Foundation, Inc.
2484
6ddf357bd36c Add copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 2388
diff changeset
4
6ddf357bd36c Add copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 2388
diff changeset
5 ;; This file is part of GNU Emacs.
6ddf357bd36c Add copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 2388
diff changeset
6
6ddf357bd36c Add copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 2388
diff changeset
7 ;; GNU Emacs is free software; you can redistribute it and/or modify
6ddf357bd36c Add copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 2388
diff changeset
8 ;; it under the terms of the GNU General Public License as published by
6ddf357bd36c Add copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 2388
diff changeset
9 ;; the Free Software Foundation; either version 2, or (at your option)
6ddf357bd36c Add copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 2388
diff changeset
10 ;; any later version.
6ddf357bd36c Add copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 2388
diff changeset
11
6ddf357bd36c Add copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 2388
diff changeset
12 ;; GNU Emacs is distributed in the hope that it will be useful,
6ddf357bd36c Add copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 2388
diff changeset
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
6ddf357bd36c Add copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 2388
diff changeset
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6ddf357bd36c Add copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 2388
diff changeset
15 ;; GNU General Public License for more details.
6ddf357bd36c Add copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 2388
diff changeset
16
6ddf357bd36c Add copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 2388
diff changeset
17 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 11235
diff changeset
18 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 11235
diff changeset
19 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 11235
diff changeset
20 ;; Boston, MA 02111-1307, USA.
2484
6ddf357bd36c Add copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 2388
diff changeset
21
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 11235
diff changeset
22 ;;; Code:
2484
6ddf357bd36c Add copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 2388
diff changeset
23
2089
cc2e35185964 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2088
diff changeset
24 (defun copy-tree (tree)
cc2e35185964 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2088
diff changeset
25 (if (consp tree)
cc2e35185964 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2088
diff changeset
26 (cons (copy-tree (car tree))
cc2e35185964 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2088
diff changeset
27 (copy-tree (cdr tree)))
cc2e35185964 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2088
diff changeset
28 (if (vectorp tree)
3389
91f64e9078e9 (copy-tree): Use let* to bind new before i.
Richard M. Stallman <rms@gnu.org>
parents: 3002
diff changeset
29 (let* ((new (copy-sequence tree))
91f64e9078e9 (copy-tree): Use let* to bind new before i.
Richard M. Stallman <rms@gnu.org>
parents: 3002
diff changeset
30 (i (1- (length new))))
2089
cc2e35185964 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2088
diff changeset
31 (while (>= i 0)
cc2e35185964 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2088
diff changeset
32 (aset new i (copy-tree (aref new i)))
cc2e35185964 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2088
diff changeset
33 (setq i (1- i)))
cc2e35185964 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2088
diff changeset
34 new)
cc2e35185964 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2088
diff changeset
35 tree)))
cc2e35185964 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2088
diff changeset
36
2571
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
37 (defalias 'current-time-seconds 'current-time)
2089
cc2e35185964 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2088
diff changeset
38
cc2e35185964 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2088
diff changeset
39 (defun remprop (symbol prop)
cc2e35185964 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2088
diff changeset
40 (let ((plist (symbol-plist symbol)))
cc2e35185964 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2088
diff changeset
41 (while (eq (car plist) prop)
cc2e35185964 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2088
diff changeset
42 (setplist symbol (setq plist (cdr (cdr plist)))))
cc2e35185964 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2088
diff changeset
43 (while plist
cc2e35185964 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2088
diff changeset
44 (if (eq (nth 2 plist) prop)
cc2e35185964 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2088
diff changeset
45 (setcdr (cdr plist) (nthcdr 4 plist)))
cc2e35185964 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2088
diff changeset
46 (setq plist (cdr (cdr plist))))))
2168
af8f27940f79 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2089
diff changeset
47
2206
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
48 (defun map-keymap (function keymap &optional sort-first)
2168
af8f27940f79 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2089
diff changeset
49 "Call FUNCTION for every binding in KEYMAP.
af8f27940f79 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2089
diff changeset
50 This includes bindings inherited from a parent keymap.
af8f27940f79 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2089
diff changeset
51 FUNCTION receives two arguments each time it is called:
af8f27940f79 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2089
diff changeset
52 the character (more generally, the event type) that is bound,
3399
c910eb73b259 (map-keymap): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 3389
diff changeset
53 and the binding it has.
c910eb73b259 (map-keymap): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 3389
diff changeset
54
c910eb73b259 (map-keymap): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 3389
diff changeset
55 Note that passing the event type directly to `define-key' does not work
c910eb73b259 (map-keymap): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 3389
diff changeset
56 in Emacs 19. We do not emulate that particular feature of Lucid Emacs.
c910eb73b259 (map-keymap): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 3389
diff changeset
57 If your code does that, modify it to make a vector containing the event
c910eb73b259 (map-keymap): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 3389
diff changeset
58 type that you get. That will work in both versions of Emacs."
2206
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
59 (if sort-first
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
60 (let (list)
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
61 (map-keymap (function (lambda (a b)
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
62 (setq list (cons (cons a b) list))))
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
63 keymap)
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
64 (setq list (sort list
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
65 (function (lambda (a b)
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
66 (setq a (car a) b (car b))
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
67 (if (integerp a)
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
68 (if (integerp b) (< a b)
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
69 t)
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
70 (if (integerp b) t
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
71 (string< a b)))))))
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
72 (while list
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
73 (funcall function (car (car list)) (cdr (car list)))
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
74 (setq list (cdr list))))
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
75 (while (consp keymap)
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
76 (if (consp (car keymap))
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
77 (funcall function (car (car keymap)) (cdr (car keymap)))
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
78 (if (vectorp (car keymap))
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
79 (let ((i (1- (length (car keymap))))
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
80 (vector (car keymap)))
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
81 (while (>= i 0)
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
82 (funcall function i (aref vector i))
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
83 (setq i (1- i))))))
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
84 (setq keymap (cdr keymap)))))
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
85
10589
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
86 (defun read-number (prompt &optional integers-only)
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
87 "Read a number from the minibuffer.
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
88 Keep reentering the minibuffer until we get suitable input.
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
89 If optional argument INTEGERS-ONLY is non-nil, insist on an integer."
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
90 (interactive)
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
91 (let (success
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
92 (number nil)
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
93 (predicate (if integers-only 'integerp 'numberp)))
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
94 (while (not success)
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
95 (let ((input-string (read-string prompt)))
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
96 (condition-case ()
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
97 (setq number (read input-string))
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
98 (error))
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
99 (if (funcall predicate number)
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
100 (setq success t)
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
101 (let ((cursor-in-echo-area t))
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
102 (message "Please type %s"
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
103 (if integers-only "an integer" "a number"))
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
104 (sit-for 1)))))
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
105 number))
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
106
2206
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
107 (defun real-path-name (name &optional default)
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
108 (file-truename (expand-file-name name default)))
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
109
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
110 ;; It's not clear what to return if the mouse is not in FRAME.
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
111 (defun read-mouse-position (frame)
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
112 (let ((pos (mouse-position)))
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
113 (if (eq (car pos) frame)
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
114 (cdr pos))))
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
115
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
116 (defun switch-to-other-buffer (arg)
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
117 "Switch to the previous buffer.
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
118 With a numeric arg N, switch to the Nth most recent buffer.
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
119 With an arg of 0, buries the current buffer at the
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
120 bottom of the buffer stack."
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
121 (interactive "p")
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
122 (if (eq arg 0)
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
123 (bury-buffer (current-buffer)))
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
124 (switch-to-buffer
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
125 (if (<= arg 1) (other-buffer (current-buffer))
9991
8deb32278622 (set-keymap-parent): Fix bug in case of empty keymap.
Richard M. Stallman <rms@gnu.org>
parents: 7365
diff changeset
126 (nth arg
2631
1e3d854828fc * lucid.el: Comment out fset of set-screen-width properly.
Jim Blandy <jimb@redhat.com>
parents: 2571
diff changeset
127 (apply 'nconc
1e3d854828fc * lucid.el: Comment out fset of set-screen-width properly.
Jim Blandy <jimb@redhat.com>
parents: 2571
diff changeset
128 (mapcar
1e3d854828fc * lucid.el: Comment out fset of set-screen-width properly.
Jim Blandy <jimb@redhat.com>
parents: 2571
diff changeset
129 (lambda (buf)
3002
7274509e47a3 * lucid.el (switch-to-other-buffer): Build the list of acceptable
Jim Blandy <jimb@redhat.com>
parents: 2631
diff changeset
130 (if (= ?\ (string-to-char (buffer-name buf)))
2631
1e3d854828fc * lucid.el: Comment out fset of set-screen-width properly.
Jim Blandy <jimb@redhat.com>
parents: 2571
diff changeset
131 nil
3002
7274509e47a3 * lucid.el (switch-to-other-buffer): Build the list of acceptable
Jim Blandy <jimb@redhat.com>
parents: 2631
diff changeset
132 (list buf)))
7274509e47a3 * lucid.el (switch-to-other-buffer): Build the list of acceptable
Jim Blandy <jimb@redhat.com>
parents: 2631
diff changeset
133 (buffer-list)))))))
2388
3f27c886f375 (try-face-font, find-face, get-face): New aliases.
Richard M. Stallman <rms@gnu.org>
parents: 2281
diff changeset
134
2571
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
135 (defalias 'find-face 'internal-find-face)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
136 (defalias 'get-face 'internal-get-face)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
137 (defalias 'try-face-font 'internal-try-face-font)
16340
14b661a07c1f (exec-to-string): New alias.
Richard M. Stallman <rms@gnu.org>
parents: 16293
diff changeset
138
14b661a07c1f (exec-to-string): New alias.
Richard M. Stallman <rms@gnu.org>
parents: 16293
diff changeset
139 (defalias 'exec-to-string 'shell-command-to-string)
2206
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
140
10596
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
141 (defun make-extent (beg end &optional buffer)
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
142 (make-overlay beg end buffer))
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
143
19340
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
144 (defun extent-properties (extent)
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
145 (overlay-properties extent))
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
146
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
147 (defun extent-at (pos &optional object property before)
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
148 (with-current-buffer (or object (current-buffer))
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
149 (let ((overlays (overlays-at pos)))
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
150 (when property
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
151 (let (filtered)
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
152 (while overlays
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
153 (if (overlay-get (car overlays) property)
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
154 (setq filtered (cons (car overlays) filtered)))
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
155 (setq overlays (cdr overlays)))
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
156 (setq overlays filtered)))
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
157 (setq overlays
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
158 (sort overlays
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
159 (function (lambda (o1 o2)
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
160 (let ((p1 (or (overlay-get o1 'priority) 0))
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
161 (p2 (or (overlay-get o2 'priority) 0)))
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
162 (or (> p1 p2)
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
163 (and (= p1 p2)
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
164 (> (overlay-start o1) (overlay-start o2)))))))))
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
165 (if before
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
166 (nth 1 (memq before overlays))
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
167 (car overlays)))))
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
168
10596
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
169 (defun set-extent-property (extent prop value)
19321
995bfd9752d5 (set-extent-property): Don't allow
Richard M. Stallman <rms@gnu.org>
parents: 16340
diff changeset
170 ;; Make sure that separate adjacent extents
995bfd9752d5 (set-extent-property): Don't allow
Richard M. Stallman <rms@gnu.org>
parents: 16340
diff changeset
171 ;; with the same mouse-face value
995bfd9752d5 (set-extent-property): Don't allow
Richard M. Stallman <rms@gnu.org>
parents: 16340
diff changeset
172 ;; do not run together as one extent.
995bfd9752d5 (set-extent-property): Don't allow
Richard M. Stallman <rms@gnu.org>
parents: 16340
diff changeset
173 (and (eq prop 'mouse-face)
995bfd9752d5 (set-extent-property): Don't allow
Richard M. Stallman <rms@gnu.org>
parents: 16340
diff changeset
174 (symbolp value)
995bfd9752d5 (set-extent-property): Don't allow
Richard M. Stallman <rms@gnu.org>
parents: 16340
diff changeset
175 (setq value (list value)))
10596
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
176 (if (eq prop 'duplicable)
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
177 (cond ((and value (not (overlay-get extent prop)))
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
178 ;; If becoming duplicable, copy all overlayprops to text props.
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
179 (add-text-properties (overlay-start extent)
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
180 (overlay-end extent)
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
181 (overlay-properties extent)
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
182 (overlay-buffer extent)))
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
183 ;; If becoming no longer duplicable, remove these text props.
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
184 ((and (not value) (overlay-get extent prop))
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
185 (remove-text-properties (overlay-start extent)
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
186 (overlay-end extent)
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
187 (overlay-properties extent)
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
188 (overlay-buffer extent))))
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
189 ;; If extent is already duplicable, put this property
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
190 ;; on the text as well as on the overlay.
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
191 (if (overlay-get extent 'duplicable)
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
192 (put-text-property (overlay-start extent)
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
193 (overlay-end extent)
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
194 prop value (overlay-buffer extent))))
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
195 (overlay-put extent prop value))
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
196
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
197 (defun set-extent-face (extent face)
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
198 (set-extent-property extent 'face face))
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
199
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
200 (defun delete-extent (extent)
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
201 (set-extent-property extent 'duplicable nil)
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
202 (delete-overlay extent))
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
203
2206
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
204 ;; Support the Lucid names with `screen' instead of `frame'.
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
205
2571
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
206 (defalias 'current-screen-configuration 'current-frame-configuration)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
207 (defalias 'delete-screen 'delete-frame)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
208 (defalias 'find-file-new-screen 'find-file-other-frame)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
209 (defalias 'find-file-read-only-new-screen 'find-file-read-only-other-frame)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
210 (defalias 'find-tag-new-screen 'find-tag-other-frame)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
211 ;;(defalias 'focus-screen 'focus-frame)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
212 (defalias 'iconify-screen 'iconify-frame)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
213 (defalias 'mail-new-screen 'mail-other-frame)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
214 (defalias 'make-screen-invisible 'make-frame-invisible)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
215 (defalias 'make-screen-visible 'make-frame-visible)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
216 ;; (defalias 'minibuffer-screen-list 'minibuffer-frame-list)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
217 (defalias 'modify-screen-parameters 'modify-frame-parameters)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
218 (defalias 'next-screen 'next-frame)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
219 ;; (defalias 'next-multiscreen-window 'next-multiframe-window)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
220 ;; (defalias 'previous-multiscreen-window 'previous-multiframe-window)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
221 ;; (defalias 'redirect-screen-focus 'redirect-frame-focus)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
222 (defalias 'redraw-screen 'redraw-frame)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
223 ;; (defalias 'screen-char-height 'frame-char-height)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
224 ;; (defalias 'screen-char-width 'frame-char-width)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
225 ;; (defalias 'screen-configuration-to-register 'frame-configuration-to-register)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
226 ;; (defalias 'screen-focus 'frame-focus)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
227 (defalias 'screen-list 'frame-list)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
228 ;; (defalias 'screen-live-p 'frame-live-p)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
229 (defalias 'screen-parameters 'frame-parameters)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
230 (defalias 'screen-pixel-height 'frame-pixel-height)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
231 (defalias 'screen-pixel-width 'frame-pixel-width)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
232 (defalias 'screen-root-window 'frame-root-window)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
233 (defalias 'screen-selected-window 'frame-selected-window)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
234 (defalias 'lower-screen 'lower-frame)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
235 (defalias 'raise-screen 'raise-frame)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
236 (defalias 'screen-visible-p 'frame-visible-p)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
237 (defalias 'screenp 'framep)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
238 (defalias 'select-screen 'select-frame)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
239 (defalias 'selected-screen 'selected-frame)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
240 ;; (defalias 'set-screen-configuration 'set-frame-configuration)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
241 ;; (defalias 'set-screen-height 'set-frame-height)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
242 (defalias 'set-screen-position 'set-frame-position)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
243 (defalias 'set-screen-size 'set-frame-size)
2631
1e3d854828fc * lucid.el: Comment out fset of set-screen-width properly.
Jim Blandy <jimb@redhat.com>
parents: 2571
diff changeset
244 ;; (defalias 'set-screen-width 'set-frame-width)
2571
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
245 (defalias 'switch-to-buffer-new-screen 'switch-to-buffer-other-frame)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
246 ;; (defalias 'unfocus-screen 'unfocus-frame)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
247 (defalias 'visible-screen-list 'visible-frame-list)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
248 (defalias 'window-screen 'window-frame)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
249 (defalias 'x-create-screen 'x-create-frame)
7365
8c2f150f2880 Change new-frame to make-frame.
Karl Heuer <kwzh@gnu.org>
parents: 4997
diff changeset
250 (defalias 'x-new-screen 'make-frame)
2484
6ddf357bd36c Add copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 2388
diff changeset
251
2631
1e3d854828fc * lucid.el: Comment out fset of set-screen-width properly.
Jim Blandy <jimb@redhat.com>
parents: 2571
diff changeset
252 (provide 'lucid)
1e3d854828fc * lucid.el: Comment out fset of set-screen-width properly.
Jim Blandy <jimb@redhat.com>
parents: 2571
diff changeset
253
2484
6ddf357bd36c Add copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 2388
diff changeset
254 ;;; end of lucid.el