From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sebastian Wiesner Newsgroups: gmane.emacs.devel Subject: Re: Derived modes and mode hooks Date: Sat, 9 Mar 2013 19:58:11 +0100 Message-ID: References: <836210y156.fsf@gnu.org> <831uboxy0r.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1362855513 32234 80.91.229.3 (9 Mar 2013 18:58:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 9 Mar 2013 18:58:33 +0000 (UTC) Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Mar 09 19:58:56 2013 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 1UEOys-0003Uf-DW for ged-emacs-devel@m.gmane.org; Sat, 09 Mar 2013 19:58:54 +0100 Original-Received: from localhost ([::1]:54776 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UEOyW-0002GW-Fk for ged-emacs-devel@m.gmane.org; Sat, 09 Mar 2013 13:58:32 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:35862) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UEOyN-0002A4-DL for emacs-devel@gnu.org; Sat, 09 Mar 2013 13:58:29 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UEOyH-00008c-M1 for emacs-devel@gnu.org; Sat, 09 Mar 2013 13:58:23 -0500 Original-Received: from mail-qc0-x22f.google.com ([2607:f8b0:400d:c01::22f]:44079) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UEOyC-00007e-0P; Sat, 09 Mar 2013 13:58:12 -0500 Original-Received: by mail-qc0-f175.google.com with SMTP id j3so977677qcs.6 for ; Sat, 09 Mar 2013 10:58:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:content-transfer-encoding; bh=nVhKeckEdrL//OpJ/hkTgAmplyiLsbJiyPx5t1UxFSs=; b=FyLazkxbOoKsDdvxoVzoSVNXNdPSghr+54Wnlli+a861Xpsk4OvyqfftTiq4wgOzfb duzbTA3hKKYZRqS8xBaVvx3dySHWPUaIIeKXt/VPNfX5QMm8sUutc4717PvHOvVFBkFR N0IVMyztUV0BneC3C4jA6uxIJNzBdeQtJ5Al290cU2UeHycds7aIQkFSPtlosoD3hLdx F5BDW32nQtU0Rl1Bcy0bh83Jux0UYDpFaXfqSOVDm2HABfOm9MmZKKq30Liin+ibKQFB QNs80Lt+oqGEM+yb6UxcrvfGXlSdTUbQNmpMNlTnFwymnO3kduv5pz18u6HqgisytDS7 RmBw== X-Received: by 10.49.51.5 with SMTP id g5mr11198430qeo.9.1362855491348; Sat, 09 Mar 2013 10:58:11 -0800 (PST) Original-Received: by 10.224.111.147 with HTTP; Sat, 9 Mar 2013 10:58:11 -0800 (PST) In-Reply-To: <831uboxy0r.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c01::22f 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:157676 Archived-At: 2013/3/9 Eli Zaretskii : >> In order to completely disable automatic filling I'd add a function >> which simply returns t to this list? > > That's one possibility; I'm sure there are others, less radical ones. > >> That sounds like a nasty hack to me. > > I don't see why. It is certainly not as nasty as overriding user > customizations. So your proposed solution effectively inhibits auto filling and thus also *effectively overrides* the user's customization, but in a convoluted way, abusing a variable which is obviously intended for a different purpose, and which most likely only few users even know about. Yet you actually *prefer* this crude way of effectively overriding the user's customization over simply disabling the mode, *the* obvious way of inhibiting auto filling, more over clearly indicated to the user by the absence of the corresponding entry in the mode line. Did I get that correctly? >> > It is not any bloody business of a mode author to override >> > customizations of users. >> >> I'm talking overriding customization *in the special case*, that a >> customization for a *parent mode* (which the user most likely did >> without caring for, or even knowing of, a specific derived mode) is >> *not reasonably applicable* in a derived mode, for the sake of >> convenience for the users of the derived mode. > > The whole business of inheriting from a mode makes sense only when the > child mode is compatible with its parent. I wonder how you define =E2=80=9Ccompatible=E2=80=9D, for I cannot see any = applicable definition of this term that would make plain "text-mode" and an advanced mode like AUCTeX' "latex-mode" =E2=80=9Ccompatible=E2=80=9D. They= behave completely different, and I doubt that any *user* of AUCTeX would actually call them =E2=80=9Ccompatible=E2=80=9D. I hitherto thought the main point of derived modes was simply to allow re-use of code, and to provide a generic interface for customization, i.e. save the user the PITA of enabling auto-fill-mode explicitly in any plain text mode again. Incidentally, the latter is the only reason for deriving modes I could actually find in the Emacs Lisp manual. See "Basic Major Modes": =E2=80=9CAs far as possible, new major modes should be derived, either directly or indirectly, from one of these three modes. One reason is that this allows users to customize a single mode hook (e.g., `prog-mode-hook') for an entire family of relevant modes (e.g., all programming language modes).=E2=80=9D Note that there are no other reasons given, following this =E2=80=9Cone reason=E2=80=9D. Moreover neither this node, nor "Derived Modes" claim tha= t a derived mode is supposed to be compatible to its parent mode. > If this is not so in too many levels, then inheriting for such a parent i= s not what you want. > If a small number of user customizations don't make any sense in the > child mode, then using variables such as fill-nobreak-predicate is > _the_ way, and users will not blame you, because they understand why > e.g. filling makes no sense in some situations in your mode. > > But futzing with user customizations _directly_, i.e. by changing > them, is a no-no in any case, IMO. I do not want to *change* the user's customization. The user's customization will still be in effect, where it makes sense, i.e. in other modes derived from text-mode.