;;; executable.el --- base functionality for executable interpreter scripts -*- byte-compile-dynamic: t -*-
-;; Copyright (C) 1994, 1995, 1996, 2000, 2003, 2004 by Free Software Foundation, Inc.
+;; Copyright (C) 1994, 1995, 1996, 2000, 2001, 2002, 2003, 2004, 2005,
+;; 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
;; Author: Daniel Pfeiffer <occitan@esperanto.org>
;; Keywords: languages, unix
;; This file is part of GNU Emacs.
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;; Code:
(defgroup executable nil
- "Base functionality for executable interpreter scripts"
+ "Base functionality for executable interpreter scripts."
:group 'processes)
;; This used to default to `other', but that doesn't seem to have any
(if (search-forward file nil t)
t))))
-;;;###autoload
-(defun executable-find (command)
- "Search for COMMAND in `exec-path' and return the absolute file name.
-Return nil if COMMAND is not found anywhere in `exec-path'."
- (let ((list exec-path)
- file)
- (while list
- (setq list
- (if (and (setq file (expand-file-name command (car list)))
- (let ((suffixes exec-suffixes)
- candidate)
- (while suffixes
- (setq candidate (concat file (car suffixes)))
- (if (and (file-executable-p candidate)
- (not (file-directory-p candidate)))
- (setq suffixes nil)
- (setq suffixes (cdr suffixes))
- (setq candidate nil)))
- (setq file candidate)))
- nil
- (setq file nil)
- (cdr list))))
- file))
-
(defun executable-chmod ()
"This gets called after saving a file to assure that it be executable.
You can set the absolute or relative mode in variable `executable-chmod' for
(and (goto-char (match-beginning 1))
;; If the line ends in a space,
;; don't offer to change it.
- (not (= (char-after (1- (match-end 1))) ?\ ))
+ (not (= (char-after (1- (match-end 1))) ?\s))
(not (string= argument
(buffer-substring (point) (match-end 1))))
(if (or (not executable-query) no-query-flag
(provide 'executable)
-;;; arch-tag: 58458d1c-d9db-45ec-942b-8bbb1d5e319d
+;; arch-tag: 58458d1c-d9db-45ec-942b-8bbb1d5e319d
;;; executable.el ends here