Created
July 12, 2013 18:48
-
-
Save weissjeffm/5986786 to your computer and use it in GitHub Desktop.
emacs - editing many files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; processing many files | |
;; depends on dired+ | |
(defun on-dired-marked-files (f) | |
(interactive "aFunction to call on each file: ") | |
(dolist (file (diredp-get-files nil nil t t)) | |
(when (not (file-directory-p file)) | |
(find-file file) | |
(funcall f)))) | |
(add-hook 'dired-mode-hook | |
(lambda () (define-key dired-mode-map | |
(kbd "C-c f") 'on-dired-marked-files))) | |
;; example edit function (depends on mark-multiple) | |
(defun edit-with-client () | |
(interactive) | |
(when (search-forward "with-client\ " nil t) | |
(backward-word 2) | |
(set-mark (point)) | |
(forward-word 2) | |
(mc/mark-all-like-this) | |
(backward-word) | |
(insert-string "queued-") | |
(paredit-forward) | |
(kill-sexp))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment