unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* [patch] 21.2 executable.el - Better shebang spport (#!)
@ 2002-08-22 11:32 Jari Aalto+mail.emacs
  2002-08-23  8:35 ` Andreas Schwab
  0 siblings, 1 reply; 2+ messages in thread
From: Jari Aalto+mail.emacs @ 2002-08-22 11:32 UTC (permalink / raw)



A more flexible detection....

Jari


2002-08-22  Jari Aalto  <jari.aalto@poboxes.com>

	* progmodes/executable.el
	(executable-make-buffer-file-executable-if-script-p):
	Better shebang detection. Before #! can be spaces.


--- executable.el.orig	2002-08-22 14:25:02.000000000 +0300
+++ executable.el	2002-08-22 14:26:56.000000000 +0300
@@ -280,7 +280,8 @@
   (and (>= (buffer-size) 2)
        (save-restriction
 	 (widen)
-	 (string= "#!" (buffer-substring 1 3)))
+	 (goto-char (point-min))
+	 (looking-at "^[ \t]*#!"))
        (let* ((current-mode (file-modes (buffer-file-name)))
               (add-mode (logand ?\111 (default-file-modes))))
          (or (/= (logand ?\111 current-mode) 0)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-08-23  8:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-08-22 11:32 [patch] 21.2 executable.el - Better shebang spport (#!) Jari Aalto+mail.emacs
2002-08-23  8:35 ` Andreas Schwab

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).