Improve previous interpreter-mode-alist change
* lisp/files.el (interpreter-mode-alist): Remove \\` \\' parts. (set-auto-mode): Don't regexp-quote elements. * lisp/progmodes/python.el (interpreter-mode-alist): Remove \\` \\'. * lisp/progmodes/cc-mode.el (interpreter-mode-alist): * lisp/progmodes/ruby-mode.el (interpreter-mode-alist): Revert previous change. * etc/NEWS: Update.
This commit is contained in:
parent
cb55925848
commit
2a08047aed
6 changed files with 47 additions and 47 deletions
8
etc/NEWS
8
etc/NEWS
|
@ -616,11 +616,9 @@ Formerly it returned a list (-1 LOW USEC PSEC), but this was ambiguous
|
|||
in the presence of files with negative time stamps.
|
||||
|
||||
** The cars of the elements in `interpreter-mode-alist' are now treated
|
||||
as regexps rather than literal strings. For the time being, any
|
||||
element whose car does not start with "\\" is still treated as a
|
||||
literal string, so this change should not cause any incompatibilities
|
||||
if you have code that just adds elements to the list, only if you are
|
||||
actually using interpreter-mode-alist for something.
|
||||
as regexps rather than literal strings. Technically this is an
|
||||
incompatible change, but unless you are using interpreter-mode-alist
|
||||
for something (not just adding elements to it), it ought not to affect you.
|
||||
|
||||
|
||||
* Lisp Changes in Emacs 24.4
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
2013-09-11 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* files.el (interpreter-mode-alist): Remove \\` \\' parts.
|
||||
(set-auto-mode): Don't regexp-quote elements.
|
||||
* progmodes/python.el (interpreter-mode-alist): Remove \\` \\'.
|
||||
* progmodes/cc-mode.el (interpreter-mode-alist):
|
||||
* progmodes/ruby-mode.el (interpreter-mode-alist):
|
||||
Revert previous change.
|
||||
|
||||
2013-09-11 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* play/snake.el (snake-mode):
|
||||
|
|
|
@ -2447,43 +2447,34 @@ and `magic-mode-alist', which determines modes based on file contents.")
|
|||
(mapcar
|
||||
(lambda (l)
|
||||
(cons (purecopy (car l)) (cdr l)))
|
||||
'(("\\`\\(mini\\)?perl5?\\'" . perl-mode)
|
||||
("\\`wishx?\\'" . tcl-mode)
|
||||
("\\`tcl\\(sh\\)?\\'" . tcl-mode)
|
||||
("\\`expect\\'" . tcl-mode)
|
||||
("\\`scm\\'" . scheme-mode)
|
||||
("\\`[acjkwz]sh\\'" . sh-mode)
|
||||
("\\`bash2?\\'" . sh-mode)
|
||||
("\\`dtksh\\'" . sh-mode)
|
||||
("\\`es\\'" . sh-mode)
|
||||
("\\`itcsh\\'" . sh-mode)
|
||||
("\\`oash\\'" . sh-mode)
|
||||
("\\`pdksh\\'" . sh-mode)
|
||||
("\\`rbash\\'" . sh-mode)
|
||||
("\\`rc\\'" . sh-mode)
|
||||
("\\`rpm\\'" . sh-mode)
|
||||
("\\`sh5?\\'" . sh-mode)
|
||||
("\\`tcsh\\'" . sh-mode)
|
||||
("\\`wksh\\'" . sh-mode)
|
||||
("\\`tail\\'" . text-mode)
|
||||
("\\`more\\'" . text-mode)
|
||||
("\\`less\\'" . text-mode)
|
||||
("\\`pg\\'" . text-mode)
|
||||
("\\`make\\'" . makefile-gmake-mode) ; Debian uses this
|
||||
("\\`guile\\'" . scheme-mode)
|
||||
("\\`clisp\\'" . lisp-mode)
|
||||
("\\`emacs\\'" . emacs-lisp-mode)))
|
||||
'(("\\(mini\\)?perl5?" . perl-mode)
|
||||
("wishx?" . tcl-mode)
|
||||
("tcl\\(sh\\)?" . tcl-mode)
|
||||
("expect" . tcl-mode)
|
||||
("scm" . scheme-mode)
|
||||
("[acjkwz]sh" . sh-mode)
|
||||
("r?bash2?" . sh-mode)
|
||||
("\\(dt\\|pd\\|w\\)ksh" . sh-mode)
|
||||
("es" . sh-mode)
|
||||
("i?tcsh" . sh-mode)
|
||||
("oash" . sh-mode)
|
||||
("rc" . sh-mode)
|
||||
("rpm" . sh-mode)
|
||||
("sh5?" . sh-mode)
|
||||
("tail" . text-mode)
|
||||
("more" . text-mode)
|
||||
("less" . text-mode)
|
||||
("pg" . text-mode)
|
||||
("make" . makefile-gmake-mode) ; Debian uses this
|
||||
("guile" . scheme-mode)
|
||||
("clisp" . lisp-mode)
|
||||
("emacs" . emacs-lisp-mode)))
|
||||
"Alist mapping interpreter names to major modes.
|
||||
This is used for files whose first lines match `auto-mode-interpreter-regexp'.
|
||||
Each element looks like (REGEXP . MODE).
|
||||
If REGEXP matches the name (minus any directory part) of the interpreter
|
||||
specified in the first line of a script, enable major mode MODE.
|
||||
|
||||
Emacs versions earlier than 24.4 treat the car of each element as a
|
||||
literal string that must match the entire name, rather than a regexp.
|
||||
For backwards compatibility, any REGEXP that does not begin with \"\\\\\"
|
||||
continues to be treated in this way. This behavior may be removed in
|
||||
future and should not be relied upon.
|
||||
If \\\\`REGEXP\\\\' matches the name (minus any directory part) of
|
||||
the interpreter specified in the first line of a script, enable
|
||||
major mode MODE.
|
||||
|
||||
See also `auto-mode-alist'.")
|
||||
|
||||
|
@ -2687,13 +2678,11 @@ we don't actually set it to the same mode the buffer already has."
|
|||
;; same time.
|
||||
(setq done (assoc-default
|
||||
(file-name-nondirectory mode)
|
||||
;; Backwards compat: if car of i-m-alist does not start
|
||||
;; with "\\", treat as literal string.
|
||||
(mapcar (lambda (e)
|
||||
(if (string-match-p "\\`\\\\" (car e))
|
||||
(if (string-match-p "\\`\\\\`" (car e))
|
||||
e
|
||||
(cons
|
||||
(format "\\`%s\\'" (regexp-quote (car e)))
|
||||
(format "\\`%s\\'" (car e))
|
||||
(cdr e))))
|
||||
interpreter-mode-alist)
|
||||
#'string-match-p))
|
||||
|
|
|
@ -1555,7 +1555,7 @@ Key bindings:
|
|||
(cons "Pike" (c-lang-const c-mode-menu pike)))
|
||||
|
||||
;;;###autoload (add-to-list 'auto-mode-alist '("\\.\\(u?lpc\\|pike\\|pmod\\(\\.in\\)?\\)\\'" . pike-mode))
|
||||
;;;###autoload (add-to-list 'interpreter-mode-alist '("\\`pike\\'" . pike-mode))
|
||||
;;;###autoload (add-to-list 'interpreter-mode-alist '("pike" . pike-mode))
|
||||
|
||||
;;;###autoload
|
||||
(define-derived-mode pike-mode prog-mode "Pike"
|
||||
|
@ -1589,7 +1589,10 @@ Key bindings:
|
|||
;; Support for AWK
|
||||
|
||||
;;;###autoload (add-to-list 'auto-mode-alist '("\\.awk\\'" . awk-mode))
|
||||
;;;###autoload (add-to-list 'interpreter-mode-alist '("\\`[gmn]?awk\\'" . awk-mode))
|
||||
;;;###autoload (add-to-list 'interpreter-mode-alist '("awk" . awk-mode))
|
||||
;;;###autoload (add-to-list 'interpreter-mode-alist '("mawk" . awk-mode))
|
||||
;;;###autoload (add-to-list 'interpreter-mode-alist '("nawk" . awk-mode))
|
||||
;;;###autoload (add-to-list 'interpreter-mode-alist '("gawk" . awk-mode))
|
||||
|
||||
(c-define-abbrev-table 'awk-mode-abbrev-table
|
||||
'(("else" "else" c-electric-continued-statement 0)
|
||||
|
|
|
@ -225,7 +225,7 @@
|
|||
;;;###autoload
|
||||
(add-to-list 'auto-mode-alist (cons (purecopy "\\.py\\'") 'python-mode))
|
||||
;;;###autoload
|
||||
(add-to-list 'interpreter-mode-alist (cons (purecopy "\\`python[0-9.]*\\'") 'python-mode))
|
||||
(add-to-list 'interpreter-mode-alist (cons (purecopy "python[0-9.]*") 'python-mode))
|
||||
|
||||
(defgroup python nil
|
||||
"Python Language's flying circus support for Emacs."
|
||||
|
|
|
@ -1968,7 +1968,8 @@ The variable `ruby-indent-level' controls the amount of indentation.
|
|||
"\\)\\'")) 'ruby-mode))
|
||||
|
||||
;;;###autoload
|
||||
(add-to-list 'interpreter-mode-alist (cons (purecopy "\\`\\(rbx\\|j?ruby\\(1\\.[89]\\)?\\)\\'") 'ruby-mode))
|
||||
(dolist (name (list "ruby" "rbx" "jruby" "ruby1.9" "ruby1.8"))
|
||||
(add-to-list 'interpreter-mode-alist (cons (purecopy name) 'ruby-mode)))
|
||||
|
||||
(provide 'ruby-mode)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue