GNU bug report logs -
#49980
28.0.50; [PATCH] Should we have project-save-buffers?
Previous Next
Reported by: Giap Tran <txgvnn <at> gmail.com>
Date: Tue, 10 Aug 2021 14:49:02 UTC
Severity: normal
Tags: fixed, patch
Fixed in version 28.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Hello,
After using `project-query-replace-regexp to query and replace. I see we don't have the function to save all buffers in project.
So after learning from projectile package. I have this patch, hope it is
useful. Thanks
[project-save-buffers.diff (text/x-diff, inline)]
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 4620ea8f47..b257222e21 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1395,5 +1395,22 @@ to directory DIR."
(project-current-inhibit-prompt t))
(call-interactively command))))
+(defun project-save-buffers ()
+ "Save all project buffers."
+ (interactive)
+ (let* ((project (project-current t))
+ (buffers (project--buffer-list project))
+ (modified-buffers (cl-remove-if-not (lambda (buf)
+ (and (buffer-file-name buf)
+ (buffer-modified-p buf)))
+ buffers)))
+ (if (null modified-buffers)
+ (message "No buffers need saving")
+ (dolist (buf modified-buffers)
+ (with-current-buffer buf
+ (save-buffer)))
+ (message "Saved %d buffers" (length modified-buffers)))))
+
+
(provide 'project)
;;; project.el ends here
This bug report was last modified 3 years and 338 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.