unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Remove mouse-face in Occur buffers
@ 2005-10-28 22:06 Juri Linkov
  2005-10-29  5:13 ` Richard M. Stallman
  2005-10-29 17:35 ` Kim F. Storm
  0 siblings, 2 replies; 9+ messages in thread
From: Juri Linkov @ 2005-10-28 22:06 UTC (permalink / raw)


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/

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-11-01 11:06 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-28 22:06 Remove mouse-face in Occur buffers Juri Linkov
2005-10-29  5:13 ` Richard M. Stallman
2005-10-29 17:35 ` Kim F. Storm
2005-10-29 19:48   ` Juri Linkov
2005-10-29 21:40     ` Kim F. Storm
2005-10-31  7:44       ` Juri Linkov
2005-10-31 11:14         ` Kim F. Storm
2005-11-01  9:17           ` Juri Linkov
2005-11-01 11:06             ` Kim F. Storm

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).