1 ;;; lucid.el --- emulate some Lucid Emacs functions
3 ;; Copyright (C) 1993, 1995, 2001-2015 Free Software Foundation, Inc.
5 ;; Maintainer: emacs-devel@gnu.org
6 ;; Keywords: emulations
7 ;; Obsolete-since: 23.2
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation, either version 3 of the License, or
14 ;; (at your option) any later version.
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
28 ;; XEmacs autoloads CL so we might as well make use of it.
31 (defalias 'current-time-seconds 'current-time)
33 (defun read-number (prompt &optional integers-only)
34 "Read a number from the minibuffer.
35 Keep reentering the minibuffer until we get suitable input.
36 If optional argument INTEGERS-ONLY is non-nil, insist on an integer."
40 (predicate (if integers-only 'integerp 'numberp)))
42 (let ((input-string (read-string prompt)))
44 (setq number (read input-string))
46 (if (funcall predicate number)
48 (let ((cursor-in-echo-area t))
49 (message "Please type %s"
50 (if integers-only "an integer" "a number"))
54 (defun real-path-name (name &optional default)
55 (file-truename (expand-file-name name default)))
57 ;; It's not clear what to return if the mouse is not in FRAME.
58 (defun read-mouse-position (frame)
59 (let ((pos (mouse-position)))
60 (if (eq (car pos) frame)
63 (defun switch-to-other-buffer (arg)
64 "Switch to the previous buffer.
65 With a numeric arg N, switch to the Nth most recent buffer.
66 With an arg of 0, buries the current buffer at the
67 bottom of the buffer stack."
70 (bury-buffer (current-buffer)))
72 (if (<= arg 1) (other-buffer (current-buffer))
77 (if (= ?\ (string-to-char (buffer-name buf)))
82 (defun device-class (&optional device)
83 "Return the class (color behavior) of DEVICE.
84 This will be one of 'color, 'grayscale, or 'mono.
85 This function exists for compatibility with XEmacs."
87 ((display-color-p device) 'color)
88 ((display-grayscale-p device) 'grayscale)
91 (defalias 'find-face 'facep)
92 (defalias 'get-face 'facep)
93 ;; internal-try-face-font was removed from faces.el in rev 1.139, 1999/07/21.
94 ;;;(defalias 'try-face-font 'internal-try-face-font)
96 (defalias 'exec-to-string 'shell-command-to-string)
101 (defun buffer-syntactic-context (&optional buffer)
102 "Syntactic context at point in BUFFER.
103 Either of `string', `comment' or nil.
104 This is an XEmacs compatibility function."
105 (with-current-buffer (or buffer (current-buffer))
106 (let ((state (syntax-ppss (point))))
108 ((nth 3 state) 'string)
109 ((nth 4 state) 'comment)))))
112 (defun buffer-syntactic-context-depth (&optional buffer)
113 "Syntactic parenthesis depth at point in BUFFER.
114 This is an XEmacs compatibility function."
115 (with-current-buffer (or buffer (current-buffer))
116 (nth 0 (syntax-ppss (point)))))
120 (defun make-extent (beg end &optional buffer)
121 (make-overlay beg end buffer))
123 (defun extent-properties (extent) (overlay-properties extent))
124 (unless (fboundp 'extent-property) (defalias 'extent-property 'overlay-get))
126 (defun extent-at (pos &optional object property before)
127 (with-current-buffer (or object (current-buffer))
128 (let ((overlays (overlays-at pos 'sorted)))
132 (if (overlay-get (car overlays) property)
133 (setq filtered (cons (car overlays) filtered)))
134 (setq overlays (cdr overlays)))
135 (setq overlays filtered)))
137 (nth 1 (memq before overlays))
140 (defun set-extent-property (extent prop value)
141 ;; Make sure that separate adjacent extents
142 ;; with the same mouse-face value
143 ;; do not run together as one extent.
144 (and (eq prop 'mouse-face)
146 (setq value (list value)))
147 (if (eq prop 'duplicable)
148 (cond ((and value (not (overlay-get extent prop)))
149 ;; If becoming duplicable, copy all overlayprops to text props.
150 (add-text-properties (overlay-start extent)
152 (overlay-properties extent)
153 (overlay-buffer extent)))
154 ;; If becoming no longer duplicable, remove these text props.
155 ((and (not value) (overlay-get extent prop))
156 (remove-text-properties (overlay-start extent)
158 (overlay-properties extent)
159 (overlay-buffer extent))))
160 ;; If extent is already duplicable, put this property
161 ;; on the text as well as on the overlay.
162 (if (overlay-get extent 'duplicable)
163 (put-text-property (overlay-start extent)
165 prop value (overlay-buffer extent))))
166 (overlay-put extent prop value))
168 (defun set-extent-face (extent face)
169 (set-extent-property extent 'face face))
171 (defun set-extent-end-glyph (extent glyph)
172 (set-extent-property extent 'after-string glyph))
174 (defun delete-extent (extent)
175 (set-extent-property extent 'duplicable nil)
176 (delete-overlay extent))
178 ;; Support the Lucid names with `screen' instead of `frame'.
180 (defalias 'current-screen-configuration 'current-frame-configuration)
181 (defalias 'delete-screen 'delete-frame)
182 (defalias 'find-file-new-screen 'find-file-other-frame)
183 (defalias 'find-file-read-only-new-screen 'find-file-read-only-other-frame)
184 (defalias 'find-tag-new-screen 'find-tag-other-frame)
185 ;;(defalias 'focus-screen 'focus-frame)
186 (defalias 'iconify-screen 'iconify-frame)
187 (defalias 'mail-new-screen 'mail-other-frame)
188 (defalias 'make-screen-invisible 'make-frame-invisible)
189 (defalias 'make-screen-visible 'make-frame-visible)
190 ;; (defalias 'minibuffer-screen-list 'minibuffer-frame-list)
191 (defalias 'modify-screen-parameters 'modify-frame-parameters)
192 (defalias 'next-screen 'next-frame)
193 ;; (defalias 'next-multiscreen-window 'next-multiframe-window)
194 ;; (defalias 'previous-multiscreen-window 'previous-multiframe-window)
195 ;; (defalias 'redirect-screen-focus 'redirect-frame-focus)
196 (defalias 'redraw-screen 'redraw-frame)
197 ;; (defalias 'screen-char-height 'frame-char-height)
198 ;; (defalias 'screen-char-width 'frame-char-width)
199 ;; (defalias 'screen-configuration-to-register 'frame-configuration-to-register)
200 ;; (defalias 'screen-focus 'frame-focus)
201 (defalias 'screen-list 'frame-list)
202 ;; (defalias 'screen-live-p 'frame-live-p)
203 (defalias 'screen-parameters 'frame-parameters)
204 (defalias 'screen-pixel-height 'frame-pixel-height)
205 (defalias 'screen-pixel-width 'frame-pixel-width)
206 (defalias 'screen-root-window 'frame-root-window)
207 (defalias 'screen-selected-window 'frame-selected-window)
208 (defalias 'lower-screen 'lower-frame)
209 (defalias 'raise-screen 'raise-frame)
210 (defalias 'screen-visible-p 'frame-visible-p)
211 (defalias 'screenp 'framep)
212 (defalias 'select-screen 'select-frame)
213 (defalias 'selected-screen 'selected-frame)
214 ;; (defalias 'set-screen-configuration 'set-frame-configuration)
215 ;; (defalias 'set-screen-height 'set-frame-height)
216 (defalias 'set-screen-position 'set-frame-position)
217 (defalias 'set-screen-size 'set-frame-size)
218 ;; (defalias 'set-screen-width 'set-frame-width)
219 (defalias 'switch-to-buffer-new-screen 'switch-to-buffer-other-frame)
220 ;; (defalias 'unfocus-screen 'unfocus-frame)
221 (defalias 'visible-screen-list 'visible-frame-list)
222 (defalias 'window-screen 'window-frame)
223 (defalias 'x-create-screen 'x-create-frame)
224 (defalias 'x-new-screen 'make-frame)
229 ;; byte-compile-warnings: (not cl-functions)
232 ;;; lucid.el ends here