From: Juri Linkov <juri@jurta.org>
Subject: Remove mouse-face in Occur buffers
Date: Sat, 29 Oct 2005 01:06:31 +0300 [thread overview]
Message-ID: <87br19nzk1.fsf@jurta.org> (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/
next reply other threads:[~2005-10-28 22:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-28 22:06 Juri Linkov [this message]
2005-10-29 5:13 ` Remove mouse-face in Occur buffers 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87br19nzk1.fsf@jurta.org \
--to=juri@jurta.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).