bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

wildcards in call-process


From: David
Subject: wildcards in call-process
Date: Tue, 27 Feb 2001 06:26:57 -0700

;;; -*-Mode: lisp-interaction; Coding: raw-data; fill-column: 78-*-

;;; I do not know if this is a bug, but it seems that way to me.

;;; "GNU Emacs 20.7.1 (i586-pc-linux-gnu, X toolkit)
;;;  of Mon Feb 19 2001 on Blackhand.Anthrax"
;;; bash shell

;;; Set up Emacs with a shell in one window and this file in another.  Then
;;; evaluate this code piece by piece and check the results in the shell when
;;; appropriate.  You may like to have third window to see a buffer "look"
;;; that is created as you go.


;; Set this to your place.  Stuff is written into this directory.
(defconst  home-dir  "/home/dajo/")

;; Variables that define directory and file names.  There is nothing to check;
;; just evaluate them.
(defconst  dir-y   (concat  home-dir  "yyyy-delete-me/"))
(defconst  dir-z   (concat  home-dir  "zzzz-delete-me/"))
(defconst  file-a  (concat  dir-y     "aaa.mmm.zzz"))
(defconst  file-b  (concat  dir-y     "bbb.mmm.zzz"))

;; Create the directories.  You can check for these in the shell.
(if  (not  (file-exists-p  dir-y))  (make-directory  dir-y))
(if  (not  (file-exists-p  dir-z))  (make-directory  dir-z))

;; Create the files.  Check for these.
(if  (not  (file-exists-p  file-a))  (save-excursion
                                       (save-window-excursion
                                         (set-buffer
                                          (find-file-noselect  file-a))
                                         (insert  "this is file-a\n")
                                         (save-buffer)
                                         (kill-buffer  (current-buffer))) ))

(if  (not  (file-exists-p  file-b))  (save-excursion
                                       (save-window-excursion
                                         (set-buffer
                                          (find-file-noselect  file-b))
                                         (insert  "this is file-b\n")
                                         (save-buffer)
                                         (kill-buffer  (current-buffer))) ))

;; If you execute the command below in your place in the shell, it works; so
;; does the lisp code (if you do one you will have to undo it to do the
;; other).  The lisp is intended to be identical in effect to the shell
;; command; and it seems to be that way.  Buffer look is created by the lisp,
;; but there is nothing in it.

;;; mv  yyyy-delete-me/aaa.mmm.zzz  zzzz-delete-me/aaa.ooo

(call-process 
 "mv"                                ; programme
 'nil                                ; no input
 "look"                              ; output buffer
 't                                  ; keep buffer up to date
 (concat  dir-y  "aaa.mmm.zzz"       ; source
          )
 (concat  dir-z  "aaa.ooo"           ; sink
          ))


;; If you execute either of the commands below in the shell, it works; the
;; lisp does not.  Buffer look contains one of the messages, according to
;; whether or not you use shell-quote-argument.

;;; mv  yyyy-delete-me/bbb.*.zzz  zzzz-delete-me/bbb.ooo
;;; mv  /home/dajo/yyyy-delete-me/bbb.*.zzz  /home/dajo/zzzz-delete-me/bbb.ooo

;;; /bin/mv: /home/dajo/yyyy-delete-me/bbb.*.zzz: No such file or directory
;;; /bin/mv: /home/dajo/yyyy-delete-me/bbb.\*.zzz: No such file or directory

(call-process 
 "mv"  
 'nil
 "look"
 't    
;;; (shell-quote-argument            ; try this if you like
 (concat  dir-y  "bbb.*.zzz"
          )
;;;  )
 (concat  dir-z  "bbb.ooo"
          ))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]