add file-utils.el

This commit is contained in:
aborn 2014-01-23 22:52:09 +08:00
parent 64b2dc47b1
commit f51a5e5de6
2 changed files with 38 additions and 0 deletions

View File

@ -8,3 +8,7 @@ alias grep='grep --color=always'
alias egrep='egrep --color=auto'
alias emacs='emacs -nw'
alias elisp='emacs -Q --script'
alias du0='du --max-depth=0 . -lh'
alias du1='du --max-depth=1 . -lh'
alias du2='du --max-depth=2 . -lh'
alias pdf='evince'

34
elisp/file-utils.el Normal file
View File

@ -0,0 +1,34 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; NAME
;; file-utils.el all elisp files operation
;; related function definition
;;
;; USAGE
;; (load "/path/to/file-utils.el")
;;
;; AUTHOR
;; Aborn Jiang (aborn.jiang@gmail.com)
;;
;; VERSIOIN
;; v0.1 2014-01-23 function: obtain-file-content
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun obtain-file-content (filename)
"Return file content as a string list."
(interactive "p")
(with-temp-buffer
(insert-file-contents filename)
(buffer-string)
)
)
(defun print-elements-of-list (list)
"Print each element in list."
(interactive "p")
(setq i 0)
(while list
(print (concat (number-to-string i) "=" (car list)))
(setq list (cdr list)
i (+ i 1))
)
)