aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Roberts2005-05-01 04:44:14 +0000
committerNick Roberts2005-05-01 04:44:14 +0000
commit77cd926d9b03abf60a7934564fff9a0230cafeef (patch)
tree235e5d7cd3e6d14da863cfd816e92a9ac4ac7a6e
parentbdf7ae415d437f7a35b19b6065d6a379428d3d76 (diff)
downloademacs-77cd926d9b03abf60a7934564fff9a0230cafeef.tar.gz
emacs-77cd926d9b03abf60a7934564fff9a0230cafeef.zip
(string-to-int): Make obsolete.
-rw-r--r--lisp/subr.el47
1 files changed, 30 insertions, 17 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index d4210e562cd..b8d2ca6c054 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -349,14 +349,10 @@ but optional second arg NODIGITS non-nil treats them like other chars."
349(defvar key-substitution-in-progress nil 349(defvar key-substitution-in-progress nil
350 "Used internally by substitute-key-definition.") 350 "Used internally by substitute-key-definition.")
351 351
352(defun substitute-key-definition (olddef newdef keymap &optional oldmap prefix) 352(defun substitute-key-definitions (subst keymap &optional oldmap prefix)
353 "Replace OLDDEF with NEWDEF for any keys in KEYMAP now defined as OLDDEF. 353 "Applies the SUBST remapping to key bindings in KEYMAP.
354In other words, OLDDEF is replaced with NEWDEF where ever it appears. 354SUBST will be a list of elements of the form (OLDDEF . NEWDEF).
355Alternatively, if optional fourth argument OLDMAP is specified, we redefine 355See `substitue-key-definition'."
356in KEYMAP as NEWDEF those keys which are defined as OLDDEF in OLDMAP.
357
358For most uses, it is simpler and safer to use command remappping like this:
359 \(define-key KEYMAP [remap OLDDEF] NEWDEF)"
360 ;; Don't document PREFIX in the doc string because we don't want to 356 ;; Don't document PREFIX in the doc string because we don't want to
361 ;; advertise it. It's meant for recursive calls only. Here's its 357 ;; advertise it. It's meant for recursive calls only. Here's its
362 ;; meaning 358 ;; meaning
@@ -374,11 +370,28 @@ For most uses, it is simpler and safer to use command remappping like this:
374 (map-keymap 370 (map-keymap
375 (lambda (char defn) 371 (lambda (char defn)
376 (aset prefix1 (length prefix) char) 372 (aset prefix1 (length prefix) char)
377 (substitute-key-definition-key defn olddef newdef prefix1 keymap)) 373 (substitute-key-definitions-key defn subst prefix1 keymap))
378 scan))) 374 scan)))
379 375
380(defun substitute-key-definition-key (defn olddef newdef prefix keymap) 376(defun substitute-key-definition (olddef newdef keymap &optional oldmap prefix)
381 (let (inner-def skipped menu-item) 377 "Replace OLDDEF with NEWDEF for any keys in KEYMAP now defined as OLDDEF.
378In other words, OLDDEF is replaced with NEWDEF where ever it appears.
379Alternatively, if optional fourth argument OLDMAP is specified, we redefine
380in KEYMAP as NEWDEF those keys which are defined as OLDDEF in OLDMAP.
381
382For most uses, it is simpler and safer to use command remappping like this:
383 \(define-key KEYMAP [remap OLDDEF] NEWDEF)"
384 ;; Don't document PREFIX in the doc string because we don't want to
385 ;; advertise it. It's meant for recursive calls only. Here's its
386 ;; meaning
387
388 ;; If optional argument PREFIX is specified, it should be a key
389 ;; prefix, a string. Redefined bindings will then be bound to the
390 ;; original key, with PREFIX added at the front.
391 (substitute-key-definitions (list (cons olddef newdef)) keymap oldmap prefix))
392
393(defun substitute-key-definitions-key (defn subst prefix keymap)
394 (let (inner-def skipped menu-item mapping)
382 ;; Find the actual command name within the binding. 395 ;; Find the actual command name within the binding.
383 (if (eq (car-safe defn) 'menu-item) 396 (if (eq (car-safe defn) 'menu-item)
384 (setq menu-item defn defn (nth 2 defn)) 397 (setq menu-item defn defn (nth 2 defn))
@@ -388,17 +401,17 @@ For most uses, it is simpler and safer to use command remappping like this:
388 ;; Skip past cached key-equivalence data for menu items. 401 ;; Skip past cached key-equivalence data for menu items.
389 (if (consp (car-safe defn)) 402 (if (consp (car-safe defn))
390 (setq defn (cdr defn)))) 403 (setq defn (cdr defn))))
391 (if (or (eq defn olddef) 404 (if (or (setq mapping (assq defn subst))
392 ;; Compare with equal if definition is a key sequence. 405 ;; Compare with equal if definition is a key sequence.
393 ;; That is useful for operating on function-key-map. 406 ;; That is useful for operating on function-key-map.
394 (and (or (stringp defn) (vectorp defn)) 407 (and (or (stringp defn) (vectorp defn))
395 (equal defn olddef))) 408 (setq mapping (assoc defn subst))))
396 (define-key keymap prefix 409 (define-key keymap prefix
397 (if menu-item 410 (if menu-item
398 (let ((copy (copy-sequence menu-item))) 411 (let ((copy (copy-sequence menu-item)))
399 (setcar (nthcdr 2 copy) newdef) 412 (setcar (nthcdr 2 copy) (cdr mapping))
400 copy) 413 copy)
401 (nconc (nreverse skipped) newdef))) 414 (nconc (nreverse skipped) (cdr mapping))))
402 ;; Look past a symbol that names a keymap. 415 ;; Look past a symbol that names a keymap.
403 (setq inner-def 416 (setq inner-def
404 (and defn 417 (and defn
@@ -414,7 +427,7 @@ For most uses, it is simpler and safer to use command remappping like this:
414 ;; Avoid recursively rescanning keymap being scanned. 427 ;; Avoid recursively rescanning keymap being scanned.
415 (not (memq inner-def key-substitution-in-progress))) 428 (not (memq inner-def key-substitution-in-progress)))
416 ;; If this one isn't being scanned already, scan it now. 429 ;; If this one isn't being scanned already, scan it now.
417 (substitute-key-definition olddef newdef keymap inner-def prefix))))) 430 (substitute-key-definitions subst keymap inner-def prefix)))))
418 431
419(defun define-key-after (keymap key definition &optional after) 432(defun define-key-after (keymap key definition &optional after)
420 "Add binding in KEYMAP for KEY => DEFINITION, right after AFTER's binding. 433 "Add binding in KEYMAP for KEY => DEFINITION, right after AFTER's binding.
@@ -843,7 +856,7 @@ is converted into a string by expressing it in decimal."
843 856
844;;; Should this be an obsolete name? If you decide it should, you get 857;;; Should this be an obsolete name? If you decide it should, you get
845;;; to go through all the sources and change them. 858;;; to go through all the sources and change them.
846(defalias 'string-to-int 'string-to-number) 859(define-obsolete-function-alias 'string-to-int 'string-to-number)
847 860
848;;;; Hook manipulation functions. 861;;;; Hook manipulation functions.
849 862