]> git.eshelyaron.com Git - emacs.git/commitdiff
(whitespace-highlight-the-space): Put the same overlay
authorStefan Monnier <monnier@iro.umontreal.ca>
Fri, 8 Apr 2005 14:40:57 +0000 (14:40 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Fri, 8 Apr 2005 14:40:57 +0000 (14:40 +0000)
in the buffer and in whitespace-highlighted-space.
(whitespace-unhighlight-the-space): Simplify.
(whitespace-buffer): Simplify.

lisp/ChangeLog
lisp/whitespace.el

index 656c03c7d32f49c17ce0d678cff7dbbf34fa9f85..4d94a867bbbbe44a5e407af985351c396ebdea6a 100644 (file)
@@ -1,3 +1,10 @@
+2005-04-08  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * whitespace.el (whitespace-highlight-the-space): Put the same overlay
+       in the buffer and in whitespace-highlighted-space.
+       (whitespace-unhighlight-the-space): Simplify.
+       (whitespace-buffer): Simplify.
+
 2005-04-08  Dan Nicolaescu  <dann@ics.uci.edu>
 
        * textmodes/table.el (table-cell-face): Add special case for
        (vhdl-speedbar-architecture-face)
        (vhdl-speedbar-instantiation-face)
        (vhdl-speedbar-architecture-selected-face)
-       (vhdl-speedbar-instantiation-selected-face): Likewise. 
-       * progmodes/sh-script.el (sh-heredoc-face): Likewise. 
-       * progmodes/idlw-help.el (idlwave-help-link-face): Likewise. 
+       (vhdl-speedbar-instantiation-selected-face): Likewise.
+       * progmodes/sh-script.el (sh-heredoc-face): Likewise.
+       * progmodes/idlw-help.el (idlwave-help-link-face): Likewise.
        * progmodes/ebrowse.el (ebrowse-tree-mark-face)
        (ebrowse-root-class-face, ebrowse-member-attribute-face)
-       (ebrowse-progress-face): Likewise. 
-       * progmodes/compile.el (compilation-info-face): Likewise. 
-       * progmodes/cc-fonts.el (c-invalid-face): Likewise. 
-       * emacs-lisp/re-builder.el (reb-match-3): Likewise. 
-       * calendar/calendar.el (diary-face): Likewise. 
+       (ebrowse-progress-face): Likewise.
+       * progmodes/compile.el (compilation-info-face): Likewise.
+       * progmodes/cc-fonts.el (c-invalid-face): Likewise.
+       * emacs-lisp/re-builder.el (reb-match-3): Likewise.
+       * calendar/calendar.el (diary-face): Likewise.
        * woman.el (woman-italic-face, woman-bold-face)
-       (woman-unknown-face): Likewise. 
-       * wid-edit.el (widget-button-pressed-face): Likewise. 
-       * whitespace.el (whitespace-highlight-face): Likewise. 
-       * smerge-mode.el (smerge-mine-face, smerge-base-face): Likewise. 
-       * pcvs-info.el (cvs-marked-face): Likewise. 
-       * info.el (info-xref): Likewise. 
-       * ido.el (ido-subdir-face, ido-indicator-face): Likewise. 
+       (woman-unknown-face): Likewise.
+       * wid-edit.el (widget-button-pressed-face): Likewise.
+       * whitespace.el (whitespace-highlight-face): Likewise.
+       * smerge-mode.el (smerge-mine-face, smerge-base-face): Likewise.
+       * pcvs-info.el (cvs-marked-face): Likewise.
+       * info.el (info-xref): Likewise.
+       * ido.el (ido-subdir-face, ido-indicator-face): Likewise.
        * hilit-chg.el (highlight-changes-face)
-       (highlight-changes-delete-face): Likewise. 
+       (highlight-changes-delete-face): Likewise.
        * hi-lock.el (hi-yellow, hi-green, hi-blue-b, hi-green-b)
-       (hi-red-b): Likewise. 
-       * generic-x.el (show-tabs-tab-face, show-tabs-space-face): Likewise. 
+       (hi-red-b): Likewise.
+       * generic-x.el (show-tabs-tab-face, show-tabs-space-face): Likewise.
        * font-lock.el (font-lock-keyword-face)
-       (font-lock-function-name-face, font-lock-warning-face): Likewise. 
+       (font-lock-function-name-face, font-lock-warning-face): Likewise.
        * cus-edit.el (custom-invalid-face, custom-modified-face)
        (custom-set-face, custom-changed-face, custom-variable-tag-face)
-       (custom-group-tag-face-1, custom-group-tag-face): Likewise. 
-       * comint.el (comint-highlight-prompt): Likewise. 
+       (custom-group-tag-face-1, custom-group-tag-face): Likewise.
+       * comint.el (comint-highlight-prompt): Likewise.
 
 2005-04-08  Lute Kamstra  <lute@gnu.org>
 
index 81a0aec910037ca3e2af31ed99332daa6ff4fb7d..4406a0615ee9ff4ea13cd1cf0f655c7931827844 100644 (file)
@@ -489,16 +489,14 @@ and:
                                  (if whitespace-spacetab "s")
                                  (if whitespace-trailing "t")))))
              (whitespace-update-modeline whitespace-this-modeline)
