User: malcolmp
Date: 05/10/15 23:27:07
Modified: packages/xemacs-packages/sh-script ChangeLog executable.el
Log:
executable.el: Sync with GNU Emacs 22.0.50.1 (CVS).
Revision Changes Path
1.22 +5 -0 XEmacs/packages/xemacs-packages/sh-script/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/sh-script/ChangeLog,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -p -r1.21 -r1.22
--- ChangeLog 2005/10/15 17:05:10 1.21
+++ ChangeLog 2005/10/15 21:27:06 1.22
@@ -1,3 +1,8 @@
+2005-10-15 Malcolm Purvis <malcolmp(a)xemacs.org>
+
+ * executable.el: Sync with GNU Emacs 22.0.50.1 (CVS). Update
+ FSF's address in GPL notices.
+
2005-10-15 Norbert Koch <viteno(a)xemacs.org>
* Makefile (VERSION): XEmacs package 1.19 released.
1.4 +56 -42 XEmacs/packages/xemacs-packages/sh-script/executable.el
Index: executable.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/sh-script/executable.el,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -p -r1.3 -r1.4
--- executable.el 2002/04/07 16:52:02 1.3
+++ executable.el 2005/10/15 21:27:07 1.4
@@ -1,6 +1,6 @@
;;; executable.el --- base functionality for executable interpreter scripts -*-
byte-compile-dynamic: t -*-
-;; Copyright (C) 1994, 1995, 1996, 2000 by Free Software Foundation, Inc.
+;; Copyright (C) 1994, 1995, 1996, 2000, 2003, 2004 by Free Software Foundation, Inc.
;; Author: Daniel Pfeiffer <occitan(a)esperanto.org>
;; Keywords: languages, unix
@@ -19,10 +19,10 @@
;; You should have received a copy of the GNU General Public License
;; along with XEmacs; see the file COPYING. If not, write to the Free
-;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-;; 02111-1307, USA.
+;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor
+;; Boston, MA 02110-1301, USA.
-;;; Synched up with: GNU Emacs 21.2.
+;;; Synched up with: FSF 22.0.50.1 (CVS)
;;; Commentary:
@@ -152,8 +152,29 @@ See `compilation-error-regexp-alist'.")
'("")))
;;;###autoload
+(defun executable-command-find-posix-p (&optional program)
+ "Check if PROGRAM handles arguments Posix-style.
+If PROGRAM is non-nil, use that instead of \"find\"."
+ ;; Pick file to search from location we know
+ (let* ((dir (file-truename data-directory))
+ (file (car (directory-files dir nil "^[^.]"))))
+ (with-temp-buffer
+ (call-process (or program "find")
+ nil
+ (current-buffer)
+ nil
+ dir
+ "-name"
+ file
+ "-maxdepth"
+ "1")
+ (goto-char (point-min))
+ (if (search-forward file nil t)
+ t))))
+
+;;;###autoload
(defun executable-find (command)
- "Search for COMMAND in exec-path and return the absolute file name.
+ "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)
@@ -189,20 +210,20 @@ non-executable files."
(file-modes buffer-file-name)))))))
+;;;###autoload
(defun executable-interpret (command)
"Run script with user-specified args, and collect output in a buffer.
-While script runs asynchronously, you can use the \\[next-error] command
-to find the next error."
+While script runs asynchronously, you can use the \\[next-error]
+command to find the next error. The buffer is also in `comint-mode' and
+`compilation-shell-minor-mode', so that you can answer any prompts."
(interactive (list (read-string "Run script: "
(or executable-command
buffer-file-name))))
(require 'compile)
(save-some-buffers (not compilation-ask-about-save))
- (make-local-variable 'executable-command)
- (compile-internal (setq executable-command command)
- "No more errors." "Interpretation"
- ;; Give it a simpler regexp to match.
- nil executable-error-regexp-alist))
+ (set (make-local-variable 'executable-command) command)
+ (let ((compilation-error-regexp-alist executable-error-regexp-alist))
+ (compile-internal command t (lambda (x) "*interpretation*"))))
@@ -238,35 +259,28 @@ executable."
(not (or insert-flag executable-insert))
(> (point-min) 1)
(save-excursion
- (let ((point (point-marker))
- (buffer-modified-p (buffer-modified-p)))
- (goto-char (point-min))
- (make-local-hook 'after-save-hook)
- (add-hook 'after-save-hook 'executable-chmod nil t)
- (if (looking-at "#![ \t]*\\(.*\\)$")
- (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 (string= argument
- (buffer-substring (point) (match-end 1))))
- (if (or (not executable-query) no-query-flag
- (save-window-excursion
- ;; Make buffer visible before question.
- (switch-to-buffer (current-buffer))
- (y-or-n-p (concat "Replace magic number by `"
- executable-prefix argument "'? "))))
- (progn
- (replace-match argument t t nil 1)
- (message "Magic number changed to `%s'"
- (concat executable-prefix argument)))))
- (insert executable-prefix argument ?\n)
- (message "Magic number changed to `%s'"
- (concat executable-prefix argument)))
-;;; (or insert-flag
-;;; (eq executable-insert t)
-;;; (set-buffer-modified-p buffer-modified-p))
- )))
+ (goto-char (point-min))
+ (add-hook 'after-save-hook 'executable-chmod nil t)
+ (if (looking-at "#![ \t]*\\(.*\\)$")
+ (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 (string= argument
+ (buffer-substring (point) (match-end 1))))
+ (if (or (not executable-query) no-query-flag
+ (save-window-excursion
+ ;; Make buffer visible before question.
+ (switch-to-buffer (current-buffer))
+ (y-or-n-p (concat "Replace magic number by `"
+ executable-prefix argument "'? "))))
+ (progn
+ (replace-match argument t t nil 1)
+ (message "Magic number changed to `%s'"
+ (concat executable-prefix argument)))))
+ (insert executable-prefix argument ?\n)
+ (message "Magic number changed to `%s'"
+ (concat executable-prefix argument)))))
interpreter)
@@ -288,7 +302,7 @@ file modes."
(and (>= (buffer-size) 2)
(save-restriction
(widen)
- (string= "#!" (buffer-substring 1 3)))
+ (string= "#!" (buffer-substring (point-min) (+ 2 (point-min)))))
(let* ((current-mode (file-modes (buffer-file-name)))
(add-mode (logand ?\111 (default-file-modes))))
(or (/= (logand ?\111 current-mode) 0)