Michael Cadilhac <[EMAIL PROTECTED]> writes:
>
>   - chmod: Change the mode of any file.

I made myself M-x chmod below, to change the current visited file.  I
usually just want to make a script executable.  I know there's an
executable-chmod or something, but I can never remember and prefer
typing 755 or 700.  The save-buffer is in case it's a new file.


(defun chmod (mode)
  "Set the mode of the current file, as per the chmod program."
  (interactive "sMode (3 or 4 octal digits): ")
  (if (string-match "[0-3]?[0-7][0-7][0-7]" mode)
      (progn
        (unless (file-exists-p (buffer-file-name))
          (save-buffer))
        (set-file-modes (buffer-file-name) (string-to-number mode 8)))
    (error "Invalid mode")))


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

Reply via email to