Klimi's new dotfiles with stow.
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.

18 lines
628 B

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