-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default to edit for buffers visiting files #114
Conversation
a238772
to
1cdc59a
Compare
1 similar comment
1cdc59a
to
609408a
Compare
609408a
to
ea3c537
Compare
ea3c537
to
7bb45e4
Compare
7bb45e4
to
c401b4b
Compare
Hahaha, what made the test fail previously was... the other test, not the commit itself. It's all clean now, ready for proper review and merge (?). Indeed, implementing the tests was a lot harder than implementing the feature 💦 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making the PR, there's a few changes that need to be made still.
window-purpose.el
Outdated
@@ -165,13 +165,16 @@ This allows Purpose to work well with both `ido' and `helm'.") | |||
|
|||
;;; Overloaded commands: (C-u to get original Purpose-less behavior) | |||
(define-purpose-prefix-overload purpose-find-file-overload | |||
'(purpose-friendly-find-file find-file-without-purpose)) | |||
'(purpose-friendly-find-file | |||
find-file-without-purpose)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary formatting changes.
window-purpose.el
Outdated
|
||
(define-purpose-prefix-overload purpose-find-file-other-window-overload | ||
'(purpose-friendly-find-file-other-window find-file-other-window-without-purpose)) | ||
'(purpose-friendly-find-file-other-window | ||
find-file-other-window-without-purpose)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary formatting changes.
window-purpose.el
Outdated
|
||
(define-purpose-prefix-overload purpose-find-file-other-frame-overload | ||
'(purpose-friendly-find-file-other-frame find-file-other-frame-without-purpose)) | ||
'(purpose-friendly-find-file-other-frame | ||
find-file-other-frame-without-purpose)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary formatting changes.
window-purpose-core.el
Outdated
@@ -212,6 +212,9 @@ If no purpose was determined, return `default-purpose'." | |||
(purpose--buffer-purpose-mode buffer-or-name | |||
purpose--default-mode-purposes))) | |||
|
|||
;; If the buffer is visiting a file, fallback to 'edit purpose | |||
(when (buffer-file-name (get-buffer buffer-or-name)) | |||
'edit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use a new custom default-file-purpose
variable, which has a default value of edit
.
test/core-test.el
Outdated
(get-buffer-create "yolo") | ||
(should (equal (purpose-buffer-purpose (get-buffer "yolo")) default-purpose)) | ||
(kill-buffer "yolo"))) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use unwind-protect
and purpose-kill-buffers-safely
. This ensures proper tear-down of the test, and separate the tear-down from what's actually being tested. See other tests in the same file for examples.
c401b4b
to
b8ba90c
Compare
b8ba90c
to
5942f70
Compare
All done 👌✨ |
I squashed your commits and made some additional fixes in 2655bbe. Thank you. |
Yay ! 🎉 🎊 That was a swift one, so good to see something merged so quickly right after initial discussion 😸 Nice work ! |
As discussed in #113, implementing tests for this is still needed.
I tested it manually and
'edit
are still in'edit
*magit: blah*
still gets'general
SPC ff RET blablabla RET
in Spacemacs it nicely gets'edit
spacemacs/new-empty-buffer
) with a random name it nicely gets'general