From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: `add-face' Date: Fri, 07 Sep 2012 21:31:00 +0800 Message-ID: <87pq5yq7sb.fsf@gnu.org> References: <87harbgnez.fsf@gnus.org> <87wr06tqj9.fsf@gnu.org> <87wr06gg30.fsf@gnus.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1347024683 30788 80.91.229.3 (7 Sep 2012 13:31:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 7 Sep 2012 13:31:23 +0000 (UTC) Cc: Wolfgang Jenkner , emacs devel To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 07 15:31:25 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1T9yeb-0001Pi-2p for ged-emacs-devel@m.gmane.org; Fri, 07 Sep 2012 15:31:25 +0200 Original-Received: from localhost ([::1]:55879 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9yeX-0000o6-UJ for ged-emacs-devel@m.gmane.org; Fri, 07 Sep 2012 09:31:21 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:47029) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9yeR-0000ni-D2 for emacs-devel@gnu.org; Fri, 07 Sep 2012 09:31:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T9yeM-0006Fe-Rw for emacs-devel@gnu.org; Fri, 07 Sep 2012 09:31:15 -0400 Original-Received: from mail-ie0-f169.google.com ([209.85.223.169]:59098) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9yeM-0006Df-NX for emacs-devel@gnu.org; Fri, 07 Sep 2012 09:31:10 -0400 Original-Received: by iec9 with SMTP id 9so5744628iec.0 for ; Fri, 07 Sep 2012 06:31:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=fb+Eh+Y+xORm6Cv3TFHL+wmzyMHwJWeS+BiQR7V0wc8=; b=GiLI9Q1VPLn0EsEc4pN6zIWw0Io30OZ2GoQ6Sm5LlbRBSbHdu/DCYffsO+R0VXl/eq tgsW40gOc9D4FZIOdacW7m4mehNIjn8vc3MZP/IM0BSuYXr1X7Ep5OoMk/tWh8gBqSmT MS0RhHuONvl7uwfg73d9vF9YOX4P2LmYvgfrPgy4kTJvQjA1ULXFVcuJUsTSxcVhr1r6 nMP04D2mt0cZnTAdm73T/8OvxY9u60bOZvwwM20vPttGriQ/RKNUvMXenaeSDxiDGntt IQ44kKkN4nJxtKNtjdWZMU6ISYmxrjngB9vSNf+jyvecfwVHvlsc5P04RVRcImtIyiJV oSlw== Original-Received: by 10.50.197.163 with SMTP id iv3mr8630957igc.52.1347024669693; Fri, 07 Sep 2012 06:31:09 -0700 (PDT) Original-Received: from ulysses (cm162.gamma80.maxonline.com.sg. [202.156.80.162]) by mx.google.com with ESMTPS id y9sm11771149igm.10.2012.09.07.06.31.04 (version=SSLv3 cipher=OTHER); Fri, 07 Sep 2012 06:31:08 -0700 (PDT) In-Reply-To: <87wr06gg30.fsf@gnus.org> (Lars Ingebrigtsen's message of "Fri, 07 Sep 2012 14:41:55 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.223.169 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:153145 Archived-At: Lars Ingebrigtsen writes: >> Is it really necessary to modify `add-text-properties' to get this work, >> though? It seems to me that next-single-property-change gives you >> enough information to do the job without changing the internals. > > I was mainly thinking about speed. shr.el, for instance, adds a lot of > faces, and it needs all the help it can get to speed stuff up. For > larger HTML documents it's too slow now, and this more complex way of > adding faces won't help. > > And the changes are pretty minimal, and may be generally useful. My main concern is that modifying list values of text properties in this way seems a bit too high-level for add-text-properties. It's mostly the `face' property that needs this kind of list management, and the details of the needed list management work (e.g. you'll probably want to use `add-to-list' to avoid adding duplicate faces) are pretty specific to the `face' property. So bolting this onto add-text-properties seems wrong. If speed is really an issue, we could make add-face-text-property a primitive instead of modifying add-text-properties. First, though, I'd suggest trying to use next-single-property-change with a Lisp implementation, and checking if it really isn't fast enough. You might be surprised. (After all, even if you are doing it in C, you will probably still be using Fnext_single_property_change.)