dimanche 16 août 2015

Make current file executable

Small snippet to make the script you're editing executable:

(defun chmodx (file)
  (interactive
   (list (buffer-file-name)))
  (cond ((null file)
         (error "file is nil"))
        ((not (stringp file))
         (error "file is not a string"))
        ((not (file-exists-p file))
         (error "%s doesn't exists" file)))
  (shell-command (concat "chmod +x " (shell-quote-argument file))))

Aucun commentaire:

Enregistrer un commentaire