[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/hilit-chg.el
From: |
Miles Bader |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/hilit-chg.el |
Date: |
Fri, 04 Apr 2003 01:22:18 -0500 |
Index: emacs/lisp/hilit-chg.el
diff -c emacs/lisp/hilit-chg.el:1.22 emacs/lisp/hilit-chg.el:1.23
*** emacs/lisp/hilit-chg.el:1.22 Fri Sep 6 03:15:11 2002
--- emacs/lisp/hilit-chg.el Tue Feb 4 06:24:03 2003
***************
*** 36,42 ****
;; Highlight Changes mode in passive state while you make your changes, toggle
;; it on to active mode to see them, then toggle it back off to avoid
;; distraction.
! ;;
;; When active, changes are displayed in `highlight-changes-face'. When
;; text is deleted, the following character is displayed in
;; `highlight-changes-delete-face' face.
--- 36,42 ----
;; Highlight Changes mode in passive state while you make your changes, toggle
;; it on to active mode to see them, then toggle it back off to avoid
;; distraction.
! ;;
;; When active, changes are displayed in `highlight-changes-face'. When
;; text is deleted, the following character is displayed in
;; `highlight-changes-delete-face' face.
***************
*** 75,92 ****
;; modes. The variable
;; `highlight-changes-mode' contains the new
;; state (`active' or `passive'.)
- ;;
;;
! ;;
;; Example usage:
;; (defun my-highlight-changes-enable-hook ()
;; (add-hook 'local-write-file-hooks 'highlight-changes-rotate-faces)
;; )
! ;;
;; (defun my-highlight-changes-disable-hook ()
;; (remove-hook 'local-write-file-hooks 'highlight-changes-rotate-faces)
;; )
! ;;
;; (add-hook 'highlight-changes-enable-hook 'my-highlight-changes-enable-hook)
;; (add-hook 'highlight-changes-disable-hook
;; 'my-highlight-changes-disable-hook)
--- 75,92 ----
;; modes. The variable
;; `highlight-changes-mode' contains the new
;; state (`active' or `passive'.)
;;
! ;;
! ;;
;; Example usage:
;; (defun my-highlight-changes-enable-hook ()
;; (add-hook 'local-write-file-hooks 'highlight-changes-rotate-faces)
;; )
! ;;
;; (defun my-highlight-changes-disable-hook ()
;; (remove-hook 'local-write-file-hooks 'highlight-changes-rotate-faces)
;; )
! ;;
;; (add-hook 'highlight-changes-enable-hook 'my-highlight-changes-enable-hook)
;; (add-hook 'highlight-changes-disable-hook
;; 'my-highlight-changes-disable-hook)
***************
*** 99,127 ****
;;
;; If you prefer to have it automatically invoked you can do it as
;; follows.
! ;;
;; 1. Most modes have a major-hook, typically called MODE-hook. You
! ;; can use `add-hook' to call `highlight-changes-mode'.
;;
;; Example:
;; (add-hook 'c-mode-hook 'highlight-changes-mode)
;;
;; If you want to make it start up in passive mode (regardless of the
;; setting of highlight-changes-initial-state):
! ;; (add-hook 'emacs-lisp-mode-hook
;; (lambda ()
;; (highlight-changes-mode 'passive)))
;;
;; However, this cannot be done for Fundamental mode for there is no
;; such hook.
;;
! ;; 2. You can use the function `global-highlight-changes'
;;
;; This function, which is fashioned after the way `global-font-lock' works,
;; toggles on or off global Highlight Changes mode. When activated, it turns
;; on Highlight Changes mode in all "suitable" existing buffers and will turn
;; it on in new "suitable" buffers to be created.
! ;;
;; A buffer's "suitability" is determined by variable
;; `highlight-changes-global-modes', as follows. If the variable is
;; * nil -- then no buffers are suitable;
--- 99,127 ----
;;
;; If you prefer to have it automatically invoked you can do it as
;; follows.
! ;;
;; 1. Most modes have a major-hook, typically called MODE-hook. You
! ;; can use `add-hook' to call `highlight-changes-mode'.
;;
;; Example:
;; (add-hook 'c-mode-hook 'highlight-changes-mode)
;;
;; If you want to make it start up in passive mode (regardless of the
;; setting of highlight-changes-initial-state):
! ;; (add-hook 'emacs-lisp-mode-hook
;; (lambda ()
;; (highlight-changes-mode 'passive)))
;;
;; However, this cannot be done for Fundamental mode for there is no
;; such hook.
;;
! ;; 2. You can use the function `global-highlight-changes'
;;
;; This function, which is fashioned after the way `global-font-lock' works,
;; toggles on or off global Highlight Changes mode. When activated, it turns
;; on Highlight Changes mode in all "suitable" existing buffers and will turn
;; it on in new "suitable" buffers to be created.
! ;;
;; A buffer's "suitability" is determined by variable
;; `highlight-changes-global-modes', as follows. If the variable is
;; * nil -- then no buffers are suitable;
***************
*** 148,154 ****
;; highlight-changes-rotate-faces
;; highlight-compare-with-file
! ;;
;; You can automatically rotate faces when the buffer is saved;
;; see function `highlight-changes-rotate-faces' for how to do this.
;;
--- 148,154 ----
;; highlight-changes-rotate-faces
;; highlight-compare-with-file
! ;;
;; You can automatically rotate faces when the buffer is saved;
;; see function `highlight-changes-rotate-faces' for how to do this.
;;
***************
*** 177,183 ****
;; R Sharman (address@hidden) Feb 1998:
;; - initial release as change-mode.
;; Jari Aalto <address@hidden> Mar 1998
! ;; - fixes for byte compile errors
;; - use eval-and-compile for autoload
;; Marijn Ros <address@hidden> Mar 98
;; - suggested turning it on by default
--- 177,183 ----
;; R Sharman (address@hidden) Feb 1998:
;; - initial release as change-mode.
;; Jari Aalto <address@hidden> Mar 1998
! ;; - fixes for byte compile errors
;; - use eval-and-compile for autoload
;; Marijn Ros <address@hidden> Mar 98
;; - suggested turning it on by default
***************
*** 225,231 ****
;; A (not very good) default list of colours to rotate through.
;;
! (defcustom highlight-changes-colours
(if (eq (frame-parameter nil 'background-mode) 'light)
;; defaults for light background:
'( "magenta" "blue" "darkgreen" "chocolate" "sienna4" "NavyBlue")
--- 225,231 ----
;; A (not very good) default list of colours to rotate through.
;;
! (defcustom highlight-changes-colours
(if (eq (frame-parameter nil 'background-mode) 'light)
;; defaults for light background:
'( "magenta" "blue" "darkgreen" "chocolate" "sienna4" "NavyBlue")
***************
*** 241,247 ****
`highlight-changes-face-list'."
:type '(repeat color)
:group 'highlight-changes)
!
;; If you invoke highlight-changes-mode with no argument, should it start in
;; active or passive mode?
--- 241,247 ----
`highlight-changes-face-list'."
:type '(repeat color)
:group 'highlight-changes)
!
;; If you invoke highlight-changes-mode with no argument, should it start in
;; active or passive mode?
***************
*** 299,305 ****
(c-mode c++-mode)
means that Highlight Changes mode is turned on for buffers in C and C++
modes only."
! :type '(choice
(const :tag "all non-special buffers visiting files" t)
(set :menu-tag "specific modes" :tag "modes"
:value (not)
--- 299,305 ----
(c-mode c++-mode)
means that Highlight Changes mode is turned on for buffers in C and C++
modes only."
! :type '(choice
(const :tag "all non-special buffers visiting files" t)
(set :menu-tag "specific modes" :tag "modes"
:value (not)
***************
*** 377,383 ****
Otherwise, this list will be constructed when needed from
`highlight-changes-colours'."
:type '(choice
! (repeat
:notify hilit-chg-cust-fix-changes-face-list
face )
(const :tag "Derive from highlight-changes-colours" nil)
--- 377,383 ----
Otherwise, this list will be constructed when needed from
`highlight-changes-colours'."
:type '(choice
! (repeat
:notify hilit-chg-cust-fix-changes-face-list
face )
(const :tag "Derive from highlight-changes-colours" nil)
***************
*** 513,527 ****
(hilit-chg-display-changes beg end)))
;;;###autoload
! (defun highlight-changes-remove-highlight (beg end)
! "Remove the change face from the region between BEG and END.
This allows you to manually remove highlighting from uninteresting changes."
(interactive "r")
(let ((after-change-functions nil))
(remove-text-properties beg end '(hilit-chg nil))
(hilit-chg-fixup beg end)))
! (defun hilit-chg-set-face-on-change (beg end leng-before
&optional no-property-change)
"Record changes and optionally display them in a distinctive face.
`hilit-chg-set' adds this function to the `after-change-functions' hook."
--- 513,527 ----
(hilit-chg-display-changes beg end)))
;;;###autoload
! (defun highlight-changes-remove-highlight (beg end)
! "Remove the change face from the region between BEG and END.
This allows you to manually remove highlighting from uninteresting changes."
(interactive "r")
(let ((after-change-functions nil))
(remove-text-properties beg end '(hilit-chg nil))
(hilit-chg-fixup beg end)))
! (defun hilit-chg-set-face-on-change (beg end leng-before
&optional no-property-change)
"Record changes and optionally display them in a distinctive face.
`hilit-chg-set' adds this function to the `after-change-functions' hook."
***************
*** 544,550 ****
;; deletion
(progn
;; The eolp and bolp tests are a kludge! But they prevent
! ;; rather nasty looking displays when deleting text at the end
;; of line, such as normal corrections as one is typing and
;; immediately makes a correction, and when deleting first
;; character of a line.
--- 544,550 ----
;; deletion
(progn
;; The eolp and bolp tests are a kludge! But they prevent
! ;; rather nasty looking displays when deleting text at the end
;; of line, such as normal corrections as one is typing and
;; immediately makes a correction, and when deleting first
;; character of a line.
***************
*** 601,607 ****
(remove-hook 'after-change-functions 'hilit-chg-set-face-on-change t)
(let ((after-change-functions nil))
(hilit-chg-hide-changes)
! (hilit-chg-map-changes
'(lambda (prop start stop)
(remove-text-properties start stop '(hilit-chg nil))))
)
--- 601,607 ----
(remove-hook 'after-change-functions 'hilit-chg-set-face-on-change t)
(let ((after-change-functions nil))
(hilit-chg-hide-changes)
! (hilit-chg-map-changes
'(lambda (prop start stop)
(remove-text-properties start stop '(hilit-chg nil))))
)
***************
*** 616,622 ****
(defun highlight-changes-mode (&optional arg)
"Toggle (or initially set) Highlight Changes mode.
! Without an argument:
If Highlight Changes mode is not enabled, then enable it (in either active
or passive state as determined by the variable
`highlight-changes-initial-state'); otherwise, toggle between active
--- 616,622 ----
(defun highlight-changes-mode (&optional arg)
"Toggle (or initially set) Highlight Changes mode.
! Without an argument:
If Highlight Changes mode is not enabled, then enable it (in either active
or passive state as determined by the variable
`highlight-changes-initial-state'); otherwise, toggle between active
***************
*** 633,644 ****
Functions:
\\[highlight-changes-next-change] - move point to beginning of next change
! \\[highlight-changes-previous-change] - move to beginning of previous change
\\[highlight-compare-with-file] - mark text as changed by comparing this
buffer with the contents of a file
\\[highlight-changes-remove-highlight] - remove the change face from the
region
\\[highlight-changes-rotate-faces] - rotate different \"ages\" of changes \
! through
various faces.
Hook variables:
--- 633,644 ----
Functions:
\\[highlight-changes-next-change] - move point to beginning of next change
! \\[highlight-changes-previous-change] - move to beginning of previous change
\\[highlight-compare-with-file] - mark text as changed by comparing this
buffer with the contents of a file
\\[highlight-changes-remove-highlight] - remove the change face from the
region
\\[highlight-changes-rotate-faces] - rotate different \"ages\" of changes \
! through
various faces.
Hook variables:
***************
*** 732,751 ****
;; so we pick up any changes?
(if (or (null highlight-changes-face-list) ; Don't do it if it
force) ; already exists unless FORCE non-nil.
! (let ((p highlight-changes-colours)
(n 1) name)
(setq highlight-changes-face-list nil)
(while p
(setq name (intern (format "highlight-changes-face-%d" n)))
(copy-face 'highlight-changes-face name)
(set-face-foreground name (car p))
! (setq highlight-changes-face-list
(append highlight-changes-face-list (list name)))
(setq p (cdr p))
(setq n (1+ n)))))
(setq hilit-chg-list (list 'hilit-chg 'highlight-changes-face))
(let ((p highlight-changes-face-list)
! (n 1)
last-category last-face)
(while p
(setq last-category (intern (format "change-%d" n)))
--- 732,751 ----
;; so we pick up any changes?
(if (or (null highlight-changes-face-list) ; Don't do it if it
force) ; already exists unless FORCE non-nil.
! (let ((p highlight-changes-colours)
(n 1) name)
(setq highlight-changes-face-list nil)
(while p
(setq name (intern (format "highlight-changes-face-%d" n)))
(copy-face 'highlight-changes-face name)
(set-face-foreground name (car p))
! (setq highlight-changes-face-list
(append highlight-changes-face-list (list name)))
(setq p (cdr p))
(setq n (1+ n)))))
(setq hilit-chg-list (list 'hilit-chg 'highlight-changes-face))
(let ((p highlight-changes-face-list)
! (n 1)
last-category last-face)
(while p
(setq last-category (intern (format "change-%d" n)))
***************
*** 829,835 ****
"" ;; directory
nil ;; default
'yes ;; must exist
! (let ((f (make-backup-file-name
(or (buffer-file-name (current-buffer))
(error "no file for this buffer")))))
(if (file-exists-p f) f "")))))
--- 829,835 ----
"" ;; directory
nil ;; default
'yes ;; must exist
! (let ((f (make-backup-file-name
(or (buffer-file-name (current-buffer))
(error "no file for this buffer")))))
(if (file-exists-p f) f "")))))
***************
*** 885,891 ****
(setq p (cdr p))
(setq q (cdr q)))
(if existing-buf
! (set-buffer-modified-p nil)
(kill-buffer buf-b))))
--- 885,891 ----
(setq p (cdr p))
(setq q (cdr q)))
(if existing-buf
! (set-buffer-modified-p nil)
(kill-buffer buf-b))))
***************
*** 901,907 ****
(defun hilit-chg-get-diff-list-hk ()
! ;; x and y are dynamically bound by hilit-chg-get-diff-info
;; which calls this function as a hook
(defvar x) ;; placate the byte-compiler
(defvar y)
--- 901,907 ----
(defun hilit-chg-get-diff-list-hk ()
! ;; x and y are dynamically bound by hilit-chg-get-diff-info
;; which calls this function as a hook
(defvar x) ;; placate the byte-compiler
(defvar y)
***************
*** 971,982 ****
;; This is called after changing a major mode, but also after each
;; M-x command, in which case the current buffer is a minibuffer.
;; In that case, do not act on it here, but don't turn it off
! ;; either, we will get called here again soon-after.
;; Also, don't enable it for other special buffers.
(if (string-match "^[ *]" (buffer-name))
nil ;; (message "ignoring this post-command-hook")
(remove-hook 'post-command-hook 'hilit-chg-post-command-hook)
! ;; The following check isn't necessary, since
;; hilit-chg-turn-on-maybe makes this check too.
(or highlight-changes-mode ;; don't turn it on if it already is
(hilit-chg-turn-on-maybe highlight-changes-global-initial-state))))
--- 971,982 ----
;; This is called after changing a major mode, but also after each
;; M-x command, in which case the current buffer is a minibuffer.
;; In that case, do not act on it here, but don't turn it off
! ;; either, we will get called here again soon-after.
;; Also, don't enable it for other special buffers.
(if (string-match "^[ *]" (buffer-name))
nil ;; (message "ignoring this post-command-hook")
(remove-hook 'post-command-hook 'hilit-chg-post-command-hook)
! ;; The following check isn't necessary, since
;; hilit-chg-turn-on-maybe makes this check too.
(or highlight-changes-mode ;; don't turn it on if it already is
(hilit-chg-turn-on-maybe highlight-changes-global-initial-state))))
***************
*** 1000,1013 ****
- if ARG is nil or omitted, turn it off
- if ARG is `active', turn it on in active mode
- if ARG is `passive', turn it on in passive mode
! - otherwise just turn it on
When global Highlight Changes mode is enabled, Highlight Changes mode is
turned
on for future \"suitable\" buffers (and for \"suitable\" existing buffers if
variable `highlight-changes-global-changes-existing-buffers' is non-nil).
\"Suitability\" is determined by variable `highlight-changes-global-modes'."
! (interactive
(list
(cond
((null current-prefix-arg)
--- 1000,1013 ----
- if ARG is nil or omitted, turn it off
- if ARG is `active', turn it on in active mode
- if ARG is `passive', turn it on in passive mode
! - otherwise just turn it on
When global Highlight Changes mode is enabled, Highlight Changes mode is
turned
on for future \"suitable\" buffers (and for \"suitable\" existing buffers if
variable `highlight-changes-global-changes-existing-buffers' is non-nil).
\"Suitability\" is determined by variable `highlight-changes-global-modes'."
! (interactive
(list
(cond
((null current-prefix-arg)
***************
*** 1023,1029 ****
'passive)
;; negative interactive arg - turn it off
(t
! (setq global-highlight-changes nil)
nil))))
(if arg
--- 1023,1029 ----
'passive)
;; negative interactive arg - turn it off
(t
! (setq global-highlight-changes nil)
nil))))
(if arg
***************
*** 1038,1046 ****
(add-hook 'hilit-chg-major-mode-hook 'hilit-chg-major-mode-hook)
(add-hook 'find-file-hooks 'hilit-chg-check-global)
(if highlight-changes-global-changes-existing-buffers
! (hilit-chg-update-all-buffers
highlight-changes-global-initial-state)))
!
(message "Turning OFF global Highlight Changes mode")
(remove-hook 'hilit-chg-major-mode-hook 'hilit-chg-major-mode-hook)
(remove-hook 'find-file-hooks 'hilit-chg-check-global)
--- 1038,1046 ----
(add-hook 'hilit-chg-major-mode-hook 'hilit-chg-major-mode-hook)
(add-hook 'find-file-hooks 'hilit-chg-check-global)
(if highlight-changes-global-changes-existing-buffers
! (hilit-chg-update-all-buffers
highlight-changes-global-initial-state)))
!
(message "Turning OFF global Highlight Changes mode")
(remove-hook 'hilit-chg-major-mode-hook 'hilit-chg-major-mode-hook)
(remove-hook 'find-file-hooks 'hilit-chg-check-global)
***************
*** 1055,1067 ****
"Turn on Highlight Changes mode if it is appropriate for this buffer.
A buffer is appropriate for Highlight Changes mode if all these are true:
! - the buffer is not a special buffer (one whose name begins with
`*' or ` ')
- the buffer's mode is suitable as per variable
`highlight-changes-global-modes'
- Highlight Changes mode is not already on for this buffer.
! This function is called from `hilit-chg-update-all-buffers' or
from `global-highlight-changes' when turning on global Highlight Changes
mode."
(or highlight-changes-mode ; do nothing if already on
(if
--- 1055,1067 ----
"Turn on Highlight Changes mode if it is appropriate for this buffer.
A buffer is appropriate for Highlight Changes mode if all these are true:
! - the buffer is not a special buffer (one whose name begins with
`*' or ` ')
- the buffer's mode is suitable as per variable
`highlight-changes-global-modes'
- Highlight Changes mode is not already on for this buffer.
! This function is called from `hilit-chg-update-all-buffers' or
from `global-highlight-changes' when turning on global Highlight Changes
mode."
(or highlight-changes-mode ; do nothing if already on
(if
***************
*** 1075,1087 ****
(not (memq major-mode (cdr highlight-changes-global-modes)))
(memq major-mode highlight-changes-global-modes)))
(t
! (and
(not (string-match "^[ *]" (buffer-name)))
(buffer-file-name))))
(progn
(hilit-chg-set value)
(run-hooks 'highlight-changes-enable-hook)))))
!
(defun hilit-chg-turn-off-maybe ()
(if highlight-changes-mode
--- 1075,1087 ----
(not (memq major-mode (cdr highlight-changes-global-modes)))
(memq major-mode highlight-changes-global-modes)))
(t
! (and
(not (string-match "^[ *]" (buffer-name)))
(buffer-file-name))))
(progn
(hilit-chg-set value)
(run-hooks 'highlight-changes-enable-hook)))))
!
(defun hilit-chg-turn-off-maybe ()
(if highlight-changes-mode
***************
*** 1111,1117 ****
;; )
;; beg end
;; ))
! ;;
;; ================== end of debug ===============
(provide 'hilit-chg)
--- 1111,1117 ----
;; )
;; beg end
;; ))
! ;;
;; ================== end of debug ===============
(provide 'hilit-chg)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] Changes to emacs/lisp/hilit-chg.el,
Miles Bader <=