emacs: calling chmod causes "file is no longer readable" warning -
i'm writing function designed make whatever file in current buffer writable without being prompted name or mode (which want 644). want buffer refreshed automatically reflect fact contents writable.
i have following code in .emacs file:
;; http://www.stokebloke.com/wordpress/2008/04/17/emacs-refresh-f5-key/ (defun refresh-file () "refresh buffer disk (prompt if modified)." (interactive) (revert-buffer t (not (buffer-modified-p)) t)) (defun my-make-writable () "make file writable owner" (interactive) (chmod buffer-file-name 644) (refresh-file)) however, when execute function, emacs displays following error message in minibuffer:
file filename no longer readable
this rather unnerving. however, can still execute "chmod" command make file readable , writable.
what can make function work correctly?
the unix permission bits expressed in octal , feeding in decimal number.
you setting file mode 1204 (that is, "sticky-bit, user can write, group has no permissions, else can read). if use (chmod buffer-file-name #o644) or (chmod buffer-file-name 420) result expecting.
Comments
Post a Comment