Emacs config utilizing prelude as a base
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
604 B

  1. # contributor: Xah Lee (XahLee.org)
  2. # name: a function that process a file
  3. # key: x-file
  4. # --
  5. (defun doThisFile (fpath)
  6. "Process the file at path FPATH ..."
  7. (let ()
  8. ;; create temp buffer without undo record or font lock. (more efficient)
  9. ;; first space in temp buff name is necessary
  10. (set-buffer (get-buffer-create " myTemp"))
  11. (insert-file-contents fpath nil nil nil t)
  12. ;; process it ...
  13. ;; (goto-char 0) ; move to begining of file's content (in case it was open)
  14. ;; ... do something here
  15. ;; (write-file fpath) ;; write back to the file
  16. (kill-buffer " myTemp")))