From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: font-lock-maximum-decoration and how to make a default font-locklower than maximal? Date: Sun, 26 Aug 2012 11:26:55 -0700 Message-ID: References: <87wr0x8zxj.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1346005638 24277 80.91.229.3 (26 Aug 2012 18:27:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 26 Aug 2012 18:27:18 +0000 (UTC) Cc: emacs-devel@gnu.org To: "'Stefan Monnier'" , "'Vitalie Spinu'" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Aug 26 20:27:19 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 1T5hYM-00069r-SW for ged-emacs-devel@m.gmane.org; Sun, 26 Aug 2012 20:27:19 +0200 Original-Received: from localhost ([::1]:59591 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T5hYK-0002Tb-VC for ged-emacs-devel@m.gmane.org; Sun, 26 Aug 2012 14:27:16 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:53594) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T5hYH-0002T0-L9 for emacs-devel@gnu.org; Sun, 26 Aug 2012 14:27:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T5hYE-0000xG-Qw for emacs-devel@gnu.org; Sun, 26 Aug 2012 14:27:13 -0400 Original-Received: from rcsinet15.oracle.com ([148.87.113.117]:33819) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T5hYE-0000wr-KI for emacs-devel@gnu.org; Sun, 26 Aug 2012 14:27:10 -0400 Original-Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by rcsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q7QIR7Dd017398 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 26 Aug 2012 18:27:08 GMT Original-Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q7QIR7p0007753 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 26 Aug 2012 18:27:07 GMT Original-Received: from abhmt115.oracle.com (abhmt115.oracle.com [141.146.116.67]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q7QIR6wp027861; Sun, 26 Aug 2012 13:27:07 -0500 Original-Received: from dradamslap1 (/71.202.147.44) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 26 Aug 2012 11:27:06 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: Ac2ABDTwzruFLgrNR/2eqFSG+uPxywDrVeUg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Source-IP: acsinet21.oracle.com [141.146.126.237] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 148.87.113.117 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:152852 Archived-At: > > For example, assume you are developing X-mode and some > > users would like to have functions + numbers + other stuff > > highlighted, but you don't want to activate those by default. > > So you can add font-lock keyword levels (2, 3, 4 etc) to > > accommodate this preference, but want to set the default to 2. > > I hate font-lock-maximum-decoration's notion of "levels" because > there is no such neat line. Some users will care about one > particular detail, others about an other. So please don't use > font-lock's levels for that fine-grained control. Instead just > introduce new config vars specific to your major mode. You are throwing out the baby with the bath water. And you are missing the point about font-lock "levels". Font-lock levels are not just for users to _customize_ decoration for a particular mode, in a single, fixed way. Font-lock levels let users easily (e.g., using a cycle command or picking a "level" from a menu, as in `font-menus.el' from FJ Wright) switch to a different kind of highlighting. Those kinds are called "levels" today, but you need not (and probably should not) think of them as such. "Level" here is a misnomer. So-called "levels" are just different highlighting patterns. These patterns might or might not reflect different highlighting degrees ("levels"), however you might want to imagine such leveling. There is no need to think in terms of degree at all. Think "different", not "more" or "less". Whether users should be able to easily customize the "levels" available for a given mode is a good question. I certainly am all for that possibility. By all means, let users customize what the font-locking choices are for a given mode, and how many choices there are. Go for it. And if the doc and names used for this customization emphasize that these are just arbitrary sets of font-lock appearances, rather than "levels", so much the better. But please do not take away the ability to interactively switch among such highlighting choices, which is provided by today's "levels" mechanism (with a little help from `font-menus.el' etc.). The facts that (1) most Emacs modes do not currently provide more than one "level" by default, and that (2) many users are unaware that they can choose a highlighting pattern ("level") when such a choice does exist, is not a reason for tossing the mechanism. (Choose = customize once and for all or switch patterns interactively.) Rather, those facts are reasons for Emacs Dev to (a) offer different predefined highlighting choices for more modes, (b) advertise the feature more, and (c) provide better interactivity (switching among choices) out of the box.