From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: Remove mouse-face in Occur buffers Date: Mon, 31 Oct 2005 09:44:55 +0200 Organization: JURTA Message-ID: <87hdayjjq8.fsf@jurta.org> References: <87br19nzk1.fsf@jurta.org> <87zmosceb3.fsf@jurta.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1130745399 5578 80.91.229.2 (31 Oct 2005 07:56:39 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 31 Oct 2005 07:56:39 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 31 08:56:30 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EWUWo-0001r4-HL for ged-emacs-devel@m.gmane.org; Mon, 31 Oct 2005 08:56:26 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EWUWn-0005c4-Sb for ged-emacs-devel@m.gmane.org; Mon, 31 Oct 2005 02:56:25 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EWUV6-0005a3-Pk for emacs-devel@gnu.org; Mon, 31 Oct 2005 02:54:41 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EWUV2-0005Z6-GN for emacs-devel@gnu.org; Mon, 31 Oct 2005 02:54:37 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EWUV2-0005Yr-1U for emacs-devel@gnu.org; Mon, 31 Oct 2005 02:54:36 -0500 Original-Received: from [194.126.101.111] (helo=mail.neti.ee) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EWUV2-0003hv-3i for emacs-devel@gnu.org; Mon, 31 Oct 2005 02:54:36 -0500 Original-Received: from mail.neti.ee (80-235-35-70-dsl.mus.estpak.ee [80.235.35.70]) by Relayhost1.neti.ee (Postfix) with ESMTP id 6DD35C804; Mon, 31 Oct 2005 09:54:48 +0200 (EET) Original-To: storm@cua.dk (Kim F. Storm) In-Reply-To: (Kim F. Storm's message of "Sat, 29 Oct 2005 23:40:09 +0200") User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) X-Virus-Scanned: by amavisd-new-2.2.1 (20041222) (Debian) at neti.ee X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:45158 Archived-At: >> Maybe, there should be a separate variable defining a list >> of text properties to remove on copied text in the occur buffer. >> Do you think it would be useful? > > Yes, that sounds like a good idea. > > The default value could be the same as the initial value of > yank-excluded-properties (I haven't checked). The default value of `yank-excluded-properties' also includes `invisible' which will unhide copied invisible text in the Occur buffer. This is better than displaying lines with hidden matches. But maybe occur should skip invisible text in the original buffer, and not to copy lines where matches have invisible properties on them (i.e. like isearch skips invisible text)? Anyway, in the patch below the default value of `occur-excluded-properties' is the same as of `yank-excluded-properties'. And it also servers as the default value of the `keep-props' argument (which before this patch was unconditionally non-nil). Index: lisp/replace.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/replace.el,v retrieving revision 1.228 diff -c -r1.228 replace.el *** lisp/replace.el 29 Oct 2005 19:49:20 -0000 1.228 --- lisp/replace.el 31 Oct 2005 07:43:23 -0000 *************** *** 878,883 **** --- 878,893 ---- :type 'face :group 'matching) + (defcustom occur-excluded-properties + '(read-only invisible intangible field mouse-face help-echo local-map keymap + yank-handler follow-link) + "*Text properties to discard when copying lines to the *Occur* buffer. + The value should be a list of text properties to discard or t, + which means to discard all text properties." + :type '(choice (const :tag "All" t) (repeat symbol)) + :group 'matching + :version "22.1") + (defun occur-accumulate-lines (count &optional keep-props) (save-excursion (let ((forwardp (> count 0)) *************** *** 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)))) --- 904,915 ---- (if (fboundp 'jit-lock-fontify-now) (jit-lock-fontify-now beg end))) (push ! (if (and keep-props (not (eq occur-excluded-properties t))) ! (let ((str (buffer-substring beg end))) ! (remove-list-of-text-properties ! 0 (length str) occur-excluded-properties str) ! str) ! (buffer-substring-no-properties beg end)) result) (forward-line (if forwardp 1 -1))) (nreverse result)))) *************** *** 1033,1039 **** (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'" --- 1045,1052 ---- (and case-fold-search (isearch-no-upper-case-p regexp t)) list-matching-lines-buffer-name-face ! nil list-matching-lines-face ! (not (eq occur-excluded-properties t))))) (let* ((bufcount (length active-bufs)) (diff (- (length bufs) bufcount))) (message "Searched %d buffer%s%s; %s match%s for `%s'" *************** *** 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 --- 1115,1129 ---- (text-property-not-all begpt endpt 'fontified t)) (if (fboundp 'jit-lock-fontify-now) (jit-lock-fontify-now begpt endpt))) ! (if (and keep-props (not (eq occur-excluded-properties t))) ! (progn ! (setq curstring (buffer-substring begpt endpt)) ! (remove-list-of-text-properties ! 0 (length curstring) occur-excluded-properties curstring)) ! (setq curstring (buffer-substring-no-properties begpt endpt))) ! ;; Highlight the matches (let ((len (length curstring)) (start 0)) (while (and (< start len) (string-match regexp curstring start)) (add-text-properties -- Juri Linkov http://www.jurta.org/emacs/