annotate lisp/emacs-lisp/lucid.el @ 100079:33bcf798638a

Martin changed windows.texi.
author Chong Yidong <cyd@stupidchicken.com>
date Sun, 30 Nov 2008 22:11:56 +0000
parents 7c37f3fac92b
children a9dc0e7c3f2b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 11235
diff changeset
2
64751
5b1a238fcbb4 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64085
diff changeset
3 ;; Copyright (C) 1993, 1995, 2001, 2002, 2003, 2004,
79704
78ee6fae0e41 Add 2008 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 78217
diff changeset
4 ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
2484
6ddf357bd36c Add copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 2388
diff changeset
5
38695
01c7199c0ee7 Specify FSF as Maintainer.
Pavel Janík <Pavel@Janik.cz>
parents: 38414
diff changeset
6 ;; Maintainer: FSF
39117
abd085bfec0c Add Keywords header.
Gerd Moellmann <gerd@gnu.org>
parents: 38695
diff changeset
7 ;; Keywords: emulations
38695
01c7199c0ee7 Specify FSF as Maintainer.
Pavel Janík <Pavel@Janik.cz>
parents: 38414
diff changeset
8
2484
6ddf357bd36c Add copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 2388
diff changeset
9 ;; This file is part of GNU Emacs.
6ddf357bd36c Add copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 2388
diff changeset
10
94655
90a2847062be Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
2484
6ddf357bd36c Add copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 2388
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
94655
90a2847062be Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
13 ;; the Free Software Foundation, either version 3 of the License, or
90a2847062be Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
14 ;; (at your option) any later version.
2484
6ddf357bd36c Add copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 2388
diff changeset
15
6ddf357bd36c Add copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 2388
diff changeset
16 ;; 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
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
6ddf357bd36c Add copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 2388
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6ddf357bd36c Add copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 2388
diff changeset
19 ;; GNU General Public License for more details.
6ddf357bd36c Add copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 2388
diff changeset
20
6ddf357bd36c Add copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 2388
diff changeset
21 ;; You should have received a copy of the GNU General Public License
94655
90a2847062be Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
2484
6ddf357bd36c Add copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 2388
diff changeset
23
38414
67b464da13ec Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 30087
diff changeset
24 ;;; Commentary:
67b464da13ec Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 30087
diff changeset
25
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 11235
diff changeset
26 ;;; Code:
2484
6ddf357bd36c Add copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 2388
diff changeset
27
30087
1b5db0f1b8b7 Require CL.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 19340
diff changeset
28 ;; XEmacs autoloads CL so we might as well make use of it.
1b5db0f1b8b7 Require CL.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 19340
diff changeset
29 (require 'cl)
2089
cc2e35185964 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2088
diff changeset
30
2571
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
31 (defalias 'current-time-seconds 'current-time)
2089
cc2e35185964 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2088
diff changeset
32
10589
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
33 (defun read-number (prompt &optional integers-only)
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
34 "Read a number from the minibuffer.
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
35 Keep reentering the minibuffer until we get suitable input.
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
36 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
37 (interactive)
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
38 (let (success
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
39 (number nil)
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
40 (predicate (if integers-only 'integerp 'numberp)))
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
41 (while (not success)
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
42 (let ((input-string (read-string prompt)))
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
43 (condition-case ()
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
44 (setq number (read input-string))
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
45 (error))
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
46 (if (funcall predicate number)
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
47 (setq success t)
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
48 (let ((cursor-in-echo-area t))
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
49 (message "Please type %s"
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
50 (if integers-only "an integer" "a number"))
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
51 (sit-for 1)))))
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
52 number))
4d7bc901319a (read-number): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9991
diff changeset
53
2206
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
54 (defun real-path-name (name &optional default)
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
55 (file-truename (expand-file-name name default)))
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
56
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
57 ;; 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
58 (defun read-mouse-position (frame)
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
59 (let ((pos (mouse-position)))
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
60 (if (eq (car pos) frame)
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
61 (cdr pos))))
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
62
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
63 (defun switch-to-other-buffer (arg)
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
64 "Switch to the previous buffer.
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
65 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
66 With an arg of 0, buries the current buffer at the
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
67 bottom of the buffer stack."
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
68 (interactive "p")
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
69 (if (eq arg 0)
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
70 (bury-buffer (current-buffer)))
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
71 (switch-to-buffer
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
72 (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
73 (nth arg
2631
1e3d854828fc * lucid.el: Comment out fset of set-screen-width properly.
Jim Blandy <jimb@redhat.com>
parents: 2571
diff changeset
74 (apply 'nconc
1e3d854828fc * lucid.el: Comment out fset of set-screen-width properly.
Jim Blandy <jimb@redhat.com>
parents: 2571
diff changeset
75 (mapcar
1e3d854828fc * lucid.el: Comment out fset of set-screen-width properly.
Jim Blandy <jimb@redhat.com>
parents: 2571
diff changeset
76 (lambda (buf)
3002
7274509e47a3 * lucid.el (switch-to-other-buffer): Build the list of acceptable
Jim Blandy <jimb@redhat.com>
parents: 2631
diff changeset
77 (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
78 nil
3002
7274509e47a3 * lucid.el (switch-to-other-buffer): Build the list of acceptable
Jim Blandy <jimb@redhat.com>
parents: 2631
diff changeset
79 (list buf)))
7274509e47a3 * lucid.el (switch-to-other-buffer): Build the list of acceptable
Jim Blandy <jimb@redhat.com>
parents: 2631
diff changeset
80 (buffer-list)))))))
2388
3f27c886f375 (try-face-font, find-face, get-face): New aliases.
Richard M. Stallman <rms@gnu.org>
parents: 2281
diff changeset
81
44519
4925eba04c46 (device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39117
diff changeset
82 (defun device-class (&optional device)
4925eba04c46 (device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39117
diff changeset
83 "Return the class (color behavior) of DEVICE.
4925eba04c46 (device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39117
diff changeset
84 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
85 This function exists for compatibility with XEmacs."
4925eba04c46 (device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39117
diff changeset
86 (cond
4925eba04c46 (device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39117
diff changeset
87 ((display-color-p device) 'color)
4925eba04c46 (device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39117
diff changeset
88 ((display-grayscale-p device) 'grayscale)
4925eba04c46 (device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39117
diff changeset
89 (t 'mono)))
4925eba04c46 (device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39117
diff changeset
90
2571
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
91 (defalias 'find-face 'internal-find-face)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
92 (defalias 'get-face 'internal-get-face)
97945
7c37f3fac92b (try-face-font): Remove dead alias.
Glenn Morris <rgm@gnu.org>
parents: 94655
diff changeset
93 ;; internal-try-face-font was removed from faces.el in rev 1.139, 1999/07/21.
7c37f3fac92b (try-face-font): Remove dead alias.
Glenn Morris <rgm@gnu.org>
parents: 94655
diff changeset
94 ;;;(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
95
14b661a07c1f (exec-to-string): New alias.
Richard M. Stallman <rms@gnu.org>
parents: 16293
diff changeset
96 (defalias 'exec-to-string 'shell-command-to-string)
2206
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
97
44519
4925eba04c46 (device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39117
diff changeset
98
4925eba04c46 (device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39117
diff changeset
99 ;; Buffer context
4925eba04c46 (device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39117
diff changeset
100
4925eba04c46 (device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39117
diff changeset
101 (defun buffer-syntactic-context (&optional buffer)
4925eba04c46 (device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39117
diff changeset
102 "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
103 Either of `string', `comment' or nil.
44519
4925eba04c46 (device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39117
diff changeset
104 This is an XEmacs compatibility function."
4925eba04c46 (device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39117
diff changeset
105 (with-current-buffer (or buffer (current-buffer))
4925eba04c46 (device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39117
diff changeset
106 (let ((state (syntax-ppss (point))))
4925eba04c46 (device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39117
diff changeset
107 (cond
4925eba04c46 (device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39117
diff changeset
108 ((nth 3 state) 'string)
4925eba04c46 (device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39117
diff changeset
109 ((nth 4 state) 'comment)))))
4925eba04c46 (device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39117
diff changeset
110
4925eba04c46 (device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39117
diff changeset
111
4925eba04c46 (device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39117
diff changeset
112 (defun buffer-syntactic-context-depth (&optional buffer)
4925eba04c46 (device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39117
diff changeset
113 "Syntactic parenthesis depth at point in BUFFER.
4925eba04c46 (device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39117
diff changeset
114 This is an XEmacs compatibility function."
4925eba04c46 (device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39117
diff changeset
115 (with-current-buffer (or buffer (current-buffer))
4925eba04c46 (device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39117
diff changeset
116 (nth 0 (syntax-ppss (point)))))
4925eba04c46 (device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39117
diff changeset
117
4925eba04c46 (device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39117
diff changeset
118
4925eba04c46 (device-class, buffer-syntactic-context)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39117
diff changeset
119 ;; Extents
10596
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
120 (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
121 (make-overlay beg end buffer))
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
122
30087
1b5db0f1b8b7 Require CL.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 19340
diff changeset
123 (defun extent-properties (extent) (overlay-properties extent))
1b5db0f1b8b7 Require CL.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 19340
diff changeset
124 (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
125
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
126 (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
127 (with-current-buffer (or object (current-buffer))
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
128 (let ((overlays (overlays-at pos)))
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
129 (when property
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
130 (let (filtered)
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
131 (while overlays
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
132 (if (overlay-get (car overlays) property)
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
133 (setq filtered (cons (car overlays) filtered)))
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
134 (setq overlays (cdr overlays)))
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
135 (setq overlays filtered)))
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
136 (setq overlays
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
137 (sort overlays
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
138 (function (lambda (o1 o2)
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
139 (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
140 (p2 (or (overlay-get o2 'priority) 0)))
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
141 (or (> p1 p2)
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
142 (and (= p1 p2)
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
143 (> (overlay-start o1) (overlay-start o2)))))))))
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
144 (if before
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
145 (nth 1 (memq before overlays))
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
146 (car overlays)))))
ce11e3471a36 (extent-properties, extent-at): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 19321
diff changeset
147
10596
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
148 (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
149 ;; Make sure that separate adjacent extents
995bfd9752d5 (set-extent-property): Don't allow
Richard M. Stallman <rms@gnu.org>
parents: 16340
diff changeset
150 ;; with the same mouse-face value
995bfd9752d5 (set-extent-property): Don't allow
Richard M. Stallman <rms@gnu.org>
parents: 16340
diff changeset
151 ;; do not run together as one extent.
995bfd9752d5 (set-extent-property): Don't allow
Richard M. Stallman <rms@gnu.org>
parents: 16340
diff changeset
152 (and (eq prop 'mouse-face)
995bfd9752d5 (set-extent-property): Don't allow
Richard M. Stallman <rms@gnu.org>
parents: 16340
diff changeset
153 (symbolp value)
995bfd9752d5 (set-extent-property): Don't allow
Richard M. Stallman <rms@gnu.org>
parents: 16340
diff changeset
154 (setq value (list value)))
10596
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
155 (if (eq prop 'duplicable)
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
156 (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
157 ;; 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
158 (add-text-properties (overlay-start extent)
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
159 (overlay-end extent)
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
160 (overlay-properties extent)
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
161 (overlay-buffer extent)))
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
162 ;; 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
163 ((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
164 (remove-text-properties (overlay-start extent)
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
165 (overlay-end extent)
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
166 (overlay-properties extent)
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
167 (overlay-buffer extent))))
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
168 ;; 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
169 ;; 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
170 (if (overlay-get extent 'duplicable)
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
171 (put-text-property (overlay-start extent)
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
172 (overlay-end extent)
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
173 prop value (overlay-buffer extent))))
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
174 (overlay-put extent prop value))
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
175
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
176 (defun set-extent-face (extent face)
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
177 (set-extent-property extent 'face face))
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
178
30087
1b5db0f1b8b7 Require CL.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 19340
diff changeset
179 (defun set-extent-end-glyph (extent glyph)
1b5db0f1b8b7 Require CL.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 19340
diff changeset
180 (set-extent-property extent 'after-string glyph))
1b5db0f1b8b7 Require CL.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 19340
diff changeset
181
10596
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
182 (defun delete-extent (extent)
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
183 (set-extent-property extent 'duplicable nil)
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
184 (delete-overlay extent))
3cda29fdf5f6 (make-extent, delete-extent, set-extent-property)
Richard M. Stallman <rms@gnu.org>
parents: 10589
diff changeset
185
2206
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
186 ;; Support the Lucid names with `screen' instead of `frame'.
c3bec907580c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 2168
diff changeset
187
2571
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
188 (defalias 'current-screen-configuration 'current-frame-configuration)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
189 (defalias 'delete-screen 'delete-frame)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
190 (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
191 (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
192 (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
193 ;;(defalias 'focus-screen 'focus-frame)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
194 (defalias 'iconify-screen 'iconify-frame)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
195 (defalias 'mail-new-screen 'mail-other-frame)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
196 (defalias 'make-screen-invisible 'make-frame-invisible)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
197 (defalias 'make-screen-visible 'make-frame-visible)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
198 ;; (defalias 'minibuffer-screen-list 'minibuffer-frame-list)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
199 (defalias 'modify-screen-parameters 'modify-frame-parameters)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
200 (defalias 'next-screen 'next-frame)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
201 ;; (defalias 'next-multiscreen-window 'next-multiframe-window)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
202 ;; (defalias 'previous-multiscreen-window 'previous-multiframe-window)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
203 ;; (defalias 'redirect-screen-focus 'redirect-frame-focus)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
204 (defalias 'redraw-screen 'redraw-frame)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
205 ;; (defalias 'screen-char-height 'frame-char-height)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
206 ;; (defalias 'screen-char-width 'frame-char-width)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
207 ;; (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
208 ;; (defalias 'screen-focus 'frame-focus)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
209 (defalias 'screen-list 'frame-list)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
210 ;; (defalias 'screen-live-p 'frame-live-p)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
211 (defalias 'screen-parameters 'frame-parameters)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
212 (defalias 'screen-pixel-height 'frame-pixel-height)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
213 (defalias 'screen-pixel-width 'frame-pixel-width)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
214 (defalias 'screen-root-window 'frame-root-window)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
215 (defalias 'screen-selected-window 'frame-selected-window)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
216 (defalias 'lower-screen 'lower-frame)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
217 (defalias 'raise-screen 'raise-frame)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
218 (defalias 'screen-visible-p 'frame-visible-p)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
219 (defalias 'screenp 'framep)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
220 (defalias 'select-screen 'select-frame)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
221 (defalias 'selected-screen 'selected-frame)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
222 ;; (defalias 'set-screen-configuration 'set-frame-configuration)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
223 ;; (defalias 'set-screen-height 'set-frame-height)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
224 (defalias 'set-screen-position 'set-frame-position)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
225 (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
226 ;; (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
227 (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
228 ;; (defalias 'unfocus-screen 'unfocus-frame)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
229 (defalias 'visible-screen-list 'visible-frame-list)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
230 (defalias 'window-screen 'window-frame)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2484
diff changeset
231 (defalias 'x-create-screen 'x-create-frame)
7365
8c2f150f2880 Change new-frame to make-frame.
Karl Heuer <kwzh@gnu.org>
parents: 4997
diff changeset
232 (defalias 'x-new-screen 'make-frame)
2484
6ddf357bd36c Add copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 2388
diff changeset
233
2631
1e3d854828fc * lucid.el: Comment out fset of set-screen-width properly.
Jim Blandy <jimb@redhat.com>
parents: 2571
diff changeset
234 (provide 'lucid)
1e3d854828fc * lucid.el: Comment out fset of set-screen-width properly.
Jim Blandy <jimb@redhat.com>
parents: 2571
diff changeset
235
93975
1e3a407766b9 Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 79704
diff changeset
236 ;; arch-tag: 80f9ab46-0b36-4151-86ed-3edb6d449c9e
38414
67b464da13ec Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 30087
diff changeset
237 ;;; lucid.el ends here