1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Treat interpreter-mode-alist as alist of regexps, not literals

Cf http://lists.gnu.org/archive/html/emacs-devel/2005-08/msg00472.html

* lisp/files.el (interpreter-mode-alist): Convert to regexps.
(set-auto-mode): Adapt for this. 

* lisp/progmodes/cperl-mode.el (cperl-clobber-mode-lists):
Comment out unused variable.

* lisp/progmodes/cc-mode.el (interpreter-mode-alist):
* lisp/progmodes/python.el (interpreter-mode-alist):
* lisp/progmodes/ruby-mode.el (interpreter-mode-alist): Convert to regexps.

* lisp/progmodes/sh-script.el (sh-set-shell):
No longer use interpreter-mode-alist to get list of shells.

* etc/NEWS: Mention this.

Fixes: debbugs:15306
This commit is contained in:
Glenn Morris 2013-09-10 16:38:52 -04:00
parent 6a5c15d95f
commit 1af4c2203c
8 changed files with 99 additions and 75 deletions

View file

@ -2170,11 +2170,18 @@ the visited file executable, and NO-QUERY-FLAG (the second argument)
controls whether to query about making the visited file executable.
Calls the value of `sh-set-shell-hook' if set."
(interactive (list (completing-read (format "Shell \(default %s\): "
sh-shell-file)
interpreter-mode-alist
(lambda (x) (eq (cdr x) 'sh-mode))
nil nil nil sh-shell-file)
(interactive (list (completing-read
(format "Shell \(default %s\): "
sh-shell-file)
;; This used to use interpreter-mode-alist, but that is
;; no longer appropriate now that uses regexps.
;; Maybe there could be a separate variable that lists
;; the shells, used here and to construct i-mode-alist.
;; But the following is probably good enough:
(append (mapcar (lambda (e) (symbol-name (car e)))
sh-ancestor-alist)
'("csh" "rc" "sh"))
nil nil nil nil sh-shell-file)
(eq executable-query 'function)
t))
(if (string-match "\\.exe\\'" shell)