From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Eric M. Ludlam" Newsgroups: gmane.emacs.devel Subject: Re: Codifications of rules Date: Mon, 07 Dec 2009 19:03:17 -0500 Message-ID: <4B1D97C5.9050809@siege-engine.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1260232217 6196 80.91.229.12 (8 Dec 2009 00:30:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 8 Dec 2009 00:30:17 +0000 (UTC) Cc: Matthew Dempsky , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 08 01:30:10 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NHnxx-0002xN-Vv for ged-emacs-devel@m.gmane.org; Tue, 08 Dec 2009 01:30:10 +0100 Original-Received: from localhost ([127.0.0.1]:49591 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NHnxx-0005PZ-IU for ged-emacs-devel@m.gmane.org; Mon, 07 Dec 2009 19:30:09 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NHnxs-0005PI-G5 for emacs-devel@gnu.org; Mon, 07 Dec 2009 19:30:04 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NHnxp-0005Ox-VJ for emacs-devel@gnu.org; Mon, 07 Dec 2009 19:30:03 -0500 Original-Received: from [199.232.76.173] (port=47634 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NHnxp-0005Ou-Sx for emacs-devel@gnu.org; Mon, 07 Dec 2009 19:30:01 -0500 Original-Received: from bird.interbax.net ([75.126.100.114]:55750) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NHnxp-0001JW-Rk for emacs-devel@gnu.org; Mon, 07 Dec 2009 19:30:02 -0500 Original-Received: (qmail 15822 invoked from network); 7 Dec 2009 17:03:18 -0700 Original-Received: from static-71-184-83-10.bstnma.fios.verizon.net (HELO ?192.168.1.201?) (71.184.83.10) by interbax.net with SMTP; 7 Dec 2009 17:03:18 -0700 User-Agent: Thunderbird 2.0.0.23 (X11/20090817) In-Reply-To: X-detected-operating-system: by monty-python.gnu.org: Windows 98 (1) X-Greylist: delayed 1599 seconds by postgrey-1.27 at monty-python; Mon, 07 Dec 2009 19:29:59 EST 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:118377 Archived-At: Hi, The mode-local tool that came in with the CEDET stuff has a notion of "mode local" functions. A tool maintainer will mark a function as being overloadable, and a major-mode author defines the same function as overloaded for a particular mode. In this way a tool (like Semantic) can define a bunch of core feature function APIs, and major modes can easily define that custom behavior. Functions like beginning/end of defun have ways to override with special variables. Mode local does something similar, but the macros allow codification of rules. For example, it ensures the doc-string specifies it can be overloaded. If additional "rules" are needed to help, they could be added to the macros. Some of the things listed in the thread so far would be easily handled by mode-local. Eric Stefan Monnier wrote: >>> It binds TAB to ruby-indent-line. That is against the rules. ;-) >> Out of curiosity, are 'rules' like this codified anywhere? > > Not much, sadly. There Elisp manual has a section about coventions to > follow for major modes, so the info should be there, but there's a lot > more conventions than the documented ones. > > But as a general rule, if you want key K to do something it's preferable > to do it by setting some variables that affect K's default binding than > by rebinding it to another command. > > I.e. better set indent-line-function, fill-paragraph-function, > completion-at-point-functions, rather than rebing TAB, M-q , M-TAB, ... > > The general goal should be to make it easier for a user to state > global preferences that affect all modes. > >> As I've started using Emacs seriously again, I've started noticing >> a lot of little inconsistencies between extensions (e.g., how >> temporary windows are displayed/destroyed). I'd be happy to submit >> patches to help improve this if someone could point out the >> correct behavior. > > These are usually welcome here (although they also tend to be delicate > because users get quickly used to the old behavior and then show > resistance to change). > > > Stefan > > >