Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

Leaves open buffers behind #4

Open
eethann opened this issue May 12, 2014 · 12 comments
Open

Leaves open buffers behind #4

eethann opened this issue May 12, 2014 · 12 comments

Comments

@eethann
Copy link

eethann commented May 12, 2014

In Sublime's preview, until you explicitly open a file, it is temporary, so the buffer is closed as soon as you move to the next preview. I think something like that would be good here. When I checked out 20 or 30 files with peep-dired I wound up with 30 or so buffers to manage. Can buffers opened just via peep (and not edited), close when the user goes to the next peep target?

@asok
Copy link
Owner

asok commented May 14, 2014

That seems reasonable. I will implement that soon.

@eethann
Copy link
Author

eethann commented May 21, 2014

Awesome

@asok
Copy link
Owner

asok commented Jun 12, 2014

I've pushed some change that implements it to this branch.

Although I'm doubtful about merging that to the master. Let me list some pros and cons of the change.

Pros:

  • smaller memory footprint
  • buffer list is not "polluted" with peeped buffers

Cons:

  • smaller memory footprint is not so important these days (memory is cheap)
  • there's a lag on each file change because of kill + open file actions. When we do not cleanup buffers on each file change you have the lag when you first "step" on the file, later peeping the same buffer is instantaneous
  • my emacs 24.4 on OSX crashes when I change files really quick. Apparently there's some bug when you kill and visit file too quick.
  • makes the code a bit more complicated the package is really simple and small I would like it stay that way.

As you stated for you the issue is managing the buffers. Maybe we can do something else about it? Name the buffer with * chars?

@mijoharas
Copy link

Hmmm... I have the same request (/problem with lots of opened buffers) that @eethann has. If we could add the open buffers to a list and kill them on entering a buffer that would work for me or just supplying a manual "kill-peeped-buffers" command would probably solve this for me.

@asok
Copy link
Owner

asok commented Sep 1, 2014

@mijoharas I've added peep-dired-kill-buffers-without-window command. Please let me know if it works for you.

@mijoharas
Copy link

That sounds perfect. Thanks for implementing this. I'll give it a test but I'll likely be away from my computer for a while. I'll post once I've had a chance to look at this, but in the meantime, thanks.

@eethann
Copy link
Author

eethann commented Sep 15, 2014

I'm also excited to check this out. I also wonder if there might be some sort of popwin integration possibility here...

@priyadarshan
Copy link

peep-dired is just wonderful. It suits my workflow perfectly, and I do use it a lot. But at the end of the day, I am left with hundreds of buffers open.
I also use desktops. Buffers are saved between each restart, so after a week or so the buffer list is unmanageable (hundreds of buffers).

Is there any way to bind peep-dired-kill-buffers-without-window as a hook to all navigation commands (like peep-dired-next-file, peep-dired-prev-file, etc)?

@asok
Copy link
Owner

asok commented May 17, 2015

@priyadarshan I'm very glad you like it.
Wouldn't a simple hook do the trick in your case? Something like:

(add-hook 'kill-emacs-hook #'peep-dired-kill-buffers-without-window)

@priyadarshan
Copy link

Thanks to peep-dired I am finally able to use Dired. I am so happy about this synergy, that I am thinking of dropping Dolphin and Konqueror all togheter.

That hook makes sense, but I would still be left with hundreds of buffers, popping up every now and then, while I navigate.

Based on your advice, I was wondering if a pre-command hook would be possible, so that it would clean up any buffer right before any action?

Something like this (very naive, and not working) code?

    (add-hook
     'pre-command-hook
     (lambda ()
       (when (eq major-mode 'peep-dired)
         #'peep-dired-kill-buffers-without-window
         )))

Thank you again for peep-dired.

@asok asok closed this as completed in 433463a May 18, 2015
@asok
Copy link
Owner

asok commented May 18, 2015

Please try the new version and set the correct variable to t to have this feature.

(setq peep-dired-cleanup-eagerly t)

Let me know how it works.

@priyadarshan
Copy link

[Sorry, posted with wrong account]

Thank you, the new features are wonderful.
I have made a fresh .emacs.d, just to test the new version. Content of init.el:

(require 'package)
(add-to-list 'package-archives
             '("melpa" . "http://melpa.org/packages/") t)
(package-initialize)

Right now I am testing on OS X: GNU Emacs 24.5.1 (x86_64-apple-darwin13.4.0, NS apple-appkit-1265.21) of 2015-04-10 on builder10-9.porkrind.org

I launch Emacs, maximize frame, launch Dired. I can see that now peep-dired is active for all subdirectories. Nice!

Then, I quit Emacs, and add the following to init.el:
(setq peep-dired-cleanup-eagerly t)

This time, launching Dired and with peep-dired on, it seems peep-dired works only the first time, then it stops.

@asok asok reopened this May 18, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants