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 12:17:46 +0800 Message-ID: <87wr06tqj9.fsf@gnu.org> References: <87harbgnez.fsf@gnus.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1346991481 23143 80.91.229.3 (7 Sep 2012 04:18:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 7 Sep 2012 04:18:01 +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 06:18:03 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 1T9q14-0000Xq-9V for ged-emacs-devel@m.gmane.org; Fri, 07 Sep 2012 06:18:02 +0200 Original-Received: from localhost ([::1]:54872 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9q11-0002Wl-19 for ged-emacs-devel@m.gmane.org; Fri, 07 Sep 2012 00:17:59 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:59076) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9q0y-0002Wg-WF for emacs-devel@gnu.org; Fri, 07 Sep 2012 00:17:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T9q0v-0007ZP-MN for emacs-devel@gnu.org; Fri, 07 Sep 2012 00:17:56 -0400 Original-Received: from mail-iy0-f169.google.com ([209.85.210.169]:56395) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9q0v-0007ZL-HO for emacs-devel@gnu.org; Fri, 07 Sep 2012 00:17:53 -0400 Original-Received: by iagk10 with SMTP id k10so3233032iag.0 for ; Thu, 06 Sep 2012 21:17:52 -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=rEc1L+1djsoDId7ncjYcay4tSOdNZ08rOetkZQlE+WI=; b=aXaev9q41s14vuVvHVk8eaUCJiQUEF3Juvzid+QwgKuER95xz3413sWJ2MqZHoleNK 2aRsBVBzmSwZjOAdzXfE6F6L/bpTcxdoPJsIZZy996uuIj9UL234QS9usLVjmakcVqtG Zjw+FWZ0/X3cmc8oRnwzhLcCMyDESqeA1Iv8n3nJDH58OZGUfEti4LWUpfr12WfRpQ5d +GRr5rau4v315DwZZI5p2YNjHvcgQ11Fn3zGYAryCGEmRAMPy5U5XVpbG1Sv02PUnFoI mqXPrjxiBEiG/i29QfUrV9oDd79Od6ita3ITscdFKeqB82r/eZ6vowiOFQzcmJKkHcyb vj+Q== Original-Received: by 10.50.149.137 with SMTP id ua9mr6241188igb.65.1346991472750; Thu, 06 Sep 2012 21:17:52 -0700 (PDT) Original-Received: from ulysses ([155.69.18.183]) by mx.google.com with ESMTPS id nh1sm6456536igc.11.2012.09.06.21.17.49 (version=SSLv3 cipher=OTHER); Thu, 06 Sep 2012 21:17:51 -0700 (PDT) In-Reply-To: <87harbgnez.fsf@gnus.org> (Lars Ingebrigtsen's message of "Thu, 06 Sep 2012 17:51:16 +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.210.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:153135 Archived-At: Lars Ingebrigtsen writes: > So here's my suggestion for exposing this rather nice functionality in > a more convenient form. > > Add a function `add-face', that will do what you think it does. Or > perhaps `add-face-region'? Or `add-text-property-face'? > > Anyway, this will call `add-text-properties' with a new optional > parameter NOREPLACE, that will tell `add-text-properties' to add to the > list of properties instead of replacing. This, in turn, will then call > add_properties with a new parameter, and it will do the trivial list > manipulation stuff instead of just > > Fsetcar (this_cdr, val1); > > If this sounds like a good idea, I can implement this right away. And > then change shr.el to use the new function, which should speed table > rendering up a bit, as well as getting rid of some uglee code. I guess you already added this to upstream Gnus, with an add-face function defined in gnus-compat.el. This broke Gnus in trunk when it got merged into trunk, so I reverted it. As for the idea, it sounds good in principle. I think either `add-face-text-property' or `face-add-text-property' would be a better name. 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. Someone should also check if this mechanism plays well with M-x highlight-regexp.