unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Tom Browder <tom.browder@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: Can one modify a variable definition in a major mode depending on buffer name?
Date: Sat, 30 Jul 2016 12:48:32 -0500	[thread overview]
Message-ID: <CAFMGiz-E+yuuKqy_+bCienEFxYkMKkz9eLs8bNjvyiNFGqhZzg@mail.gmail.com> (raw)
In-Reply-To: <jwvtwf7uj1q.fsf-monnier+gmane.emacs.help@gnu.org>

On Saturday, July 30, 2016, Stefan Monnier <monnier@iro.umontreal.ca
<javascript:_e(%7B%7D,'cvml','monnier@iro.umontreal.ca');>> 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


  parent reply	other threads:[~2016-07-30 17:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-30 12:54 Can one modify a variable definition in a major mode depending on buffer name? Tom Browder
2016-07-30 14:26 ` Emanuel Berg
2016-07-30 16:22   ` Tom Browder
2016-07-30 17:00     ` Emanuel Berg
2016-07-30 17:28       ` Tom Browder
2016-07-30 16:37   ` John Mastro
2016-07-30 17:33     ` Tom Browder
2016-07-30 17:37 ` Stefan Monnier
2016-07-30 17:48   ` Tom Browder
2016-07-30 17:48   ` Tom Browder [this message]
2016-08-02  1:28     ` Michael Heerdegen
2016-08-02  1:35       ` Tom Browder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFMGiz-E+yuuKqy_+bCienEFxYkMKkz9eLs8bNjvyiNFGqhZzg@mail.gmail.com \
    --to=tom.browder@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).