aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2000-11-23 22:54:54 +0000
committerStefan Monnier2000-11-23 22:54:54 +0000
commit79372165fe5a1ba70dd74f0333141ce40d7829af (patch)
tree9ac7258fe94beb444d6632907a4bd858686e752b
parentd19249e73440f9908f79cf43bbf4f10dbe6e88cc (diff)
downloademacs-79372165fe5a1ba70dd74f0333141ce40d7829af.tar.gz
emacs-79372165fe5a1ba70dd74f0333141ce40d7829af.zip
(add-hook, remove-hook): Don't call make-local-hook
if the variable is make-variable-buffer-local.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/subr.el24
2 files changed, 19 insertions, 10 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d97542037ea..13f9a463000 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
12000-11-23 Stefan Monnier <monnier@cs.yale.edu> 12000-11-23 Stefan Monnier <monnier@cs.yale.edu>
2 2
3 * subr.el (add-hook, remove-hook): Don't call make-local-hook
4 if the variable is make-variable-buffer-local.
5
3 * progmodes/ada-stmt.el (ada-template-map): Initialize 6 * progmodes/ada-stmt.el (ada-template-map): Initialize
4 and bind it to C-c t in ada-mode-map. 7 and bind it to C-c t in ada-mode-map.
5 (ada-stmt-mode-hook): New function extracted from old code. 8 (ada-stmt-mode-hook): New function extracted from old code.
@@ -887,7 +890,7 @@
887 * complete.el (partial-completion-mode): Drop unneeded positional args. 890 * complete.el (partial-completion-mode): Drop unneeded positional args.
888 891
889 * info.el (Info-mode): 892 * info.el (Info-mode):
890 * comint.el (comint-mode): Don't both with make-local-hook. 893 * comint.el (comint-mode): Don't bother with make-local-hook.
891 894
892 * log-edit.el (log-edit-menu): New menu. 895 * log-edit.el (log-edit-menu): New menu.
893 896
diff --git a/lisp/subr.el b/lisp/subr.el
index 1c494d763eb..6e43d28a8c6 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -227,6 +227,15 @@ but optional second arg NODIGITS non-nil treats them like other chars."
227 (define-key map (char-to-string loop) 'digit-argument) 227 (define-key map (char-to-string loop) 'digit-argument)
228 (setq loop (1+ loop)))))) 228 (setq loop (1+ loop))))))
229 229
230(when (and (not (fboundp 'set-keymap-parents))
231 (fboundp 'make-composed-keymap))
232 (defun set-keymap-parents (map parents)
233 "Set MAP to inherit from PARENTS.
234PARENTS can be either nil or a keymap or a list of keymaps."
235 (set-keymap-parent map
236 (if (or (null parents) (keymapp parents)) parents
237 (make-composed-keymap parents)))))
238
230;Moved to keymap.c 239;Moved to keymap.c
231;(defun copy-keymap (keymap) 240;(defun copy-keymap (keymap)
232; "Return a copy of KEYMAP" 241; "Return a copy of KEYMAP"
@@ -697,6 +706,7 @@ Do not use `make-local-variable' to make a hook variable buffer-local."
697 (make-local-variable hook) 706 (make-local-variable hook)
698 (set hook (list t))) 707 (set hook (list t)))
699 hook) 708 hook)
709(make-obsolete 'make-local-hook "Not necessary any more." "21.1")
700 710
701(defun add-hook (hook function &optional append local) 711(defun add-hook (hook function &optional append local)
702 "Add to the value of HOOK the function FUNCTION. 712 "Add to the value of HOOK the function FUNCTION.
@@ -716,7 +726,7 @@ HOOK is void, it is first set to nil. If HOOK's value is a single
716function, it is changed to a list of functions." 726function, it is changed to a list of functions."
717 (or (boundp hook) (set hook nil)) 727 (or (boundp hook) (set hook nil))
718 (or (default-boundp hook) (set-default hook nil)) 728 (or (default-boundp hook) (set-default hook nil))
719 (if local (make-local-hook hook) 729 (if local (unless (local-variable-if-set-p hook) (make-local-hook hook))
720 ;; Detect the case where make-local-variable was used on a hook 730 ;; Detect the case where make-local-variable was used on a hook
721 ;; and do what we used to do. 731 ;; and do what we used to do.
722 (unless (and (consp (symbol-value hook)) (memq t (symbol-value hook))) 732 (unless (and (consp (symbol-value hook)) (memq t (symbol-value hook)))
@@ -747,7 +757,7 @@ To make a hook variable buffer-local, always use
747`make-local-hook', not `make-local-variable'." 757`make-local-hook', not `make-local-variable'."
748 (or (boundp hook) (set hook nil)) 758 (or (boundp hook) (set hook nil))
749 (or (default-boundp hook) (set-default hook nil)) 759 (or (default-boundp hook) (set-default hook nil))
750 (if local (make-local-hook hook) 760 (if local (unless (local-variable-if-set-p hook) (make-local-hook hook))
751 ;; Detect the case where make-local-variable was used on a hook 761 ;; Detect the case where make-local-variable was used on a hook
752 ;; and do what we used to do. 762 ;; and do what we used to do.
753 (unless (and (consp (symbol-value hook)) (memq t (symbol-value hook))) 763 (unless (and (consp (symbol-value hook)) (memq t (symbol-value hook)))
@@ -1245,13 +1255,9 @@ Modifies the match data; use `save-match-data' if necessary."
1245(defun subst-char-in-string (fromchar tochar string &optional inplace) 1255(defun subst-char-in-string (fromchar tochar string &optional inplace)
1246 "Replace FROMCHAR with TOCHAR in STRING each time it occurs. 1256 "Replace FROMCHAR with TOCHAR in STRING each time it occurs.
1247Unless optional argument INPLACE is non-nil, return a new string." 1257Unless optional argument INPLACE is non-nil, return a new string."
1248 (let ((i (length string)) 1258 (if inplace (error "bouh!"))
1249 (newstr (if inplace string (copy-sequence string)))) 1259 (mapconcat (lambda (c) (char-to-string (if (equal c fromchar) tochar c)))
1250 (while (> i 0) 1260 string ""))
1251 (setq i (1- i))
1252 (if (eq (aref newstr i) fromchar)
1253 (aset newstr i tochar)))
1254 newstr))
1255 1261
1256(defun replace-regexp-in-string (regexp rep string &optional 1262(defun replace-regexp-in-string (regexp rep string &optional
1257 fixedcase literal subexp start) 1263 fixedcase literal subexp start)