Commits

nejucomo  committed 6cd7658

Add nej-for-buffers module.

  • Participants
  • Parent commits 76c4f02

Comments (0)

Files changed (1)

File nej/nej-for-buffers.el

+;; Usage:
+;
+; (require 'nej-for-buffers)
+
+
+(defun nej-for-buffers-inside-directory (directory buf-cmd)
+  "Execute a command on all the buffers visiting files under a directory."
+  (interactive "Ddirectory: \nabuffer command: ")
+  (let ((absdir (expand-file-name directory)))
+    (mapcar
+     (lambda (buf)
+       (let ((bufname (buffer-file-name buf)))
+         (when (and (not (null bufname)) (string-prefix-p absdir bufname))
+           (funcall buf-cmd buf))))
+     (buffer-list))))
+
+
+;; Initialize this module:
+(provide 'nej-for-buffers)