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: Re: Can one modify a variable definition in a major mode depending on buffer name? Date: Sat, 30 Jul 2016 12:48:13 -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 1469900946 3063 80.91.229.8 (30 Jul 2016 17:49:06 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 30 Jul 2016 17:49:06 +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:48:52 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 1bTYNY-0000kM-6j for geh-help-gnu-emacs@m.gmane.org; Sat, 30 Jul 2016 19:48:52 +0200 Original-Received: from localhost ([::1]:36606 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bTYNU-00057n-Cb for geh-help-gnu-emacs@m.gmane.org; Sat, 30 Jul 2016 13:48:48 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48312) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bTYMz-00057d-6X for help-gnu-emacs@gnu.org; Sat, 30 Jul 2016 13:48:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bTYMx-0006aA-6W for help-gnu-emacs@gnu.org; Sat, 30 Jul 2016 13:48:16 -0400 Original-Received: from mail-oi0-x22f.google.com ([2607:f8b0:4003:c06::22f]:33306) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bTYMx-0006a6-1j for help-gnu-emacs@gnu.org; Sat, 30 Jul 2016 13:48:15 -0400 Original-Received: by mail-oi0-x22f.google.com with SMTP id j185so145171504oih.0 for ; Sat, 30 Jul 2016 10:48:14 -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=uto8TNk1MYpmsbrS66H8K2v54dwiSJWrHh8AcE1AwfI=; b=DH0lJVsguQof5rLOU0ZYHP0DdG5QF2q4gRXK7KKVU/NYiI5Z7hypnlKwnWFlxt5RgE Rnz/RoQLxZ8c1EzxojboME7l2zDteSfztDCW3ftr+vvqKrpXVsmAU7H1w/Bz5aKqDo7A YmvQjFYWVBHpbDatA4R3VFD+Sg2SC6cVDB6mivKkz5dzDDPgL7fMU8GiWHgzpD+SGDvo uvOs2xYYNak9TnkX3twC4FlFI6HKtC0382yIFh/TfxWDRliaAcTth3LkQL6B7FOI/48E bJjn3lCoskWABHW5XIVbNZbTc4zF5ctACvqiq7oS40IrNBNPVu017QPmympa2PDPe6IR g5Jw== 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=uto8TNk1MYpmsbrS66H8K2v54dwiSJWrHh8AcE1AwfI=; b=Bwo0uO7+hMPrs4gv2gScU6GIDDmZTBtsiZxTZZsVRTMkjwD/J1D7XbKCb1bFehefEs L9m8m7TbRIfq6LhYN7KZGmhExodsIGdEfz6HVIglEs3Z/918d1fYpXtZBeUatd8NRS53 +jNTeO4ZfFSGH7jKCW/DKIOLUhVOZawpyRFwkdvTD/eFVM+4sEXW7R2CxNsX7WETXsQa 7eDh1AVowp5Czs4EK5YHU61kCMeORKNdehNBdmR+7euZl0jZ4MsRqa+Wl+MU9T6g/JNC +Isc58R86Zrzik/cGi3n3e8yGrW1e/8gY6B7c6/JuCo47MgAtvL45mNf+T7okIoPTiSS 5ovg== X-Gm-Message-State: AEkoouuFwhfJ/JTktpGAgTVg/452MuPTDFHYF1reM0bfMDEAO+B2Yvd104S+mmFpGQXmp8Gfx90wqTwIAc5Zng== X-Received: by 10.157.2.5 with SMTP id 5mr28308273otb.184.1469900894460; Sat, 30 Jul 2016 10:48:14 -0700 (PDT) Original-Received: by 10.157.62.135 with HTTP; Sat, 30 Jul 2016 10:48:13 -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::22f 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:111027 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