Mercurial > emacs
annotate lisp/emacs-lisp/lucid.el @ 51489:e22eeda25827
Not committed to branch, sorry.
author | Dave Love <fx@gnu.org> |
---|---|
date | Thu, 05 Jun 2003 18:00:24 +0000 |
parents | c8ca209edecc |
children | 695cf19ef79e |
rev | line source |
---|---|
38414
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
30087
diff
changeset
|
1 ;;; lucid.el --- emulate some Lucid Emacs functions |
14169 | 2 |
39117 | 3 ;; Copyright (C) 1993, 1995, 2001 Free Software Foundation, Inc. |
2484 | 4 |
38695 | 5 ;; Maintainer: FSF |
39117 | 6 ;; Keywords: emulations |
38695 | 7 |
2484 | 8 ;; This file is part of GNU Emacs. |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
12 ;; the Free Software Foundation; either version 2, or (at your option) | |
13 ;; any later version. | |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
14169 | 21 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
23 ;; Boston, MA 02111-1307, USA. | |
2484 | 24 |
38414
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
30087
diff
changeset
|
25 ;;; Commentary: |
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
30087
diff
changeset
|
26 |
14169 | 27 ;;; Code: |
2484 | 28 |
30087 | 29 ;; XEmacs autoloads CL so we might as well make use of it. |
30 (require 'cl) | |
2089 | 31 |
2571
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
32 (defalias 'current-time-seconds 'current-time) |
2089 | 33 |
50801
9c84256c5456
(cl-map-keymap): Be careful with aliases.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44519
diff
changeset
|
34 ;; In case cl-map-keymap is an alias for map-keymap, avoid circular calls. |
9c84256c5456
(cl-map-keymap): Be careful with aliases.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44519
diff
changeset
|
35 (fset 'cl-map-keymap (indirect-function 'cl-map-keymap)) |
9c84256c5456
(cl-map-keymap): Be careful with aliases.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44519
diff
changeset
|
36 |
2206 | 37 (defun map-keymap (function keymap &optional sort-first) |
2168 | 38 "Call FUNCTION for every binding in KEYMAP. |
30087 | 39 This does not include bindings inherited from a parent keymap. |
2168 | 40 FUNCTION receives two arguments each time it is called: |
41 the character (more generally, the event type) that is bound, | |
3399 | 42 and the binding it has. |
43 | |
44 Note that passing the event type directly to `define-key' does not work | |
45 in Emacs 19. We do not emulate that particular feature of Lucid Emacs. | |
46 If your code does that, modify it to make a vector containing the event | |
47 type that you get. That will work in both versions of Emacs." | |
2206 | 48 (if sort-first |
49 (let (list) | |
30087 | 50 (cl-map-keymap (lambda (a b) (push (cons a b) list)) |
51 keymap) | |
2206 | 52 (setq list (sort list |
30087 | 53 (lambda (a b) |
54 (setq a (car a) b (car b)) | |
55 (if (integerp a) | |
56 (if (integerp b) (< a b) | |
57 t) | |
58 (if (integerp b) t | |
59 (string< a b)))))) | |
60 (dolist (p list) | |
61 (funcall function (car p) (cdr p)))) | |
62 (cl-map-keymap function keymap))) | |
2206 | 63 |
10589
4d7bc901319a
(read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9991
diff
changeset
|
64 (defun read-number (prompt &optional integers-only) |
4d7bc901319a
(read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9991
diff
changeset
|
65 "Read a number from the minibuffer. |
4d7bc901319a
(read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9991
diff
changeset
|
66 Keep reentering the minibuffer until we get suitable input. |
4d7bc901319a
(read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9991
diff
changeset
|
67 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
|
68 (interactive) |
4d7bc901319a
(read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9991
diff
changeset
|
69 (let (success |
4d7bc901319a
(read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9991
diff
changeset
|
70 (number nil) |
4d7bc901319a
(read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9991
diff
changeset
|
71 (predicate (if integers-only 'integerp 'numberp))) |
4d7bc901319a
(read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9991
diff
changeset
|
72 (while (not success) |
4d7bc901319a
(read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9991
diff
changeset
|
73 (let ((input-string (read-string prompt))) |
4d7bc901319a
(read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9991
diff
changeset
|
74 (condition-case () |
4d7bc901319a
(read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9991
diff
changeset
|
75 (setq number (read input-string)) |
4d7bc901319a
(read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9991
diff
changeset
|
76 (error)) |
4d7bc901319a
(read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9991
diff
changeset
|
77 (if (funcall predicate number) |
4d7bc901319a
(read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9991
diff
changeset
|
78 (setq success t) |
4d7bc901319a
(read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9991
diff
changeset
|
79 (let ((cursor-in-echo-area t)) |
4d7bc901319a
(read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9991
diff
changeset
|
80 (message "Please type %s" |
4d7bc901319a
(read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9991
diff
changeset
|
81 (if integers-only "an integer" "a number")) |
4d7bc901319a
(read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9991
diff
changeset
|
82 (sit-for 1))))) |
4d7bc901319a
(read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9991
diff
changeset
|
83 number)) |
4d7bc901319a
(read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9991
diff
changeset
|
84 |
2206 | 85 (defun real-path-name (name &optional default) |
86 (file-truename (expand-file-name name default))) | |
87 | |
88 ;; It's not clear what to return if the mouse is not in FRAME. | |
89 (defun read-mouse-position (frame) | |
90 (let ((pos (mouse-position))) | |
91 (if (eq (car pos) frame) | |
92 (cdr pos)))) | |
93 | |
94 (defun switch-to-other-buffer (arg) | |
95 "Switch to the previous buffer. | |
96 With a numeric arg N, switch to the Nth most recent buffer. | |
97 With an arg of 0, buries the current buffer at the | |
98 bottom of the buffer stack." | |
99 (interactive "p") | |
100 (if (eq arg 0) | |
101 (bury-buffer (current-buffer))) | |
102 (switch-to-buffer | |
103 (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
|
104 (nth arg |
2631
1e3d854828fc
* lucid.el: Comment out fset of set-screen-width properly.
Jim Blandy <jimb@redhat.com>
parents:
2571
diff
changeset
|
105 (apply 'nconc |
1e3d854828fc
* lucid.el: Comment out fset of set-screen-width properly.
Jim Blandy <jimb@redhat.com>
parents:
2571
diff
changeset
|
106 (mapcar |
1e3d854828fc
* lucid.el: Comment out fset of set-screen-width properly.
Jim Blandy <jimb@redhat.com>
parents:
2571
diff
changeset
|
107 (lambda (buf) |
3002
7274509e47a3
* lucid.el (switch-to-other-buffer): Build the list of acceptable
Jim Blandy <jimb@redhat.com>
parents:
2631
diff
changeset
|
108 (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
|
109 nil |
3002
7274509e47a3
* lucid.el (switch-to-other-buffer): Build the list of acceptable
Jim Blandy <jimb@redhat.com>
parents:
2631
diff
changeset
|
110 (list buf))) |
7274509e47a3
* lucid.el (switch-to-other-buffer): Build the list of acceptable
Jim Blandy <jimb@redhat.com>
parents:
2631
diff
changeset
|
111 (buffer-list))))))) |
2388
3f27c886f375
(try-face-font, find-face, get-face): New aliases.
Richard M. Stallman <rms@gnu.org>
parents:
2281
diff
changeset
|
112 |
44519
4925eba04c46
(device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39117
diff
changeset
|
113 (defun device-class (&optional device) |
4925eba04c46
(device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39117
diff
changeset
|
114 "Return the class (color behavior) of DEVICE. |
4925eba04c46
(device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39117
diff
changeset
|
115 This will be one of 'color, 'grayscale, or 'mono. |
4925eba04c46
(device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39117
diff
changeset
|
116 This function exists for compatibility with XEmacs." |
4925eba04c46
(device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39117
diff
changeset
|
117 (cond |
4925eba04c46
(device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39117
diff
changeset
|
118 ((display-color-p device) 'color) |
4925eba04c46
(device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39117
diff
changeset
|
119 ((display-grayscale-p device) 'grayscale) |
4925eba04c46
(device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39117
diff
changeset
|
120 (t 'mono))) |
4925eba04c46
(device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39117
diff
changeset
|
121 |
2571
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
122 (defalias 'find-face 'internal-find-face) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
123 (defalias 'get-face 'internal-get-face) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
124 (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
|
125 |
14b661a07c1f
(exec-to-string): New alias.
Richard M. Stallman <rms@gnu.org>
parents:
16293
diff
changeset
|
126 (defalias 'exec-to-string 'shell-command-to-string) |
2206 | 127 |
44519
4925eba04c46
(device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39117
diff
changeset
|
128 |
4925eba04c46
(device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39117
diff
changeset
|
129 ;; Buffer context |
4925eba04c46
(device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39117
diff
changeset
|
130 |
4925eba04c46
(device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39117
diff
changeset
|
131 (defun buffer-syntactic-context (&optional buffer) |
4925eba04c46
(device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39117
diff
changeset
|
132 "Syntactic context at point in BUFFER. |
50866
c8ca209edecc
(buffer-syntactic-context): Don't quote nil and t in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
50801
diff
changeset
|
133 Either of `string', `comment' or nil. |
44519
4925eba04c46
(device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39117
diff
changeset
|
134 This is an XEmacs compatibility function." |
4925eba04c46
(device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39117
diff
changeset
|
135 (with-current-buffer (or buffer (current-buffer)) |
4925eba04c46
(device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39117
diff
changeset
|
136 (let ((state (syntax-ppss (point)))) |
4925eba04c46
(device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39117
diff
changeset
|
137 (cond |
4925eba04c46
(device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39117
diff
changeset
|
138 ((nth 3 state) 'string) |
4925eba04c46
(device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39117
diff
changeset
|
139 ((nth 4 state) 'comment))))) |
4925eba04c46
(device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39117
diff
changeset
|
140 |
4925eba04c46
(device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39117
diff
changeset
|
141 |
4925eba04c46
(device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39117
diff
changeset
|
142 (defun buffer-syntactic-context-depth (&optional buffer) |
4925eba04c46
(device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39117
diff
changeset
|
143 "Syntactic parenthesis depth at point in BUFFER. |
4925eba04c46
(device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39117
diff
changeset
|
144 This is an XEmacs compatibility function." |
4925eba04c46
(device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39117
diff
changeset
|
145 (with-current-buffer (or buffer (current-buffer)) |
4925eba04c46
(device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39117
diff
changeset
|
146 (nth 0 (syntax-ppss (point))))) |
4925eba04c46
(device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39117
diff
changeset
|
147 |
4925eba04c46
(device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39117
diff
changeset
|
148 |
4925eba04c46
(device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39117
diff
changeset
|
149 ;; Extents |
10596
3cda29fdf5f6
(make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents:
10589
diff
changeset
|
150 (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
|
151 (make-overlay beg end buffer)) |
3cda29fdf5f6
(make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents:
10589
diff
changeset
|
152 |
30087 | 153 (defun extent-properties (extent) (overlay-properties extent)) |
154 (unless (fboundp 'extent-property) (defalias 'extent-property 'overlay-get)) | |
19340
ce11e3471a36
(extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
19321
diff
changeset
|
155 |
ce11e3471a36
(extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
19321
diff
changeset
|
156 (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
|
157 (with-current-buffer (or object (current-buffer)) |
ce11e3471a36
(extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
19321
diff
changeset
|
158 (let ((overlays (overlays-at pos))) |
ce11e3471a36
(extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
19321
diff
changeset
|
159 (when property |
ce11e3471a36
(extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
19321
diff
changeset
|
160 (let (filtered) |
ce11e3471a36
(extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
19321
diff
changeset
|
161 (while overlays |
ce11e3471a36
(extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
19321
diff
changeset
|
162 (if (overlay-get (car overlays) property) |
ce11e3471a36
(extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
19321
diff
changeset
|
163 (setq filtered (cons (car overlays) filtered))) |
ce11e3471a36
(extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
19321
diff
changeset
|
164 (setq overlays (cdr overlays))) |
ce11e3471a36
(extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
19321
diff
changeset
|
165 (setq overlays filtered))) |
ce11e3471a36
(extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
19321
diff
changeset
|
166 (setq overlays |
ce11e3471a36
(extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
19321
diff
changeset
|
167 (sort overlays |
ce11e3471a36
(extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
19321
diff
changeset
|
168 (function (lambda (o1 o2) |
ce11e3471a36
(extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
19321
diff
changeset
|
169 (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
|
170 (p2 (or (overlay-get o2 'priority) 0))) |
ce11e3471a36
(extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
19321
diff
changeset
|
171 (or (> p1 p2) |
ce11e3471a36
(extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
19321
diff
changeset
|
172 (and (= p1 p2) |
ce11e3471a36
(extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
19321
diff
changeset
|
173 (> (overlay-start o1) (overlay-start o2))))))))) |
ce11e3471a36
(extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
19321
diff
changeset
|
174 (if before |
ce11e3471a36
(extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
19321
diff
changeset
|
175 (nth 1 (memq before overlays)) |
ce11e3471a36
(extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
19321
diff
changeset
|
176 (car overlays))))) |
ce11e3471a36
(extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
19321
diff
changeset
|
177 |
10596
3cda29fdf5f6
(make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents:
10589
diff
changeset
|
178 (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
|
179 ;; Make sure that separate adjacent extents |
995bfd9752d5
(set-extent-property): Don't allow
Richard M. Stallman <rms@gnu.org>
parents:
16340
diff
changeset
|
180 ;; with the same mouse-face value |
995bfd9752d5
(set-extent-property): Don't allow
Richard M. Stallman <rms@gnu.org>
parents:
16340
diff
changeset
|
181 ;; do not run together as one extent. |
995bfd9752d5
(set-extent-property): Don't allow
Richard M. Stallman <rms@gnu.org>
parents:
16340
diff
changeset
|
182 (and (eq prop 'mouse-face) |
995bfd9752d5
(set-extent-property): Don't allow
Richard M. Stallman <rms@gnu.org>
parents:
16340
diff
changeset
|
183 (symbolp value) |
995bfd9752d5
(set-extent-property): Don't allow
Richard M. Stallman <rms@gnu.org>
parents:
16340
diff
changeset
|
184 (setq value (list value))) |
10596
3cda29fdf5f6
(make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents:
10589
diff
changeset
|
185 (if (eq prop 'duplicable) |
3cda29fdf5f6
(make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents:
10589
diff
changeset
|
186 (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
|
187 ;; 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
|
188 (add-text-properties (overlay-start extent) |
3cda29fdf5f6
(make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents:
10589
diff
changeset
|
189 (overlay-end extent) |
3cda29fdf5f6
(make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents:
10589
diff
changeset
|
190 (overlay-properties extent) |
3cda29fdf5f6
(make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents:
10589
diff
changeset
|
191 (overlay-buffer extent))) |
3cda29fdf5f6
(make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents:
10589
diff
changeset
|
192 ;; 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
|
193 ((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
|
194 (remove-text-properties (overlay-start extent) |
3cda29fdf5f6
(make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents:
10589
diff
changeset
|
195 (overlay-end extent) |
3cda29fdf5f6
(make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents:
10589
diff
changeset
|
196 (overlay-properties extent) |
3cda29fdf5f6
(make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents:
10589
diff
changeset
|
197 (overlay-buffer extent)))) |
3cda29fdf5f6
(make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents:
10589
diff
changeset
|
198 ;; 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
|
199 ;; 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
|
200 (if (overlay-get extent 'duplicable) |
3cda29fdf5f6
(make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents:
10589
diff
changeset
|
201 (put-text-property (overlay-start extent) |
3cda29fdf5f6
(make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents:
10589
diff
changeset
|
202 (overlay-end extent) |
3cda29fdf5f6
(make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents:
10589
diff
changeset
|
203 prop value (overlay-buffer extent)))) |
3cda29fdf5f6
(make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents:
10589
diff
changeset
|
204 (overlay-put extent prop value)) |
3cda29fdf5f6
(make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents:
10589
diff
changeset
|
205 |
3cda29fdf5f6
(make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents:
10589
diff
changeset
|
206 (defun set-extent-face (extent face) |
3cda29fdf5f6
(make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents:
10589
diff
changeset
|
207 (set-extent-property extent 'face face)) |
3cda29fdf5f6
(make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents:
10589
diff
changeset
|
208 |
30087 | 209 (defun set-extent-end-glyph (extent glyph) |
210 (set-extent-property extent 'after-string glyph)) | |
211 | |
10596
3cda29fdf5f6
(make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents:
10589
diff
changeset
|
212 (defun delete-extent (extent) |
3cda29fdf5f6
(make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents:
10589
diff
changeset
|
213 (set-extent-property extent 'duplicable nil) |
3cda29fdf5f6
(make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents:
10589
diff
changeset
|
214 (delete-overlay extent)) |
3cda29fdf5f6
(make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents:
10589
diff
changeset
|
215 |
2206 | 216 ;; Support the Lucid names with `screen' instead of `frame'. |
217 | |
2571
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
218 (defalias 'current-screen-configuration 'current-frame-configuration) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
219 (defalias 'delete-screen 'delete-frame) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
220 (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
|
221 (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
|
222 (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
|
223 ;;(defalias 'focus-screen 'focus-frame) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
224 (defalias 'iconify-screen 'iconify-frame) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
225 (defalias 'mail-new-screen 'mail-other-frame) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
226 (defalias 'make-screen-invisible 'make-frame-invisible) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
227 (defalias 'make-screen-visible 'make-frame-visible) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
228 ;; (defalias 'minibuffer-screen-list 'minibuffer-frame-list) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
229 (defalias 'modify-screen-parameters 'modify-frame-parameters) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
230 (defalias 'next-screen 'next-frame) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
231 ;; (defalias 'next-multiscreen-window 'next-multiframe-window) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
232 ;; (defalias 'previous-multiscreen-window 'previous-multiframe-window) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
233 ;; (defalias 'redirect-screen-focus 'redirect-frame-focus) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
234 (defalias 'redraw-screen 'redraw-frame) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
235 ;; (defalias 'screen-char-height 'frame-char-height) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
236 ;; (defalias 'screen-char-width 'frame-char-width) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
237 ;; (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
|
238 ;; (defalias 'screen-focus 'frame-focus) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
239 (defalias 'screen-list 'frame-list) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
240 ;; (defalias 'screen-live-p 'frame-live-p) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
241 (defalias 'screen-parameters 'frame-parameters) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
242 (defalias 'screen-pixel-height 'frame-pixel-height) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
243 (defalias 'screen-pixel-width 'frame-pixel-width) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
244 (defalias 'screen-root-window 'frame-root-window) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
245 (defalias 'screen-selected-window 'frame-selected-window) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
246 (defalias 'lower-screen 'lower-frame) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
247 (defalias 'raise-screen 'raise-frame) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
248 (defalias 'screen-visible-p 'frame-visible-p) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
249 (defalias 'screenp 'framep) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
250 (defalias 'select-screen 'select-frame) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
251 (defalias 'selected-screen 'selected-frame) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
252 ;; (defalias 'set-screen-configuration 'set-frame-configuration) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
253 ;; (defalias 'set-screen-height 'set-frame-height) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
254 (defalias 'set-screen-position 'set-frame-position) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
255 (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
|
256 ;; (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
|
257 (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
|
258 ;; (defalias 'unfocus-screen 'unfocus-frame) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
259 (defalias 'visible-screen-list 'visible-frame-list) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
260 (defalias 'window-screen 'window-frame) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2484
diff
changeset
|
261 (defalias 'x-create-screen 'x-create-frame) |
7365 | 262 (defalias 'x-new-screen 'make-frame) |
2484 | 263 |
2631
1e3d854828fc
* lucid.el: Comment out fset of set-screen-width properly.
Jim Blandy <jimb@redhat.com>
parents:
2571
diff
changeset
|
264 (provide 'lucid) |
1e3d854828fc
* lucid.el: Comment out fset of set-screen-width properly.
Jim Blandy <jimb@redhat.com>
parents:
2571
diff
changeset
|
265 |
38414
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
30087
diff
changeset
|
266 ;;; lucid.el ends here |