emacs-devel
[Top][All Lists]
Advanced

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

Re: patch to recognize file variables in the case of haskell pragmas, et


From: Stefan Monnier
Subject: Re: patch to recognize file variables in the case of haskell pragmas, etc.
Date: Fri, 04 May 2012 23:22:18 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)

>>>>> "Ransom" == Ransom Williams <address@hidden> writes:

> uurk, typo/force of habit, sorry...

> On Sun, Apr 29, 2012 at 3:25 PM, Ransom Williams <address@hidden> wrote:
>> tali713 in the #emacs channel on irc.freenode suggested i submit this
>> as a patch:
>> 
>> The regexps to pass over when looking for -*-file:variables-*-, namely
>> "^#!" and "^'\\\\\"", were previously hardcoded in the set-auto-mode-1
>> function.  They are now in the file-auto-mode-ignore list along with a
>> regular expression for haskell pragmas.
>> 
>> i am not on the list, but feel free to copy me on any comments that
>> need addressing.

Thank you for your contribution.  I installed the patch below instead:
it's not much more difficult to (concat foo "\\|bla") than it is to add
to a list.


        Stefan


=== modified file 'lisp/files.el'
--- lisp/files.el       2012-05-04 23:16:47 +0000
+++ lisp/files.el       2012-05-05 03:18:37 +0000
@@ -2782,6 +2782,11 @@
       (funcall mode)
       mode)))
 
+(defvar file-auto-mode-skip "^\\(#!\\|'\\\\\"\\)"
+  "Regexp of lines to skip when looking for file-local settings.
+If the first line matches this regular expression, then the -*-...-*- file-
+local settings will be consulted on the second line instead of the first."
+
 (defun set-auto-mode-1 ()
   "Find the -*- spec in the buffer.
 Call with point at the place to start searching from.
@@ -2804,7 +2809,7 @@
                             ;; interpreter invocation.  The same holds
                             ;; for '\" in man pages (preprocessor
                             ;; magic for the `man' program).
-                            (and (looking-at "^\\(#!\\|'\\\\\"\\)") 2)) t)
+                            (and (looking-at file-auto-mode-skip) 2)) t)
      (progn
        (skip-chars-forward " \t")
        (setq beg (point))




reply via email to

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