From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Emanuel Berg 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 16:26:13 +0200 Message-ID: <867fc3rym2.fsf@student.uu.se> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1469888846 16875 80.91.229.8 (30 Jul 2016 14:27:26 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 30 Jul 2016 14:27:26 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Jul 30 16:27:11 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 1bTVEN-0004JW-8k for geh-help-gnu-emacs@m.gmane.org; Sat, 30 Jul 2016 16:27:11 +0200 Original-Received: from localhost ([::1]:35738 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bTVEJ-0008Tf-Bd for geh-help-gnu-emacs@m.gmane.org; Sat, 30 Jul 2016 10:27:07 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40466) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bTVDr-0008TZ-Kt for help-gnu-emacs@gnu.org; Sat, 30 Jul 2016 10:26:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bTVDn-0006tI-Q8 for help-gnu-emacs@gnu.org; Sat, 30 Jul 2016 10:26:38 -0400 Original-Received: from blaine.gmane.org ([80.91.229.8]:55483) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bTVDn-0006sD-J2 for help-gnu-emacs@gnu.org; Sat, 30 Jul 2016 10:26:35 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1bTVDh-00046G-4K for help-gnu-emacs@gnu.org; Sat, 30 Jul 2016 16:26:29 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Original-Lines: 31 Original-X-Complaints-To: usenet@blaine.gmane.org Mail-Copies-To: never Cancel-Lock: sha1:q10fYEgvTW35k2seKUqz+jc4teU= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 80.91.229.8 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:111019 Archived-At: 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 -