993 |
|
|
994 |
;; Global Highlight Changes mode is modeled after Global Font-lock mode. |
;; Global Highlight Changes mode is modeled after Global Font-lock mode. |
995 |
;; Three hooks are used to gain control. When Global Changes Mode is |
;; Three hooks are used to gain control. When Global Changes Mode is |
996 |
;; enabled, `find-file-hooks' and `change-major-mode-hook' are set. |
;; enabled, `find-file-hook' and `change-major-mode-hook' are set. |
997 |
;; `find-file-hooks' is called when visiting a file, the new mode is |
;; `find-file-hook' is called when visiting a file, the new mode is |
998 |
;; known at this time. |
;; known at this time. |
999 |
;; `change-major-mode-hook' is called when a buffer is changing mode. |
;; `change-major-mode-hook' is called when a buffer is changing mode. |
1000 |
;; This could be because of finding a file in which case |
;; This could be because of finding a file in which case |
1001 |
;; `find-file-hooks' has already been called and has done its work. |
;; `find-file-hook' has already been called and has done its work. |
1002 |
;; However, it also catches the case where a new mode is being set by |
;; However, it also catches the case where a new mode is being set by |
1003 |
;; the user. However, it is called from `kill-all-variables' and at |
;; the user. However, it is called from `kill-all-variables' and at |
1004 |
;; this time the mode is the old mode, which is not what we want. |
;; this time the mode is the old mode, which is not what we want. |
1080 |
(setq global-highlight-changes t) |
(setq global-highlight-changes t) |
1081 |
(message "Turning ON Global Highlight Changes mode in %s state" |
(message "Turning ON Global Highlight Changes mode in %s state" |
1082 |
highlight-changes-global-initial-state) |
highlight-changes-global-initial-state) |
1083 |
(add-hook 'hilit-chg-major-mode-hook 'hilit-chg-major-mode-hook) |
;; FIXME: Not sure what this was intended to do. --Stef |
1084 |
(add-hook 'find-file-hooks 'hilit-chg-check-global) |
;; (add-hook 'hilit-chg-major-mode-hook 'hilit-chg-major-mode-hook) |
1085 |
|
(add-hook 'find-file-hook 'hilit-chg-check-global) |
1086 |
(if highlight-changes-global-changes-existing-buffers |
(if highlight-changes-global-changes-existing-buffers |
1087 |
(hilit-chg-update-all-buffers |
(hilit-chg-update-all-buffers |
1088 |
highlight-changes-global-initial-state))) |
highlight-changes-global-initial-state))) |
1089 |
|
|
1090 |
(message "Turning OFF global Highlight Changes mode") |
(message "Turning OFF global Highlight Changes mode") |
1091 |
(remove-hook 'hilit-chg-major-mode-hook 'hilit-chg-major-mode-hook) |
;; FIXME: Not sure what this was intended to do. --Stef |
1092 |
(remove-hook 'find-file-hooks 'hilit-chg-check-global) |
;; (remove-hook 'hilit-chg-major-mode-hook 'hilit-chg-major-mode-hook) |
1093 |
(remove-hook 'post-command-hook |
(remove-hook 'post-command-hook 'hilit-chg-post-command-hook) |
1094 |
'hilit-chg-post-command-hook) |
(remove-hook 'find-file-hook 'hilit-chg-check-global) |
|
(remove-hook 'find-file-hooks 'hilit-chg-check-global) |
|
1095 |
(if highlight-changes-global-changes-existing-buffers |
(if highlight-changes-global-changes-existing-buffers |
1096 |
(hilit-chg-update-all-buffers nil)))) |
(hilit-chg-update-all-buffers nil)))) |
1097 |
|
|