-             (save-excursion
-               (get-buffer-create whitespace-errbuf)
-               (kill-buffer whitespace-errbuf)
-               (get-buffer-create whitespace-errbuf)
-               (set-buffer whitespace-errbuf)
+             (if (get-buffer whitespace-errbuf)
+                 (kill-buffer whitespace-errbuf))
+             (with-current-buffer (get-buffer-create whitespace-errbuf)
                (if whitespace-errmsg
                    (progn
                      (insert whitespace-errmsg)
                      (if (not (or quiet whitespace-silent))
-                         (display-buffer whitespace-errbuf t))
+                         (display-buffer (current-buffer) t))
                      (if (not quiet)
                          (message "Whitespaces: [%s%s] in %s"
                                   whitespace-this-modeline
@@ -511,9 +509,7 @@ and:
                  (if (and (not quiet) (not (equal whitespace-clean-msg "")))
                      (message "%s %s" whitespace-filename
                               whitespace-clean-msg))))))))
-    (if whitespace-error
-       t
-      nil)))
+    whitespace-error))
 
 ;;;###autoload
 (defun whitespace-region (s e)
@@ -736,23 +732,17 @@ Also with whitespaces whose testing has been turned off."
 (defun whitespace-highlight-the-space (b e)
   "Highlight the current line, unhighlighting a previously jumped to line."
   (if whitespace-display-spaces-in-color
-      (progn
+      (let ((ol (whitespace-make-overlay b e)))
        (whitespace-unhighlight-the-space)
-       (add-to-list 'whitespace-highlighted-space
-                    (whitespace-make-overlay b e))
-       (whitespace-overlay-put (whitespace-make-overlay b e) 'face
-                               'whitespace-highlight-face))))
+       (push ol whitespace-highlighted-space)
+       (whitespace-overlay-put ol 'face 'whitespace-highlight-face))))
 ;;  (add-hook 'pre-command-hook 'whitespace-unhighlight-the-space))
 
 (defun whitespace-unhighlight-the-space ()
   "Unhighlight the currently highlight line."
   (if (and whitespace-display-spaces-in-color whitespace-highlighted-space)
-      (let ((whitespace-this-space nil))
-       (while whitespace-highlighted-space
-         (setq whitespace-this-space (car whitespace-highlighted-space))
-         (setq whitespace-highlighted-space
-               (cdr whitespace-highlighted-space))
-         (whitespace-delete-overlay whitespace-this-space))
+      (progn
+       (mapc 'whitespace-delete-overlay whitespace-highlighted-space)
        (setq whitespace-highlighted-space nil))
     (remove-hook 'pre-command-hook 'whitespace-unhighlight-the-space)))
 
@@ -863,5 +853,5 @@ This is meant to be added buffer-locally to `write-file-functions'."
 
 (provide 'whitespace)
 
-;;; arch-tag: 4ff44e87-b63c-402d-95a6-15e51e58bd0c
+;; arch-tag: 4ff44e87-b63c-402d-95a6-15e51e58bd0c
 ;;; whitespace.el ends here