aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2013-09-10 23:44:35 -0700
committerGlenn Morris2013-09-10 23:44:35 -0700
commit2a08047aed0017cc2b639e189fc3b5d41c46fcbd (patch)
treeb75a8ecbec1344d13f630dcc2e00eb2220df9f8b
parentcb55925848ce8359ac695b69bf7b278024c304c0 (diff)
downloademacs-2a08047aed0017cc2b639e189fc3b5d41c46fcbd.tar.gz
emacs-2a08047aed0017cc2b639e189fc3b5d41c46fcbd.zip
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.
-rw-r--r--etc/NEWS8
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/files.el65
-rw-r--r--lisp/progmodes/cc-mode.el7
-rw-r--r--lisp/progmodes/python.el2
-rw-r--r--lisp/progmodes/ruby-mode.el3
6 files changed, 47 insertions, 47 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 929c86a7ba6..a5da8eaa893 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -616,11 +616,9 @@ Formerly it returned a list (-1 LOW USEC PSEC), but this was ambiguous
616in the presence of files with negative time stamps. 616in the presence of files with negative time stamps.
617 617
618** The cars of the elements in `interpreter-mode-alist' are now treated 618** The cars of the elements in `interpreter-mode-alist' are now treated
619as regexps rather than literal strings. For the time being, any 619as regexps rather than literal strings. Technically this is an
620element whose car does not start with "\\" is still treated as a 620incompatible change, but unless you are using interpreter-mode-alist
621literal string, so this change should not cause any incompatibilities 621for something (not just adding elements to it), it ought not to affect you.
622if you have code that just adds elements to the list, only if you are
623actually using interpreter-mode-alist for something.
624 622
625 623
626* Lisp Changes in Emacs 24.4 624* Lisp Changes in Emacs 24.4
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e1f1aaa1888..89610870f10 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
12013-09-11 Glenn Morris <rgm@gnu.org>
2
3 * files.el (interpreter-mode-alist): Remove \\` \\' parts.
4 (set-auto-mode): Don't regexp-quote elements.
5 * progmodes/python.el (interpreter-mode-alist): Remove \\` \\'.
6 * progmodes/cc-mode.el (interpreter-mode-alist):
7 * progmodes/ruby-mode.el (interpreter-mode-alist):
8 Revert previous change.
9
12013-09-11 Stefan Monnier <monnier@iro.umontreal.ca> 102013-09-11 Stefan Monnier <monnier@iro.umontreal.ca>
2 11
3 * play/snake.el (snake-mode): 12 * play/snake.el (snake-mode):
diff --git a/lisp/files.el b/lisp/files.el
index 2315448c549..5d8fbda6154 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2447,43 +2447,34 @@ and `magic-mode-alist', which determines modes based on file contents.")
2447 (mapcar 2447 (mapcar
2448 (lambda (l) 2448 (lambda (l)
2449 (cons (purecopy (car l)) (cdr l))) 2449 (cons (purecopy (car l)) (cdr l)))
2450 '(("\\`\\(mini\\)?perl5?\\'" . perl-mode) 2450 '(("\\(mini\\)?perl5?" . perl-mode)
2451 ("\\`wishx?\\'" . tcl-mode) 2451 ("wishx?" . tcl-mode)
2452 ("\\`tcl\\(sh\\)?\\'" . tcl-mode) 2452 ("tcl\\(sh\\)?" . tcl-mode)
2453 ("\\`expect\\'" . tcl-mode) 2453 ("expect" . tcl-mode)
2454 ("\\`scm\\'" . scheme-mode) 2454 ("scm" . scheme-mode)
2455 ("\\`[acjkwz]sh\\'" . sh-mode) 2455 ("[acjkwz]sh" . sh-mode)
2456 ("\\`bash2?\\'" . sh-mode) 2456 ("r?bash2?" . sh-mode)
2457 ("\\`dtksh\\'" . sh-mode) 2457 ("\\(dt\\|pd\\|w\\)ksh" . sh-mode)
2458 ("\\`es\\'" . sh-mode) 2458 ("es" . sh-mode)
2459 ("\\`itcsh\\'" . sh-mode) 2459 ("i?tcsh" . sh-mode)
2460 ("\\`oash\\'" . sh-mode) 2460 ("oash" . sh-mode)
2461 ("\\`pdksh\\'" . sh-mode) 2461 ("rc" . sh-mode)
2462 ("\\`rbash\\'" . sh-mode) 2462 ("rpm" . sh-mode)
2463 ("\\`rc\\'" . sh-mode) 2463 ("sh5?" . sh-mode)
2464 ("\\`rpm\\'" . sh-mode) 2464 ("tail" . text-mode)
2465 ("\\`sh5?\\'" . sh-mode) 2465 ("more" . text-mode)
2466 ("\\`tcsh\\'" . sh-mode) 2466 ("less" . text-mode)
2467 ("\\`wksh\\'" . sh-mode) 2467 ("pg" . text-mode)
2468 ("\\`tail\\'" . text-mode) 2468 ("make" . makefile-gmake-mode) ; Debian uses this
2469 ("\\`more\\'" . text-mode) 2469 ("guile" . scheme-mode)
2470 ("\\`less\\'" . text-mode) 2470 ("clisp" . lisp-mode)
2471 ("\\`pg\\'" . text-mode) 2471 ("emacs" . emacs-lisp-mode)))
2472 ("\\`make\\'" . makefile-gmake-mode) ; Debian uses this
2473 ("\\`guile\\'" . scheme-mode)
2474 ("\\`clisp\\'" . lisp-mode)
2475 ("\\`emacs\\'" . emacs-lisp-mode)))
2476 "Alist mapping interpreter names to major modes. 2472 "Alist mapping interpreter names to major modes.
2477This is used for files whose first lines match `auto-mode-interpreter-regexp'. 2473This is used for files whose first lines match `auto-mode-interpreter-regexp'.
2478Each element looks like (REGEXP . MODE). 2474Each element looks like (REGEXP . MODE).
2479If REGEXP matches the name (minus any directory part) of the interpreter 2475If \\\\`REGEXP\\\\' matches the name (minus any directory part) of
2480specified in the first line of a script, enable major mode MODE. 2476the interpreter specified in the first line of a script, enable
2481 2477major mode MODE.
2482Emacs versions earlier than 24.4 treat the car of each element as a
2483literal string that must match the entire name, rather than a regexp.
2484For backwards compatibility, any REGEXP that does not begin with \"\\\\\"
2485continues to be treated in this way. This behavior may be removed in
2486future and should not be relied upon.
2487 2478
2488See also `auto-mode-alist'.") 2479See also `auto-mode-alist'.")
2489 2480
@@ -2687,13 +2678,11 @@ we don't actually set it to the same mode the buffer already has."
2687 ;; same time. 2678 ;; same time.
2688 (setq done (assoc-default 2679 (setq done (assoc-default
2689 (file-name-nondirectory mode) 2680 (file-name-nondirectory mode)
2690 ;; Backwards compat: if car of i-m-alist does not start
2691 ;; with "\\", treat as literal string.
2692 (mapcar (lambda (e) 2681 (mapcar (lambda (e)
2693 (if (string-match-p "\\`\\\\" (car e)) 2682 (if (string-match-p "\\`\\\\`" (car e))
2694 e 2683 e
2695 (cons 2684 (cons
2696 (format "\\`%s\\'" (regexp-quote (car e))) 2685 (format "\\`%s\\'" (car e))
2697 (cdr e)))) 2686 (cdr e))))
2698 interpreter-mode-alist) 2687 interpreter-mode-alist)
2699 #'string-match-p)) 2688 #'string-match-p))
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index bffc5b95d25..e977a415d62 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -1555,7 +1555,7 @@ Key bindings:
1555 (cons "Pike" (c-lang-const c-mode-menu pike))) 1555 (cons "Pike" (c-lang-const c-mode-menu pike)))
1556 1556
1557;;;###autoload (add-to-list 'auto-mode-alist '("\\.\\(u?lpc\\|pike\\|pmod\\(\\.in\\)?\\)\\'" . pike-mode)) 1557;;;###autoload (add-to-list 'auto-mode-alist '("\\.\\(u?lpc\\|pike\\|pmod\\(\\.in\\)?\\)\\'" . pike-mode))
1558;;;###autoload (add-to-list 'interpreter-mode-alist '("\\`pike\\'" . pike-mode)) 1558;;;###autoload (add-to-list 'interpreter-mode-alist '("pike" . pike-mode))
1559 1559
1560;;;###autoload 1560;;;###autoload
1561(define-derived-mode pike-mode prog-mode "Pike" 1561(define-derived-mode pike-mode prog-mode "Pike"
@@ -1589,7 +1589,10 @@ Key bindings:
1589;; Support for AWK 1589;; Support for AWK
1590 1590
1591;;;###autoload (add-to-list 'auto-mode-alist '("\\.awk\\'" . awk-mode)) 1591;;;###autoload (add-to-list 'auto-mode-alist '("\\.awk\\'" . awk-mode))
1592;;;###autoload (add-to-list 'interpreter-mode-alist '("\\`[gmn]?awk\\'" . awk-mode)) 1592;;;###autoload (add-to-list 'interpreter-mode-alist '("awk" . awk-mode))
1593;;;###autoload (add-to-list 'interpreter-mode-alist '("mawk" . awk-mode))
1594;;;###autoload (add-to-list 'interpreter-mode-alist '("nawk" . awk-mode))
1595;;;###autoload (add-to-list 'interpreter-mode-alist '("gawk" . awk-mode))
1593 1596
1594(c-define-abbrev-table 'awk-mode-abbrev-table 1597(c-define-abbrev-table 'awk-mode-abbrev-table
1595 '(("else" "else" c-electric-continued-statement 0) 1598 '(("else" "else" c-electric-continued-statement 0)
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 5eecc347f03..5f919bf495f 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -225,7 +225,7 @@
225;;;###autoload 225;;;###autoload
226(add-to-list 'auto-mode-alist (cons (purecopy "\\.py\\'") 'python-mode)) 226(add-to-list 'auto-mode-alist (cons (purecopy "\\.py\\'") 'python-mode))
227;;;###autoload 227;;;###autoload
228(add-to-list 'interpreter-mode-alist (cons (purecopy "\\`python[0-9.]*\\'") 'python-mode)) 228(add-to-list 'interpreter-mode-alist (cons (purecopy "python[0-9.]*") 'python-mode))
229 229
230(defgroup python nil 230(defgroup python nil
231 "Python Language's flying circus support for Emacs." 231 "Python Language's flying circus support for Emacs."
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index 9dc2c4fb6c9..0f868255589 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -1968,7 +1968,8 @@ The variable `ruby-indent-level' controls the amount of indentation.
1968 "\\)\\'")) 'ruby-mode)) 1968 "\\)\\'")) 'ruby-mode))
1969 1969
1970;;;###autoload 1970;;;###autoload
1971(add-to-list 'interpreter-mode-alist (cons (purecopy "\\`\\(rbx\\|j?ruby\\(1\\.[89]\\)?\\)\\'") 'ruby-mode)) 1971(dolist (name (list "ruby" "rbx" "jruby" "ruby1.9" "ruby1.8"))
1972 (add-to-list 'interpreter-mode-alist (cons (purecopy name) 'ruby-mode)))
1972 1973
1973(provide 'ruby-mode) 1974(provide 'ruby-mode)
1974 1975