rumcii / emacs-nav

Automatically exported from code.google.com/p/emacs-nav
GNU General Public License v3.0
0 stars 0 forks source link

Closing the nav window isn't perfect #94

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Split vertically the current window
2. Open a nav window
3. Close the nav window

What is the expected output? What do you see instead?

The window to the right should return to its original size. It keeps its 
current width instead and the window to the left is widened by one nav window

What version of the product are you using? On what operating system?

Emacs 23 on Ubuntu, current nav (as of yesterday or so).

Please provide any additional information below.

I solved it (for me) by adding the following to my init.el:

; nav-mode
(require 'nav)
(defun window-width-with-chrome ()
  (let ((edges (window-edges))) (- (nth 2 edges) (nth 0 edges))))
(defun nav-toggle ()
  (interactive)
  ; TODO: I'm a total n00b - there must be a better way
  (if (member nav-buffer-name (mapcar* 'buffer-name (buffer-list)))
      (progn
        (let ((current-nav-width (window-width-with-chrome)))
             (windmove-right)
             (enlarge-window-horizontally current-nav-width)
             (kill-buffer nav-buffer-name)))
    (nav))
  )
(global-set-key [f8] 'nav-toggle)

Original issue reported on code.google.com by rban...@gmail.com on 2 May 2012 at 12:26

GoogleCodeExporter commented 8 years ago
Wrong. I didn't solve it at all - only for windows that are not the leftmost 
one :-(

If nav is the leftmost window, the window to its right grows (and it shouldn't)

Original comment by rban...@gmail.com on 2 May 2012 at 7:52

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Proposed changes are on 
https://code.google.com/r/rbanffy-emacs-nav/source/detail?r=e31c10555eab2b88d1e9
dd18c52b306a071f9fc0 and 
https://code.google.com/r/rbanffy-emacs-nav/source/detail?r=33ab0e3dcade44ac4a1f
a838a2382cef6831a714.

There probably is a better way to accomplish what I did. I'd appreciate feedback

Also, sorry for not bundling them as a single change. I have no idea how to do 
it here.

Original comment by rban...@gmail.com on 2 May 2012 at 10:49

GoogleCodeExporter commented 8 years ago
Hi rbanffy. I'm trying out your change now.

Original comment by issac.tr...@gmail.com on 3 May 2012 at 6:25

GoogleCodeExporter commented 8 years ago
OK, there were some issues, but I think the version I pushed is about right. 
I'm marking it fixed, but let me know if the problem persists.

Original comment by issac.tr...@gmail.com on 3 May 2012 at 8:07

GoogleCodeExporter commented 8 years ago
I'm seeing the issue on emacs 24. Will look for a more robust solution.

Original comment by issac.tr...@gmail.com on 5 May 2012 at 6:45

GoogleCodeExporter commented 8 years ago
OK, I checked in a fix for this on emacs 24: 36335c6cdd96.

It's still possible to make the closing fail to reshape windows correctly by 
making the windows to narrow.

Original comment by issac.tr...@gmail.com on 7 May 2012 at 5:27

GoogleCodeExporter commented 8 years ago

Original comment by issac.tr...@gmail.com on 7 May 2012 at 5:27