Advertisement
Guest User

Untitled

a guest
Nov 17th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. (defun my-process-file (fPath searchFunc)
  2. "Process the file at FPATH …"
  3. (let (myBuffer p1 p2 (ii 0) searchStr)
  4. (when (not (string-match "/xx" fPath)) ; exclude some dir
  5. (let ((fileChanged-p nil))
  6. (with-current-buffer
  7. (get-buffer-create "symvisfix buff")
  8. ;; insert code from file into temp buffer
  9. (insert-file-contents fPath nil nil nil t)
  10.  
  11. ;; need to get all search keys in here and iterate through each
  12. (setq searchStr searchFunc) ; search string here
  13. ;; start from first point in buffer
  14. (goto-char 1)
  15. (while (search-forward searchStr nil t)
  16. ;; go to beginning of function def line
  17. (forward-word -3)
  18. (if (not (string-equal (thing-at-point 'word) "IUP_EXPORTI"))
  19. (forward-word 1)
  20. (insert "IUP_EXPORTI "))
  21. ;; go back to cursor start
  22. (forward-word 3)
  23. (setq fileChanged-p t)
  24. ;; (setq ii (1+ ii))
  25. ))
  26. (when fileChanged-p (write-region 1 (point-max) fPath))))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement