From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: Re: Can one modify a variable definition in a major mode depending on buffer name?
Date: Sat, 30 Jul 2016 16:26:13 +0200 [thread overview]
Message-ID: <867fc3rym2.fsf@student.uu.se> (raw)
In-Reply-To: CAFMGiz9Qq7TUMqxM4EjGsTcZVn3-S65XrnE6jORQSSuih-_zhw@mail.gmail.com
Tom Browder wrote:
> I think I can do that, with some
> experimentation, but can anyone confirm that
> it's reasonably possible?
;;; Perl
(defvar perl-propaganda)
(setq perl-propaganda "There's more than one way to do it!")
;; (setq perl-mode-hook nil)
(defun perl-mode-hook-f ()
(let*((filename (buffer-name))
(filename-parts (split-string filename "\\."))
(extention (cadr filename-parts) ))
(when (string-equal extention "nqp")
(setq-local perl-propaganda "Do it today, in a different way!") )))
(add-hook 'perl-mode-hook #'perl-mode-hook-f)
(let ((modes (list
'("\\.nqp\\'" . perl-mode)
'("\\.tex\\'" . latex-mode)
'("\\.php\\'" . html-mode)
;; etc.
)))
(setf auto-mode-alist (nconc modes auto-mode-alist)) )
--
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
- so far: 64 Blogomatic articles -
next prev parent reply other threads:[~2016-07-30 14:26 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 [this message]
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
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=867fc3rym2.fsf@student.uu.se \
--to=embe8573@student.uu.se \
--cc=help-gnu-emacs@gnu.org \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.