[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
executable-set-magic update
From: |
Andrew L. Moore |
Subject: |
executable-set-magic update |
Date: |
Fri, 9 Jun 2017 17:31:30 -0400 |
lisp/progmodes/executable.el does not appear to support magic numbers of the
form `#/usr/bin/env interpreter’. One way to extend support is via the
attached diff which merely adds a new variable
`executable-interpreter-path-absolute’. Set the new variable to nil and
variable `executable-prefix’ to “#!/usr/bin/env “.
It would also be nice if `executable-set-magic’ were supported beyond
`sh-set-shell’ (in lisp/progmodes/sh-script.el), so I implemented a minor mode
that adds the following hook to find-file:
(defun script-set-magic ()
"Look up interpreter associated with current major mode in
`script-set-magic-alist' and call `executable-set-magic'."
(let ((interpreter (alist-get major-mode script-set-magic-alist)))
(if interpreter (executable-set-magic interpreter)))
)
The minor mode file is available as:
<https://github.com/slewsys/emacs-extensions/blob/master/script-set-magic.el>
-AM
lisp_progmodes_executable.el.diff
Description: Binary data
- executable-set-magic update,
Andrew L. Moore <=