bmag / emacs-purpose

Manage Windows and Buffers According to Purposes
GNU General Public License v3.0
498 stars 23 forks source link

Prefer the selected window even with multiple frames #121

Closed yoricksijsling closed 6 years ago

yoricksijsling commented 6 years ago

When the functions purpose-display-reuse-window-buffer and purpose-display-reuse-window-purpose have multiple windows to choose from, they should prefer the selected window. This worked for a single frame, and now it also works over multiple frames.

The issue i had can be reproduced with GNU Emacs 25.3.2 as follows:

  1. Start emacs -Q from the
  2. Evaluate these statements:

    (require 'cask "~/.cask/cask.el")
    (cask-initialize)
    (add-to-list 'load-path ".")  ;; I started emacs from the window-purpose folder
    (require 'window-purpose)
    (purpose-mode)
    
    (add-to-list 'display-buffer-alist
                 '("." nil (reusable-frames . t)))
    
    (set-frame-name "FIRST FRAME")
    (make-frame '((name . "SECOND FRAME")))

    We should have two frames with names "FIRST FRAME" and "SECOND FRAME", both have a "scratch" buffer open with purpose [edit].

  3. From the first frame, use C-x C-f to call purpose-find-file-overload and select a file.

The file is now opened in the second frame, but i expected it to open in the first one.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.1%) to 67.416% when pulling b173e8897bf4af02573d953b95dba4cd5dcbaee6 on yoricksijsling:fix-prefer-window-in-same-frame into 2655bbe3399f00d3297ded58f92e7be22876148a on bmag:master.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.1%) to 67.416% when pulling b173e8897bf4af02573d953b95dba4cd5dcbaee6 on yoricksijsling:fix-prefer-window-in-same-frame into 2655bbe3399f00d3297ded58f92e7be22876148a on bmag:master.

bmag commented 6 years ago

Thanks, merged. I did a minor refactor in https://github.com/bmag/emacs-purpose/commit/c75d6191f24eaacc105a45e8fcbb9bc06bde12da