Skip to content

Instantly share code, notes, and snippets.

@weissjeffm
Created July 12, 2013 18:48
Show Gist options
  • Save weissjeffm/5986786 to your computer and use it in GitHub Desktop.
Save weissjeffm/5986786 to your computer and use it in GitHub Desktop.
emacs - editing many files
;; 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