Generate curved quotes in pseudo-info nodes
[emacs.git] / lisp / obsolete / lucid.el
blob569abb60870e7472d9c61d2f52f6f5495068e364
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/>.
24 ;;; Commentary:
26 ;;; Code:
28 ;; XEmacs autoloads CL so we might as well make use of it.
29 (require 'cl)
31 (defalias 'current-time-seconds 'current-time)
33 (defun real-path-name (name &optional default)
34 (file-truename (expand-file-name name default)))
36 ;; It's not clear what to return if the mouse is not in FRAME.
37 (defun read-mouse-position (frame)
38 (let ((pos (mouse-position)))
39 (if (eq (car pos) frame)
40 (cdr pos))))
42 (defun switch-to-other-buffer (arg)
43 "Switch to the previous buffer.
44 With a numeric arg N, switch to the Nth most recent buffer.
45 With an arg of 0, buries the current buffer at the
46 bottom of the buffer stack."
47 (interactive "p")
48 (if (eq arg 0)
49 (bury-buffer (current-buffer)))
50 (switch-to-buffer
51 (if (<= arg 1) (other-buffer (current-buffer))
52 (nth arg
53 (apply 'nconc
54 (mapcar
55 (lambda (buf)
56 (if (= ?\ (string-to-char (buffer-name buf)))
57 nil
58 (list buf)))
59 (buffer-list)))))))
61 (defun device-class (&optional device)
62 "Return the class (color behavior) of DEVICE.
63 This will be one of 'color, 'grayscale, or 'mono.
64 This function exists for compatibility with XEmacs."
65 (cond
66 ((display-color-p device) 'color)
67 ((display-grayscale-p device) 'grayscale)
68 (t 'mono)))
70 (defalias 'find-face 'facep)
71 (defalias 'get-face 'facep)
72 ;; internal-try-face-font was removed from faces.el in rev 1.139, 1999/07/21.
73 ;;;(defalias 'try-face-font 'internal-try-face-font)
75 (defalias 'exec-to-string 'shell-command-to-string)
78 ;; Buffer context
80 (defun buffer-syntactic-context (&optional buffer)
81 "Syntactic context at point in BUFFER.
82 Either of `string', `comment' or nil.
83 This is an XEmacs compatibility function."
84 (with-current-buffer (or buffer (current-buffer))
85 (let ((state (syntax-ppss (point))))
86 (cond
87 ((nth 3 state) 'string)
88 ((nth 4 state) 'comment)))))
91 (defun buffer-syntactic-context-depth (&optional buffer)
92 "Syntactic parenthesis depth at point in BUFFER.
93 This is an XEmacs compatibility function."
94 (with-current-buffer (or buffer (current-buffer))
95 (nth 0 (syntax-ppss (point)))))
98 ;; Extents
99 (defun make-extent (beg end &optional buffer)
100 (make-overlay beg end buffer))
102 (defun extent-properties (extent) (overlay-properties extent))
103 (unless (fboundp 'extent-property) (defalias 'extent-property 'overlay-get))
105 (defun extent-at (pos &optional object property before)
106 (with-current-buffer (or object (current-buffer))
107 (let ((overlays (overlays-at pos 'sorted)))
108 (when property
109 (let (filtered)
110 (while overlays
111 (if (overlay-get (car overlays) property)
112 (setq filtered (cons (car overlays) filtered)))
113 (setq overlays (cdr overlays)))
114 (setq overlays filtered)))
115 (if before
116 (nth 1 (memq before overlays))
117 (car overlays)))))
119 (defun set-extent-property (extent prop value)
120 ;; Make sure that separate adjacent extents
121 ;; with the same mouse-face value
122 ;; do not run together as one extent.
123 (and (eq prop 'mouse-face)
124 (symbolp value)
125 (setq value (list value)))
126 (if (eq prop 'duplicable)
127 (cond ((and value (not (overlay-get extent prop)))
128 ;; If becoming duplicable, copy all overlayprops to text props.
129 (add-text-properties (overlay-start extent)
130 (overlay-end extent)
131 (overlay-properties extent)
132 (overlay-buffer extent)))
133 ;; If becoming no longer duplicable, remove these text props.
134 ((and (not value) (overlay-get extent prop))
135 (remove-text-properties (overlay-start extent)
136 (overlay-end extent)
137 (overlay-properties extent)
138 (overlay-buffer extent))))
139 ;; If extent is already duplicable, put this property
140 ;; on the text as well as on the overlay.
141 (if (overlay-get extent 'duplicable)
142 (put-text-property (overlay-start extent)
143 (overlay-end extent)
144 prop value (overlay-buffer extent))))
145 (overlay-put extent prop value))
147 (defun set-extent-face (extent face)
148 (set-extent-property extent 'face face))
150 (defun set-extent-end-glyph (extent glyph)
151 (set-extent-property extent 'after-string glyph))
153 (defun delete-extent (extent)
154 (set-extent-property extent 'duplicable nil)
155 (delete-overlay extent))
157 ;; Support the Lucid names with `screen' instead of `frame'.
159 (defalias 'current-screen-configuration 'current-frame-configuration)
160 (defalias 'delete-screen 'delete-frame)
161 (defalias 'find-file-new-screen 'find-file-other-frame)
162 (defalias 'find-file-read-only-new-screen 'find-file-read-only-other-frame)
163 (defalias 'find-tag-new-screen 'find-tag-other-frame)
164 ;;(defalias 'focus-screen 'focus-frame)
165 (defalias 'iconify-screen 'iconify-frame)
166 (defalias 'mail-new-screen 'mail-other-frame)
167 (defalias 'make-screen-invisible 'make-frame-invisible)
168 (defalias 'make-screen-visible 'make-frame-visible)
169 ;; (defalias 'minibuffer-screen-list 'minibuffer-frame-list)
170 (defalias 'modify-screen-parameters 'modify-frame-parameters)
171 (defalias 'next-screen 'next-frame)
172 ;; (defalias 'next-multiscreen-window 'next-multiframe-window)
173 ;; (defalias 'previous-multiscreen-window 'previous-multiframe-window)
174 ;; (defalias 'redirect-screen-focus 'redirect-frame-focus)
175 (defalias 'redraw-screen 'redraw-frame)
176 ;; (defalias 'screen-char-height 'frame-char-height)
177 ;; (defalias 'screen-char-width 'frame-char-width)
178 ;; (defalias 'screen-configuration-to-register 'frame-configuration-to-register)
179 ;; (defalias 'screen-focus 'frame-focus)
180 (defalias 'screen-list 'frame-list)
181 ;; (defalias 'screen-live-p 'frame-live-p)
182 (defalias 'screen-parameters 'frame-parameters)
183 (defalias 'screen-pixel-height 'frame-pixel-height)
184 (defalias 'screen-pixel-width 'frame-pixel-width)
185 (defalias 'screen-root-window 'frame-root-window)
186 (defalias 'screen-selected-window 'frame-selected-window)
187 (defalias 'lower-screen 'lower-frame)
188 (defalias 'raise-screen 'raise-frame)
189 (defalias 'screen-visible-p 'frame-visible-p)
190 (defalias 'screenp 'framep)
191 (defalias 'select-screen 'select-frame)
192 (defalias 'selected-screen 'selected-frame)
193 ;; (defalias 'set-screen-configuration 'set-frame-configuration)
194 ;; (defalias 'set-screen-height 'set-frame-height)
195 (defalias 'set-screen-position 'set-frame-position)
196 (defalias 'set-screen-size 'set-frame-size)
197 ;; (defalias 'set-screen-width 'set-frame-width)
198 (defalias 'switch-to-buffer-new-screen 'switch-to-buffer-other-frame)
199 ;; (defalias 'unfocus-screen 'unfocus-frame)
200 (defalias 'visible-screen-list 'visible-frame-list)
201 (defalias 'window-screen 'window-frame)
202 (defalias 'x-create-screen 'x-create-frame)
203 (defalias 'x-new-screen 'make-frame)
205 (provide 'lucid)
207 ;; Local Variables:
208 ;; byte-compile-warnings: (not cl-functions)
209 ;; End:
211 ;;; lucid.el ends here