From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tom Browder Newsgroups: gmane.emacs.help Subject: Can one modify a variable definition in a major mode depending on buffer name? Date: Sat, 30 Jul 2016 12:48:32 -0500 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: blaine.gmane.org 1469901007 3733 80.91.229.8 (30 Jul 2016 17:50:07 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 30 Jul 2016 17:50:07 +0000 (UTC) Cc: "help-gnu-emacs@gnu.org" To: Stefan Monnier Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Jul 30 19:49:54 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bTYOW-0000vo-Pl for geh-help-gnu-emacs@m.gmane.org; Sat, 30 Jul 2016 19:49:52 +0200 Original-Received: from localhost ([::1]:36611 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bTYOS-0005gE-LK for geh-help-gnu-emacs@m.gmane.org; Sat, 30 Jul 2016 13:49:48 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48376) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bTYNH-0005FG-6a for help-gnu-emacs@gnu.org; Sat, 30 Jul 2016 13:48:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bTYNG-0006kH-CN for help-gnu-emacs@gnu.org; Sat, 30 Jul 2016 13:48:35 -0400 Original-Received: from mail-oi0-x230.google.com ([2607:f8b0:4003:c06::230]:33342) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bTYNG-0006jA-7H for help-gnu-emacs@gnu.org; Sat, 30 Jul 2016 13:48:34 -0400 Original-Received: by mail-oi0-x230.google.com with SMTP id j185so145177264oih.0 for ; Sat, 30 Jul 2016 10:48:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=5ROt7av1KIwXgGy9MFBqQKeLCZS1p4uqOciYQ98zPSY=; b=JkVHaXw6GC99lPNkf507yFMGzC/Lc91J1ytgM7v4S4ocTEhM3rNUjnZepOm76IwlMF YvJh2rThpKvwHsGxDyVWlFPhntqP9QPpPqN4QfG5/hLWg/Vp5WrOUHHCvWJ8+0Hcwinz H4GHHIhHEMOiMfQKS02uzyIc9PWUX5BdYE9ZVsNg+0BjiEtDzmTcRRxzylgqB1rfnyeC 9SpOBVn8sO65d5qwhMmHRdDIwHpgYxq8sfu6ljGC/20lUxMAUdWbvkXOO5sgDxBwjQzg 6kVtjtU6BB9944tefKnPnSYaPhafa2ETWaPVwospzImXcjQifqpLHby/+OwULZvCz73b WULg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=5ROt7av1KIwXgGy9MFBqQKeLCZS1p4uqOciYQ98zPSY=; b=hLkprjEYwD7fZ4aFI/ff8Fj+mb5G4Uqef4eIjECEDDucwOTAitapXaEN4TYVULp/B6 3jKXnaGmc8HouJGJgbP8a+a5FKuCa1ADYXZjU/ulmbZUokLRb9Sob77dh0MhCNN4GTzA ZzTy8C1CBkFXH/tr5uA8Uc/PgjLetXqAp6/gTeARhBdCl8XFwOHVIVqZdCWgZvz/fq6k Cj4uRSEzHKfQtXeJvgyura5gNDlDbDxoIVT8qaBSW/pdER19DLj/lj+0uU/+pJJfGXoi qeE9wFTJh56T/TC87HfVrtPiSfdTsi7qSF1NgfS0iIaY/UFwQIRAynIZjv5nsECBr80w o2uw== X-Gm-Message-State: AEkoout59qY/xHQ6qz9OYhvFXpXjEU9rkZ+BuXvdOdbEatcSjj5++aGOz5bsA2Kkur1Oe5n3rxTcP8UM1+a3QQ== X-Received: by 10.157.10.16 with SMTP id 16mr30395735otg.131.1469900913730; Sat, 30 Jul 2016 10:48:33 -0700 (PDT) Original-Received: by 10.157.62.135 with HTTP; Sat, 30 Jul 2016 10:48:32 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4003:c06::230 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:111028 Archived-At: On Saturday, July 30, 2016, Stefan Monnier > wrote: > > My use case is modifying our perl6-mode for the slight difference in > > allowable identifiers between Perl 6 and NQP (Not Quite Perl). By > convention, nqp files end in ".nqp" so that the buffer name should be a > > good way to automatically change the single regex bound to a var name in > > the mode file. That would save having to write another major mode just > for > > such a small change. > > (add-to-list 'auto-mode-alist '("\\.nqp\\'" . nqp-mode)) > > (define-derived-mode nqp-mode perl-mode "NQP" > "Major mode for NQP's subset of Perl 6." > (setq-local the-var-i-need-to-change the-new-value)) Stefan, are those lines the entire contents of a "nqp-mode.el" file? -Tom