Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Close dired buffers on project unload

Thanks to for the bug
report and and a fix.
  • Loading branch information...
commit 93e6ac9a200523f51fee4bafdb6cf359c15785a2 1 parent ae276da
@mattkeller mattkeller authored
Showing with 13 additions and 4 deletions.
  1. +13 −4 mk-project.el
17 mk-project.el
@@ -335,9 +335,17 @@ paths when greping or indexing the project.")
(message "Closed %d buffers, %d modified buffers where left open"
(length closed) (length dirty))))
+(defun mk-proj-buffer-name (buf)
+ "Return buffer's name based on filename or dired's location"
+ (let ((file-name (or (buffer-file-name buf)
+ (with-current-buffer buf list-buffers-directory))))
+ (if file-name
+ (expand-file-name file-name)
+ nil)))
(defun mk-proj-buffer-p (buf)
"Is the given buffer in our project based on filename? Also detects dired buffers open to basedir/*"
- (let ((file-name (buffer-file-name buf)))
+ (let ((file-name (mk-proj-buffer-name buf)))
(if (and file-name
(string-match (concat "^" (regexp-quote mk-proj-basedir)) file-name))
@@ -367,9 +375,10 @@ paths when greping or indexing the project.")
"Write the list of `files' to a file"
(when mk-proj-open-files-cache
- (dolist (f (mapcar (lambda (b) (buffer-file-name b)) (mk-proj-buffers)))
- (unless (string-equal mk-proj-tags-file f)
- (insert f "\n")))
+ (dolist (f (mapcar (lambda (b) (mk-proj-buffer-name b)) (mk-proj-buffers)))
+ (when f
+ (unless (string-equal mk-proj-tags-file f)
+ (insert f "\n"))))
(if (file-writable-p mk-proj-open-files-cache)
(write-region (point-min)
Please sign in to comment.
Something went wrong with that request. Please try again.