annotate lisp/obsolete.el @ 371:cc15677e0335 r21-2b1

Import from CVS: tag r21-2b1
author cvs
date Mon, 13 Aug 2007 11:03:08 +0200
parents a4f53d9b3154
children 8626e4521993
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1 ;;; obsolete.el --- obsoleteness support
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3 ;; Copyright (C) 1985-1994, 1997 Free Software Foundation, Inc.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
4 ;; Copyright (C) 1994, 1995 Amdahl Corporation.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
5 ;; Copyright (C) 1995 Sun Microsystems.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
6
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
7 ;; Maintainer: XEmacs Development Team
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
8 ;; Keywords: internal, dumped
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
9
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
10 ;; This file is part of XEmacs.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
11
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
12 ;; XEmacs is free software; you can redistribute it and/or modify it
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
13 ;; under the terms of the GNU General Public License as published by
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
15 ;; any later version.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
16
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
17 ;; XEmacs is distributed in the hope that it will be useful, but
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
20 ;; General Public License for more details.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
21
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 209
diff changeset
23 ;; along with XEmacs; see the file COPYING. If not, write to the
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
24 ;; Free Software Foundation, 59 Temple Place - Suite 330,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
25 ;; Boston, MA 02111-1307, USA.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
26
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
27 ;;; Synched up with: Not in FSF.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
28
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
29 ;;; Commentary:
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
30
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
31 ;; This file is dumped with XEmacs.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
32
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
33 ;; The obsoleteness support used to be scattered throughout various
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
34 ;; source files. We put the stuff in one place to remove the junkiness
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
35 ;; from other source files and to facilitate creating/updating things
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
36 ;; like sysdep.el.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
37
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
38 ;;; Code:
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
39
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
40 (defsubst define-obsolete-function-alias (oldfun newfun)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
41 "Define OLDFUN as an obsolete alias for function NEWFUN.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
42 This makes calling OLDFUN equivalent to calling NEWFUN and marks OLDFUN
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
43 as obsolete."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
44 (define-function oldfun newfun)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
45 (make-obsolete oldfun newfun))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
46
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
47 (defsubst define-compatible-function-alias (oldfun newfun)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
48 "Define OLDFUN as a compatible alias for function NEWFUN.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
49 This makes calling OLDFUN equivalent to calling NEWFUN and marks OLDFUN
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
50 as provided for compatibility only."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
51 (define-function oldfun newfun)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
52 (make-compatible oldfun newfun))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
53
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
54 (defsubst define-obsolete-variable-alias (oldvar newvar)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
55 "Define OLDVAR as an obsolete alias for variable NEWVAR.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
56 This makes referencing or setting OLDVAR equivalent to referencing or
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 209
diff changeset
57 setting NEWVAR and marks OLDVAR as obsolete.
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
58 If OLDVAR was bound and NEWVAR was not, Set NEWVAR to OLDVAR.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
59
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
60 Note: Use this before any other references (defvar/defcustom) to NEWVAR"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
61 (let ((needs-setting (and (boundp oldvar) (not (boundp newvar))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
62 (value (and (boundp oldvar) (symbol-value oldvar))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
63 (defvaralias oldvar newvar)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
64 (make-obsolete-variable oldvar newvar)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
65 (and needs-setting (set newvar value))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
66
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
67 (defsubst define-compatible-variable-alias (oldvar newvar)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
68 "Define OLDVAR as a compatible alias for variable NEWVAR.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
69 This makes referencing or setting OLDVAR equivalent to referencing or
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
70 setting NEWVAR and marks OLDVAR as provided for compatibility only."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
71 (defvaralias oldvar newvar)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
72 (make-compatible-variable oldvar newvar))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
73
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
74 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; device stuff
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
75
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
76 (make-compatible-variable 'window-system "use (console-type)")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
77
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
78 (defun x-display-color-p (&optional device)
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 209
diff changeset
79 "Return t if DEVICE is a color device."
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
80 (eq 'color (device-class device)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
81 (make-compatible 'x-display-color-p 'device-class)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
82
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
83 (define-function 'x-color-display-p 'x-display-color-p)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
84 (make-compatible 'x-display-color-p 'device-class)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
85
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
86 (defun x-display-grayscale-p (&optional device)
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 209
diff changeset
87 "Return t if DEVICE is a grayscale device."
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
88 (eq 'grayscale (device-class device)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
89 (make-compatible 'x-display-grayscale-p 'device-class)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
90
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
91 (define-function 'x-grayscale-display-p 'x-display-grayscale-p)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
92 (make-compatible 'x-display-grayscale-p 'device-class)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
93
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 276
diff changeset
94 (define-compatible-function-alias 'x-display-pixel-width 'device-pixel-width)
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 276
diff changeset
95 (define-compatible-function-alias 'x-display-pixel-height 'device-pixel-height)
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 276
diff changeset
96 (define-compatible-function-alias 'x-display-planes 'device-bitplanes)
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 276
diff changeset
97 (define-compatible-function-alias 'x-display-color-cells 'device-color-cells)
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
98
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
99 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; events
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
100
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
101 (define-obsolete-function-alias 'menu-event-p 'misc-user-event-p)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
102 (make-obsolete-variable 'unread-command-char 'unread-command-events)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
103
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
104 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; extents
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
105
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
106 (make-obsolete 'set-window-dot 'set-window-point)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
107
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
108 (define-obsolete-function-alias 'extent-buffer 'extent-object)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
109
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
110 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; frames
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
111 (defun frame-first-window (frame)
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 209
diff changeset
112 "Return the topmost, leftmost window of FRAME.
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
113 If omitted, FRAME defaults to the currently selected frame."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
114 (frame-highest-window frame 0))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
115 (make-compatible 'frame-first-window 'frame-highest-window)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
116
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
117 (define-obsolete-variable-alias 'initial-frame-alist 'initial-frame-plist)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
118 (define-obsolete-variable-alias 'minibuffer-frame-alist
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
119 'minibuffer-frame-plist)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
120 (define-obsolete-variable-alias 'pop-up-frame-alist 'pop-up-frame-plist)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
121 (define-obsolete-variable-alias 'special-display-frame-alist
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
122 'special-display-frame-plist)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
123
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
124 ;; Defined in C.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
125
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
126 (define-obsolete-variable-alias 'default-frame-alist 'default-frame-plist)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
127 (define-obsolete-variable-alias 'default-x-frame-alist 'default-x-frame-plist)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
128 (define-obsolete-variable-alias 'default-tty-frame-alist
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
129 'default-tty-frame-plist)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
130
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
131 (make-compatible 'frame-parameters 'frame-property)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
132 (defun frame-parameters (&optional frame)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
133 "Return the parameters-alist of frame FRAME.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
134 It is a list of elements of the form (PARM . VALUE), where PARM is a symbol.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
135 The meaningful PARMs depend on the kind of frame.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
136 If FRAME is omitted, return information on the currently selected frame.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
137
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
138 See the variables `default-frame-plist', `default-x-frame-plist', and
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
139 `default-tty-frame-plist' for a description of the parameters meaningful
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
140 for particular types of frames."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
141 (or frame (setq frame (selected-frame)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
142 ;; #### This relies on a `copy-sequence' of the user properties in
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
143 ;; `frame-properties'. Removing that would make `frame-properties' more
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
144 ;; efficient but this function less efficient, as we couldn't be
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
145 ;; destructive. Since most callers now use `frame-parameters', we'll
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
146 ;; do it this way. Should probably change this at some point in the
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
147 ;; future.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
148 (destructive-plist-to-alist (frame-properties frame)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
149
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
150 (make-compatible 'modify-frame-parameters 'set-frame-properties)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
151 (defun modify-frame-parameters (frame alist)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
152 "Modify the properties of frame FRAME according to ALIST.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
153 ALIST is an alist of properties to change and their new values.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
154 Each element of ALIST has the form (PARM . VALUE), where PARM is a symbol.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
155 The meaningful PARMs depend on the kind of frame.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
156
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
157 See `set-frame-properties' for built-in property names."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
158 ;; it would be nice to be destructive here but that's not safe.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
159 (set-frame-properties frame (alist-to-plist alist)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
160
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
161 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; faces
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
162
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
163 (define-obsolete-function-alias 'list-faces-display 'edit-faces)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
164 (define-obsolete-function-alias 'list-faces 'face-list)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
165
274
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
166 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; paths
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
167
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
168 (defvar Info-default-directory-list nil
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
169 "This used to be the initial value of Info-directory-list.
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
170 If you want to change the locations where XEmacs looks for info files,
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
171 set Info-directory-list.")
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
172 (make-obsolete-variable 'Info-default-directory-list 'Info-directory-list)
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
173
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
174 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; hooks
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
175
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
176 (make-compatible-variable 'lisp-indent-hook 'lisp-indent-function)
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
177 (make-compatible-variable 'comment-indent-hook 'comment-indent-function)
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
178 (make-obsolete-variable 'temp-buffer-show-hook
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
179 'temp-buffer-show-function)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
180 (make-obsolete-variable 'inhibit-local-variables
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
181 "use `enable-local-variables' (with the reversed sense).")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
182 (make-obsolete-variable 'suspend-hooks 'suspend-hook)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
183 (make-obsolete-variable 'first-change-function 'first-change-hook)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
184 (make-obsolete-variable 'before-change-function
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
185 "use before-change-functions; which is a list of functions rather than a single function.")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
186 (make-obsolete-variable 'after-change-function
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
187 "use after-change-functions; which is a list of functions rather than a single function.")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
188
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
189 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; insertion and deletion
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
190
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
191 (define-compatible-function-alias 'insert-and-inherit 'insert)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
192 (define-compatible-function-alias 'insert-before-markers-and-inherit
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
193 'insert-before-markers)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
194
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
195 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; keymaps
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
196
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
197 (defun keymap-parent (keymap)
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 209
diff changeset
198 "Return the first parent of the given keymap."
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
199 (car (keymap-parents keymap)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
200 (make-compatible 'keymap-parent 'keymap-parents)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
201
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
202 (defun set-keymap-parent (keymap parent)
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 209
diff changeset
203 "Make the given keymap have (only) the given parent."
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
204 (set-keymap-parents keymap (if parent (list parent) '()))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
205 parent)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
206 (make-compatible 'set-keymap-parent 'set-keymap-parents)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
207
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
208 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; menu stuff
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
210 (defun add-menu-item (menu-path item-name function enabled-p &optional before)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
211 "Obsolete. See the function `add-menu-button'."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
212 (or item-name (error "must specify an item name"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
213 (add-menu-button menu-path (vector item-name function enabled-p) before))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
214 (make-obsolete 'add-menu-item 'add-menu-button)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
215
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
216 (defun add-menu (menu-path menu-name menu-items &optional before)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
217 "See the function `add-submenu'."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
218 (or menu-name (error (gettext "must specify a menu name")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
219 (or menu-items (error (gettext "must specify some menu items")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
220 (add-submenu menu-path (cons menu-name menu-items) before))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
221 ;; Can't make this obsolete. easymenu depends on it.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
222 (make-compatible 'add-menu 'add-submenu)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
223
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
224 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; minibuffer
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
225
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
226 (define-compatible-function-alias 'read-minibuffer
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
227 'read-expression) ; misleading name
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
228 (define-compatible-function-alias 'read-input 'read-string)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
229
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
230 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; misc
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
231
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
232 ;; (defun user-original-login-name ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
233 ;; "Return user's login name from original login.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
234 ;; This tries to remain unaffected by `su', by looking in environment variables."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
235 ;; (or (getenv "LOGNAME") (getenv "USER") (user-login-name)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
236 (define-obsolete-function-alias 'user-original-login-name 'user-login-name)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
237
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
238 ; old names
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
239 (define-obsolete-function-alias 'show-buffer 'set-window-buffer)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
240 (define-obsolete-function-alias 'buffer-flush-undo 'buffer-disable-undo)
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
241 (make-compatible 'eval-current-buffer 'eval-buffer)
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
242 (define-compatible-function-alias 'byte-code-function-p
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
243 'compiled-function-p) ;FSFmacs
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
244
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
245 ;; too bad there's not a way to check for aref, assq, and nconc
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
246 ;; being called on the values of functions known to return keymaps,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
247 ;; or known to return vectors of events instead of strings...
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
248
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
249 (make-obsolete-variable 'executing-macro 'executing-kbd-macro)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
250
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
251 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; modeline
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
252
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
253 (define-compatible-function-alias 'redraw-mode-line 'redraw-modeline)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
254 (define-compatible-function-alias 'force-mode-line-update
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
255 'redraw-modeline) ;; FSF compatibility
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
256 (define-compatible-variable-alias 'mode-line-map 'modeline-map)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
257 (define-compatible-variable-alias 'mode-line-buffer-identification
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
258 'modeline-buffer-identification)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
259 (define-compatible-variable-alias 'mode-line-process 'modeline-process)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
260 (define-compatible-variable-alias 'mode-line-modified 'modeline-modified)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
261 (make-compatible-variable 'mode-line-inverse-video
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
262 "use set-face-highlight-p and set-face-reverse-p")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
263 (define-compatible-variable-alias 'default-mode-line-format
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
264 'default-modeline-format)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
265 (define-compatible-variable-alias 'mode-line-format 'modeline-format)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
266 (define-compatible-variable-alias 'mode-line-menu 'modeline-menu)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
267
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
268 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; mouse
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
269
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
270 ;;; (defun mouse-eval-last-sexpr (event)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
271 ;;; (interactive "@e")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
272 ;;; (save-excursion
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
273 ;;; (mouse-set-point event)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
274 ;;; (eval-last-sexp nil)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
275
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
276 (define-obsolete-function-alias 'mouse-eval-last-sexpr 'mouse-eval-sexp)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
277
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
278 (defun read-mouse-position (frame)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
279 (cdr (mouse-position (frame-device frame))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
280 (make-obsolete 'read-mouse-position 'mouse-position)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
281
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
282 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; redisplay
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
283
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
284 (defun redraw-display (&optional device)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
285 (if (eq device t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
286 (mapcar 'redisplay-device (device-list))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
287 (redisplay-device device)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
288
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
289 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; window-system objects
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
290
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
291 ;; the functionality of column.el has been moved into C
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
292 ;; Function obsoleted for XEmacs 20.0/February 1997.
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
293 (defalias 'display-column-mode 'column-number-mode)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
294
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
295 (defun x-color-values (color &optional frame)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
296 "Return a description of the color named COLOR on frame FRAME.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
297 The value is a list of integer RGB values--(RED GREEN BLUE).
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
298 These values appear to range from 0 to 65280 or 65535, depending
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
299 on the system; white is (65280 65280 65280) or (65535 65535 65535).
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
300 If FRAME is omitted or nil, use the selected frame."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
301 (color-instance-rgb-components (make-color-instance color)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
302 (make-compatible 'x-color-values 'color-instance-rgb-components)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
303
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
304 ;; Two loser functions which shouldn't be used.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
305 (make-obsolete 'following-char 'char-after)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
306 (make-obsolete 'preceding-char 'char-before)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
307
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
308
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
309 ;; The following several functions are useful in GNU Emacs 20 because
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
310 ;; of the multibyte "characters" the internal representation of which
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
311 ;; leaks into Lisp. In XEmacs/Mule they are trivial and unnecessary.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
312 ;; We provide them for compatibility reasons solely.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
313
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
314 (defun string-to-sequence (string type)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
315 "Convert STRING to a sequence of TYPE which contains characters in STRING.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
316 TYPE should be `list' or `vector'.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
317 Multibyte characters are concerned."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
318 (ecase type
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
319 (list
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
320 (mapcar #'identity string))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
321 (vector
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
322 (mapvector #'identity string))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
323
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
324 (defun string-to-list (string)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
325 "Return a list of characters in STRING."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
326 (mapcar #'identity string))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
327
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
328 (defun string-to-vector (string)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
329 "Return a vector of characters in STRING."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
330 (mapvector #'identity string))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
331
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
332 (defun store-substring (string idx obj)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
333 "Embed OBJ (string or character) at index IDX of STRING."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
334 (let* ((str (cond ((stringp obj) obj)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
335 ((characterp obj) (char-to-string obj))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
336 (t (error
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
337 "Invalid argument (should be string or character): %s"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
338 obj))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
339 (string-len (length string))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
340 (len (length str))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
341 (i 0))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
342 (while (and (< i len) (< idx string-len))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
343 (aset string idx (aref str i))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
344 (setq idx (1+ idx) i (1+ i)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
345 string))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
346
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
347 ;; ### This function is not compatible with FSF in some cases. Hard
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
348 ;; to fix, because it is hard to trace the logic of the FSF function.
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
349 ;; In case we need the exact behaviour, we can always copy the FSF
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
350 ;; version, which is very long and does lots of unnecessary stuff.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
351 (defun truncate-string-to-width (str end-column &optional start-column padding)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
352 "Truncate string STR to end at column END-COLUMN.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
353 The optional 2nd arg START-COLUMN, if non-nil, specifies
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
354 the starting column; that means to return the characters occupying
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
355 columns START-COLUMN ... END-COLUMN of STR.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
356
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
357 The optional 3rd arg PADDING, if non-nil, specifies a padding character
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
358 to add at the end of the result if STR doesn't reach column END-COLUMN,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
359 or if END-COLUMN comes in the middle of a character in STR.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
360 PADDING is also added at the beginning of the result
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
361 if column START-COLUMN appears in the middle of a character in STR.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
362
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
363 If PADDING is nil, no padding is added in these cases, so
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
364 the resulting string may be narrower than END-COLUMN."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
365 (or start-column
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
366 (setq start-column 0))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
367 (let ((len (length str)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
368 (concat (substring str (min start-column len) (min end-column len))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
369 (and padding (> end-column len)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
370 (make-string (- end-column len) padding)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
371
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
372 (defalias 'truncate-string 'truncate-string-to-width)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
373 (make-obsolete 'truncate-string 'truncate-string-to-width)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
374
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
375 ;; Keywords already do The Right Thing in XEmacs
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
376 (make-compatible 'define-widget-keywords "Just use them")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
377
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
378 (make-obsolete 'function-called-at-point 'function-at-point)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
379
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
380 ;;; obsolete.el ends here