/[emacs]/emacs/lisp/progmodes/executable.el
ViewVC logotype

Diff of /emacs/lisp/progmodes/executable.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.26 by monnier, Sun Oct 14 20:09:46 2001 UTC revision 1.27 by monnier, Sun May 18 21:37:23 2003 UTC
# Line 1  Line 1 
1  ;;; executable.el --- base functionality for executable interpreter scripts -*- byte-compile-dynamic: t -*-  ;;; executable.el --- base functionality for executable interpreter scripts -*- byte-compile-dynamic: t -*-
2    
3  ;; Copyright (C) 1994, 1995, 1996, 2000 by Free Software Foundation, Inc.  ;; Copyright (C) 1994, 1995, 1996, 2000, 2003 by Free Software Foundation, Inc.
4    
5  ;; Author: Daniel Pfeiffer <occitan@esperanto.org>  ;; Author: Daniel Pfeiffer <occitan@esperanto.org>
6  ;; Keywords: languages, unix  ;; Keywords: languages, unix
# Line 227  executable." Line 227  executable."
227        (not (or insert-flag executable-insert))        (not (or insert-flag executable-insert))
228        (> (point-min) 1)        (> (point-min) 1)
229        (save-excursion        (save-excursion
230          (let ((point (point-marker))          (goto-char (point-min))
231                (buffer-modified-p (buffer-modified-p)))          (add-hook 'after-save-hook 'executable-chmod nil t)
232            (goto-char (point-min))          (if (looking-at "#![ \t]*\\(.*\\)$")
233            (add-hook 'after-save-hook 'executable-chmod nil t)              (and (goto-char (match-beginning 1))
234            (if (looking-at "#![ \t]*\\(.*\\)$")                   ;; If the line ends in a space,
235                (and (goto-char (match-beginning 1))                   ;; don't offer to change it.
236                     ;; If the line ends in a space,                   (not (= (char-after (1- (match-end 1))) ?\ ))
237                     ;; don't offer to change it.                   (not (string= argument
238                     (not (= (char-after (1- (match-end 1))) ?\ ))                                 (buffer-substring (point) (match-end 1))))
239                     (not (string= argument                   (if (or (not executable-query) no-query-flag
240                                   (buffer-substring (point) (match-end 1))))                           (save-window-excursion
241                     (if (or (not executable-query) no-query-flag                             ;; Make buffer visible before question.
242                             (save-window-excursion                             (switch-to-buffer (current-buffer))
243                               ;; Make buffer visible before question.                             (y-or-n-p (concat "Replace magic number by `"
244                               (switch-to-buffer (current-buffer))                                               executable-prefix argument "'? "))))
245                               (y-or-n-p (concat "Replace magic number by `"                       (progn
246                                                 executable-prefix argument "'? "))))                         (replace-match argument t t nil 1)
247                         (progn                         (message "Magic number changed to `%s'"
248                           (replace-match argument t t nil 1)                                  (concat executable-prefix argument)))))
249                           (message "Magic number changed to `%s'"            (insert executable-prefix argument ?\n)
250                                    (concat executable-prefix argument)))))            (message "Magic number changed to `%s'"
251              (insert executable-prefix argument ?\n)                     (concat executable-prefix argument)))))
             (message "Magic number changed to `%s'"  
                      (concat executable-prefix argument)))  
 ;;;       (or insert-flag  
 ;;;           (eq executable-insert t)  
 ;;;           (set-buffer-modified-p buffer-modified-p))  
           )))  
252      interpreter)      interpreter)
253    
254    
# Line 276  file modes." Line 270  file modes."
270    (and (>= (buffer-size) 2)    (and (>= (buffer-size) 2)
271         (save-restriction         (save-restriction
272           (widen)           (widen)
273           (string= "#!" (buffer-substring 1 3)))           (string= "#!" (buffer-substring (point-min) (+ 2 (point-min)))))
274         (let* ((current-mode (file-modes (buffer-file-name)))         (let* ((current-mode (file-modes (buffer-file-name)))
275                (add-mode (logand ?\111 (default-file-modes))))                (add-mode (logand ?\111 (default-file-modes))))
276           (or (/= (logand ?\111 current-mode) 0)           (or (/= (logand ?\111 current-mode) 0)

Legend:
Removed from v.1.26  
changed lines
  Added in v.1.27

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26