all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Richard Stallman <rms@gnu.org>
Cc: drew.adams@oracle.com, emacs-devel@gnu.org
Subject: Re: why does occur depropertize matching lines?
Date: Wed, 24 Nov 2004 21:19:47 -0500	[thread overview]
Message-ID: <E1CX9EZ-0006Kb-A2@fencepost.gnu.org> (raw)
In-Reply-To: <87653zkezn.fsf@jurta.org> (message from Juri Linkov on Sun, 21 Nov 2004 05:22:52 +0200)

    Even now occur partly preserves highlighting for some lines: when
    called with a numeric prefix argument occur displays context lines
    highlighted with their original faces whereas highlighting from matching
    lines is removed.  This is too weird.  I can't find a reason for that.

I discovered that changing occur-1 to pass t for the keep-props
argument to occur-engine inverts this: it preserves the highlighting
for the actual target line, and discards it for the context lines.

That seems like a good idea to me; what do you think?

Here's the patch that does it.

*** replace.el	20 Nov 2004 16:58:11 -0500	1.190
--- replace.el	24 Nov 2004 20:51:24 -0500	
***************
*** 915,921 ****
  		    (and case-fold-search
  			 (isearch-no-upper-case-p regexp t))
  		    list-matching-lines-buffer-name-face
! 		    nil list-matching-lines-face nil)))
  	(let* ((bufcount (length active-bufs))
  	       (diff (- (length bufs) bufcount)))
  	  (message "Searched %d buffer%s%s; %s match%s for `%s'"
--- 915,921 ----
  		    (and case-fold-search
  			 (isearch-no-upper-case-p regexp t))
  		    list-matching-lines-buffer-name-face
! 		    nil list-matching-lines-face t)))
  	(let* ((bufcount (length active-bufs))
  	       (diff (- (length bufs) bufcount)))
  	  (message "Searched %d buffer%s%s; %s match%s for `%s'"


    However, I see another problem: matches are not highlighted anymore
    with `list-matching-lines-face' because when a character has two properties

      font-lock-face [bold]                   ;; from `list-matching-lines-face'
      face           [font-lock-keyword-face] ;; from source buffer

    `face' property takes precedence over `font-lock-face'.

I wonder why occur-engine uses font-lock-face.  It is not font lock
mode, after all.  Changing it to use `face' instead makes it seem
to do the right thing.  Does it cause any problem?

*** replace.el	20 Nov 2004 16:58:11 -0500	1.190
--- replace.el	24 Nov 2004 20:53:47 -0500	
***************
*** 998,1004 ****
  					     (append
  					      `(occur-match t)
  					      (when match-face
! 						`(font-lock-face ,match-face)))
  					     curstring)
  			(setq start (match-end 0))))
  		    ;; Generate the string to insert for this match
--- 998,1004 ----
  					     (append
  					      `(occur-match t)
  					      (when match-face
! 						`(face ,match-face)))
  					     curstring)
  			(setq start (match-end 0))))
  		    ;; Generate the string to insert for this match

  reply	other threads:[~2004-11-25  2:19 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-05 23:45 why does occur depropertize matching lines? Drew Adams
2004-11-19 16:02 ` Drew Adams
2004-11-21  1:10   ` Richard Stallman
2004-11-21  1:51     ` Drew Adams
2004-11-21  3:22       ` Juri Linkov
2004-11-25  2:19         ` Richard Stallman [this message]
2004-11-25  7:27           ` Juri Linkov
2004-11-26 21:03             ` Richard Stallman
2004-12-05 16:43               ` Juri Linkov
2004-12-06  1:40                 ` Richard Stallman
2004-12-06 20:10                   ` Juri Linkov
2004-12-06 20:33                     ` Stefan Monnier
2004-12-06 21:40                       ` Juri Linkov
2004-12-08  4:39                         ` Richard Stallman
2004-12-08 19:06                           ` Drew Adams
2004-12-08 19:44                             ` Josh Varner
2004-12-08 20:08                               ` Drew Adams
2004-12-09  4:42                                 ` Richard Stallman
2004-12-08  4:59                         ` Stefan Monnier
2004-12-08  4:39                     ` Richard Stallman

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1CX9EZ-0006Kb-A2@fencepost.gnu.org \
    --to=rms@gnu.org \
    --cc=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.