[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Remove mouse-face in Occur buffers
From: |
Juri Linkov |
Subject: |
Remove mouse-face in Occur buffers |
Date: |
Sat, 29 Oct 2005 01:06:31 +0300 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) |
When `keep-props' arg is non-nil, occur copies text properties from
the original buffer to the Occur buffer. But when the original buffer
contains areas with `mouse-face' properties, highlighting these copied
areas in the Occur buffer interferes with highlighted areas indicating
the matching lines. This can be reproduced for example by calling
`C-u M-x occur RET' on Info buffers.
The following patch removes `mouse-face' properties from the copied text:
Index: lisp/replace.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/replace.el,v
retrieving revision 1.227
diff -c -r1.227 replace.el
*** lisp/replace.el 27 Oct 2005 18:22:00 -0000 1.227
--- lisp/replace.el 28 Oct 2005 22:05:42 -0000
***************
*** 894,903 ****
(if (fboundp 'jit-lock-fontify-now)
(jit-lock-fontify-now beg end)))
(push
! (funcall (if keep-props
! #'buffer-substring
! #'buffer-substring-no-properties)
! beg end)
result)
(forward-line (if forwardp 1 -1)))
(nreverse result))))
--- 898,908 ----
(if (fboundp 'jit-lock-fontify-now)
(jit-lock-fontify-now beg end)))
(push
! (if keep-props
! (let ((str (buffer-substring beg end)))
! (remove-text-properties 0 (length str) '(mouse-face nil) str)
! str)
! (buffer-substring-no-properties beg end))
result)
(forward-line (if forwardp 1 -1)))
(nreverse result))))
***************
*** 1102,1114 ****
(text-property-not-all begpt endpt 'fontified t))
(if (fboundp 'jit-lock-fontify-now)
(jit-lock-fontify-now begpt endpt)))
! (setq curstring (buffer-substring begpt endpt))
! ;; Depropertize the string, and maybe
! ;; highlight the matches
(let ((len (length curstring))
(start 0))
! (unless keep-props
! (set-text-properties 0 len nil curstring))
(while (and (< start len)
(string-match regexp curstring start))
(add-text-properties
--- 1107,1121 ----
(text-property-not-all begpt endpt 'fontified t))
(if (fboundp 'jit-lock-fontify-now)
(jit-lock-fontify-now begpt endpt)))
! (setq curstring
! (if keep-props
! (buffer-substring begpt endpt)
! (buffer-substring-no-properties begpt endpt)))
! ;; Highlight the matches
(let ((len (length curstring))
(start 0))
! (if keep-props
! (remove-text-properties 0 len '(mouse-face nil)
curstring))
(while (and (< start len)
(string-match regexp curstring start))
(add-text-properties
--
Juri Linkov
http://www.jurta.org/emacs/
- Remove mouse-face in Occur buffers,
Juri Linkov <=