diff --git a/src/lib/io.el b/src/lib/io.el index fcc64cb..0c5517d 100644 --- a/src/lib/io.el +++ b/src/lib/io.el @@ -16,16 +16,38 @@ ;; IO library -(defun io/read (FILE) - "Read the contents of a file into a buffer and return the content. -already opend buffer died after reading content." + +(defun io/read-buf (FILE) + "Read the file content of FILE into a buffer and return +the buffer it self." (if (file-readable-p FILE) - (let (x data) - (setq x (find-file FILE)) - (setq data (buffer-string)) - (kill-buffer x) - (identity data) + (let (read-buffer) + (setq read-buffer (find-file FILE)) ) + (error "Can't read '%s' file.") ) ) + +(defun io/read (FILE) + "Read the contents of FILE into a buffer and return the content. +already opend buffer died after reading content." + (let (buf data) + (setq buf (io/read-buf FILE)) + (setq data (buffer-string)) + (kill-buffer buf) + (identity data) + ) + ) + +(defun io/write (FILE STRING) + "Write the STRING into FILE if file was writable." + (if (file-writable-p FILE) + (with-temp-buffer + (insert STR) + (write-region (point-min) + (point-max) + FILE) + ) + ) + ) diff --git a/src/shit-ide.el b/src/shit-ide.el index e4fc4e0..f67573d 100644 --- a/src/shit-ide.el +++ b/src/shit-ide.el @@ -66,7 +66,6 @@ (if (= DEBUG 1) (message "[SHIT] DEBUG >>> %s" ARG)) ) - (defun start-shit () "A peace of shit configuration that tune emacs to be an IDE." (interactive)