help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can one modify a variable definition in a major mode depending on buffer


From: Tom Browder
Subject: Can one modify a variable definition in a major mode depending on buffer name?
Date: Sat, 30 Jul 2016 12:48:32 -0500

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]