File: file.process

package info (click to toggle)
yasnippet-snippets 0~git20161123-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 5,000 kB
  • ctags: 19
  • sloc: lisp: 73; python: 23; ada: 4; makefile: 2
file content (17 lines) | stat: -rw-r--r-- 578 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#name : a function that process a file
#contributor : Xah Lee
# --
(defun doThisFile (fpath)
  "Process the file at path FPATH ..."
  (let ()
    ;; create temp buffer without undo record or font lock. (more efficient)
    ;; first space in temp buff name is necessary
    (set-buffer (get-buffer-create " myTemp"))
    (insert-file-contents fpath nil nil nil t)

    ;; process it ...
    ;; (goto-char 0) ; move to begining of file's content (in case it was open)
    ;; ... do something here
    ;; (write-file fpath) ;; write back to the file

    (kill-buffer " myTemp")))