884 |
list of hooks to run in HOOK, then nothing is done. See `add-hook'. |
list of hooks to run in HOOK, then nothing is done. See `add-hook'. |
885 |
|
|
886 |
The optional third argument, LOCAL, if non-nil, says to modify |
The optional third argument, LOCAL, if non-nil, says to modify |
887 |
the hook's buffer-local value rather than its default value. |
the hook's buffer-local value rather than its default value." |
|
This makes the hook buffer-local if needed." |
|
888 |
(or (boundp hook) (set hook nil)) |
(or (boundp hook) (set hook nil)) |
889 |
(or (default-boundp hook) (set-default hook nil)) |
(or (default-boundp hook) (set-default hook nil)) |
890 |
(if local (unless (local-variable-if-set-p hook) |
;; Do nothing if LOCAL is t but this hook has no local binding. |
891 |
(set (make-local-variable hook) (list t))) |
(unless (and local (not (local-variable-p hook))) |
892 |
;; Detect the case where make-local-variable was used on a hook |
;; Detect the case where make-local-variable was used on a hook |
893 |
;; and do what we used to do. |
;; and do what we used to do. |
894 |
(unless (and (consp (symbol-value hook)) (memq t (symbol-value hook))) |
(when (and (local-variable-p hook) |
895 |
(setq local t))) |
(not (and (consp (symbol-value hook)) |
896 |
(let ((hook-value (if local (symbol-value hook) (default-value hook)))) |
(memq t (symbol-value hook))))) |
897 |
;; Remove the function, for both the list and the non-list cases. |
(setq local t)) |
898 |
(if (or (not (listp hook-value)) (eq (car hook-value) 'lambda)) |
(let ((hook-value (if local (symbol-value hook) (default-value hook)))) |
899 |
(if (equal hook-value function) (setq hook-value nil)) |
;; Remove the function, for both the list and the non-list cases. |
900 |
(setq hook-value (delete function (copy-sequence hook-value)))) |
(if (or (not (listp hook-value)) (eq (car hook-value) 'lambda)) |
901 |
;; If the function is on the global hook, we need to shadow it locally |
(if (equal hook-value function) (setq hook-value nil)) |
902 |
;;(when (and local (member function (default-value hook)) |
(setq hook-value (delete function (copy-sequence hook-value)))) |
903 |
;; (not (member (cons 'not function) hook-value))) |
;; If the function is on the global hook, we need to shadow it locally |
904 |
;; (push (cons 'not function) hook-value)) |
;;(when (and local (member function (default-value hook)) |
905 |
;; Set the actual variable |
;; (not (member (cons 'not function) hook-value))) |
906 |
(if (not local) |
;; (push (cons 'not function) hook-value)) |
907 |
(set-default hook hook-value) |
;; Set the actual variable |
908 |
(if (equal hook-value '(t)) |
(if (not local) |
909 |
(kill-local-variable hook) |
(set-default hook hook-value) |
910 |
(set hook hook-value))))) |
(if (equal hook-value '(t)) |
911 |
|
(kill-local-variable hook) |
912 |
|
(set hook hook-value)))))) |
913 |
|
|
914 |
(defun add-to-list (list-var element &optional append) |
(defun add-to-list (list-var element &optional append) |
915 |
"Add to the value of LIST-VAR the element ELEMENT if it isn't there yet. |
"Add to the value of LIST-VAR the element ELEMENT if it isn't there yet. |
1328 |
(defalias 'redraw-modeline 'force-mode-line-update) |
(defalias 'redraw-modeline 'force-mode-line-update) |
1329 |
|
|
1330 |
(defun force-mode-line-update (&optional all) |
(defun force-mode-line-update (&optional all) |
1331 |
"Force the mode line of the current buffer to be redisplayed. |
"Force redisplay of the current buffer's mode line and header line. |
1332 |
With optional non-nil ALL, force redisplay of all mode lines." |
With optional non-nil ALL, force redisplay of all mode lines and |
1333 |
|
header lines. This function also forces recomputation of the |
1334 |
|
menu bar menus and the frame title." |
1335 |
(if all (save-excursion (set-buffer (other-buffer)))) |
(if all (save-excursion (set-buffer (other-buffer)))) |
1336 |
(set-buffer-modified-p (buffer-modified-p))) |
(set-buffer-modified-p (buffer-modified-p))) |
1337 |
|
|
2219 |
;; isearch-mode is deliberately excluded, since you should |
;; isearch-mode is deliberately excluded, since you should |
2220 |
;; not call it yourself. |
;; not call it yourself. |
2221 |
(defvar minor-mode-list '(auto-save-mode auto-fill-mode abbrev-mode |
(defvar minor-mode-list '(auto-save-mode auto-fill-mode abbrev-mode |
2222 |
overwrite-mode view-mode) |
overwrite-mode view-mode |
2223 |
|
hs-minor-mode) |
2224 |
"List of all minor mode functions.") |
"List of all minor mode functions.") |
2225 |
|
|
2226 |
(defun add-minor-mode (toggle name &optional keymap after toggle-fun) |
(defun add-minor-mode (toggle name &optional keymap after toggle-fun) |