comparison lisp/subr.el @ 47916:0bb8dc016c43

(remq): Fix typo.
author Juanma Barranquero <lekktu@gmail.com>
date Thu, 17 Oct 2002 15:42:10 +0000
parents 399628a16c0a
children 69077a78e52f
comparison
equal deleted inserted replaced
47915:f1ce118178c3 47916:0bb8dc016c43
184 ;; `delete' will return a new object. 184 ;; `delete' will return a new object.
185 (delete elt seq) 185 (delete elt seq)
186 (delete elt (copy-sequence seq)))) 186 (delete elt (copy-sequence seq))))
187 187
188 (defun remq (elt list) 188 (defun remq (elt list)
189 "Return a copy of LIST with all occurences of ELT removed. 189 "Return a copy of LIST with all occurrences of ELT removed.
190 The comparison is done with `eq'." 190 The comparison is done with `eq'."
191 (if (memq elt list) 191 (if (memq elt list)
192 (delq elt (copy-sequence list)) 192 (delq elt (copy-sequence list))
193 list)) 193 list))
194 194
242 (setq alist (cdr alist))) 242 (setq alist (cdr alist)))
243 element)) 243 element))
244 244
245 (defun assoc-ignore-representation (key alist) 245 (defun assoc-ignore-representation (key alist)
246 "Like `assoc', but ignores differences in text representation. 246 "Like `assoc', but ignores differences in text representation.
247 KEY must be a string. 247 KEY must be a string.
248 Unibyte strings are converted to multibyte for comparison." 248 Unibyte strings are converted to multibyte for comparison."
249 (let (element) 249 (let (element)
250 (while (and alist (not element)) 250 (while (and alist (not element))
251 (if (eq t (compare-strings key 0 nil (car (car alist)) 0 nil)) 251 (if (eq t (compare-strings key 0 nil (car (car alist)) 0 nil))
252 (setq element (car alist))) 252 (setq element (car alist)))
289 (define-key map (char-to-string loop) 'digit-argument) 289 (define-key map (char-to-string loop) 'digit-argument)
290 (setq loop (1+ loop)))))) 290 (setq loop (1+ loop))))))
291 291
292 ;Moved to keymap.c 292 ;Moved to keymap.c
293 ;(defun copy-keymap (keymap) 293 ;(defun copy-keymap (keymap)
294 ; "Return a copy of KEYMAP" 294 ; "Return a copy of KEYMAP"
295 ; (while (not (keymapp keymap)) 295 ; (while (not (keymapp keymap))
296 ; (setq keymap (signal 'wrong-type-argument (list 'keymapp keymap)))) 296 ; (setq keymap (signal 'wrong-type-argument (list 'keymapp keymap))))
297 ; (if (vectorp keymap) 297 ; (if (vectorp keymap)
298 ; (copy-sequence keymap) 298 ; (copy-sequence keymap)
299 ; (copy-alist keymap))) 299 ; (copy-alist keymap)))
307 Alternatively, if optional fourth argument OLDMAP is specified, we redefine 307 Alternatively, if optional fourth argument OLDMAP is specified, we redefine
308 in KEYMAP as NEWDEF those keys which are defined as OLDDEF in OLDMAP." 308 in KEYMAP as NEWDEF those keys which are defined as OLDDEF in OLDMAP."
309 ;; Don't document PREFIX in the doc string because we don't want to 309 ;; Don't document PREFIX in the doc string because we don't want to
310 ;; advertise it. It's meant for recursive calls only. Here's its 310 ;; advertise it. It's meant for recursive calls only. Here's its
311 ;; meaning 311 ;; meaning
312 312
313 ;; If optional argument PREFIX is specified, it should be a key 313 ;; If optional argument PREFIX is specified, it should be a key
314 ;; prefix, a string. Redefined bindings will then be bound to the 314 ;; prefix, a string. Redefined bindings will then be bound to the
315 ;; original key, with PREFIX added at the front. 315 ;; original key, with PREFIX added at the front.
316 (or prefix (setq prefix "")) 316 (or prefix (setq prefix ""))
317 (let* ((scan (or oldmap keymap)) 317 (let* ((scan (or oldmap keymap))
501 (setq keyboard-translate-table 501 (setq keyboard-translate-table
502 (make-char-table 'keyboard-translate-table nil))) 502 (make-char-table 'keyboard-translate-table nil)))
503 (aset keyboard-translate-table from to)) 503 (aset keyboard-translate-table from to))
504 504
505 505
506 ;;;; The global keymap tree. 506 ;;;; The global keymap tree.
507 507
508 ;;; global-map, esc-map, and ctl-x-map have their values set up in 508 ;;; global-map, esc-map, and ctl-x-map have their values set up in
509 ;;; keymap.c; we just give them docstrings here. 509 ;;; keymap.c; we just give them docstrings here.
510 510
511 (defvar global-map nil 511 (defvar global-map nil
1039 ;; compatibility 1039 ;; compatibility
1040 1040
1041 (defun process-kill-without-query (process &optional flag) 1041 (defun process-kill-without-query (process &optional flag)
1042 "Say no query needed if PROCESS is running when Emacs is exited. 1042 "Say no query needed if PROCESS is running when Emacs is exited.
1043 Optional second argument if non-nil says to require a query. 1043 Optional second argument if non-nil says to require a query.
1044 Value is t if a query was formerly required. 1044 Value is t if a query was formerly required.
1045 New code should not use this function; use `process-query-on-exit-flag' 1045 New code should not use this function; use `process-query-on-exit-flag'
1046 or `set-process-query-on-exit-flag' instead." 1046 or `set-process-query-on-exit-flag' instead."
1047 (let ((old (process-query-on-exit-flag process))) 1047 (let ((old (process-query-on-exit-flag process)))
1048 (set-process-query-on-exit-flag process nil) 1048 (set-process-query-on-exit-flag process nil)
1049 old)) 1049 old))
1054 (defvar read-quoted-char-radix 8 1054 (defvar read-quoted-char-radix 8
1055 "*Radix for \\[quoted-insert] and other uses of `read-quoted-char'. 1055 "*Radix for \\[quoted-insert] and other uses of `read-quoted-char'.
1056 Legitimate radix values are 8, 10 and 16.") 1056 Legitimate radix values are 8, 10 and 16.")
1057 1057
1058 (custom-declare-variable-early 1058 (custom-declare-variable-early
1059 'read-quoted-char-radix 8 1059 'read-quoted-char-radix 8
1060 "*Radix for \\[quoted-insert] and other uses of `read-quoted-char'. 1060 "*Radix for \\[quoted-insert] and other uses of `read-quoted-char'.
1061 Legitimate radix values are 8, 10 and 16." 1061 Legitimate radix values are 8, 10 and 16."
1062 :type '(choice (const 8) (const 10) (const 16)) 1062 :type '(choice (const 8) (const 10) (const 16))
1063 :group 'editing-basics) 1063 :group 'editing-basics)
1064 1064
1245 "Finish a change group made with `prepare-change-group' (which see). 1245 "Finish a change group made with `prepare-change-group' (which see).
1246 This finishes the change group by reverting all of its changes." 1246 This finishes the change group by reverting all of its changes."
1247 (dolist (elt handle) 1247 (dolist (elt handle)
1248 (with-current-buffer (car elt) 1248 (with-current-buffer (car elt)
1249 (setq elt (cdr elt)) 1249 (setq elt (cdr elt))
1250 (let ((old-car 1250 (let ((old-car
1251 (if (consp elt) (car elt))) 1251 (if (consp elt) (car elt)))
1252 (old-cdr 1252 (old-cdr
1253 (if (consp elt) (cdr elt)))) 1253 (if (consp elt) (cdr elt))))
1254 ;; Temporarily truncate the undo log at ELT. 1254 ;; Temporarily truncate the undo log at ELT.
1255 (when (consp elt) 1255 (when (consp elt)
2170 ;; (with a one-char margin at each end) with `t nil'. 2170 ;; (with a one-char margin at each end) with `t nil'.
2171 ;; We opted for a larger overlay because it behaves better in the case 2171 ;; We opted for a larger overlay because it behaves better in the case
2172 ;; where the clone is reduced to the empty string (we want the overlay to 2172 ;; where the clone is reduced to the empty string (we want the overlay to
2173 ;; stay when the clone's content is the empty string and we want to use 2173 ;; stay when the clone's content is the empty string and we want to use
2174 ;; `evaporate' to make sure those overlays get deleted when needed). 2174 ;; `evaporate' to make sure those overlays get deleted when needed).
2175 ;; 2175 ;;
2176 (let* ((pt-end (+ (point) (- end start))) 2176 (let* ((pt-end (+ (point) (- end start)))
2177 (start-margin (if (or (not spreadp) (bobp) (<= start (point-min))) 2177 (start-margin (if (or (not spreadp) (bobp) (<= start (point-min)))
2178 0 1)) 2178 0 1))
2179 (end-margin (if (or (not spreadp) 2179 (end-margin (if (or (not spreadp)
2180 (>= pt-end (point-max)) 2180 (>= pt-end (point-max))
2187 (when spreadp (overlay-put ol1 'text-clone-spreadp t)) 2187 (when spreadp (overlay-put ol1 'text-clone-spreadp t))
2188 (when syntax (overlay-put ol1 'text-clone-syntax syntax)) 2188 (when syntax (overlay-put ol1 'text-clone-syntax syntax))
2189 ;;(overlay-put ol1 'face 'underline) 2189 ;;(overlay-put ol1 'face 'underline)
2190 (overlay-put ol1 'evaporate t) 2190 (overlay-put ol1 'evaporate t)
2191 (overlay-put ol1 'text-clones dups) 2191 (overlay-put ol1 'text-clones dups)
2192 ;; 2192 ;;
2193 (overlay-put ol2 'modification-hooks '(text-clone-maintain)) 2193 (overlay-put ol2 'modification-hooks '(text-clone-maintain))
2194 (when spreadp (overlay-put ol2 'text-clone-spreadp t)) 2194 (when spreadp (overlay-put ol2 'text-clone-spreadp t))
2195 (when syntax (overlay-put ol2 'text-clone-syntax syntax)) 2195 (when syntax (overlay-put ol2 'text-clone-syntax syntax))
2196 ;;(overlay-put ol2 'face 'underline) 2196 ;;(overlay-put ol2 'face 'underline)
2197 (overlay-put ol2 'evaporate t) 2197 (overlay-put ol2 'evaporate t)