From: Eli Zaretskii <eliz@gnu.org>
To: Steve Schooler <sgschooler@gmail.com>
Cc: 33424@debbugs.gnu.org
Subject: bug#33424: pop-to-buffer-same-window in emacs 26-1
Date: Mon, 19 Nov 2018 17:59:02 +0200 [thread overview]
Message-ID: <83wop9rrcp.fsf@gnu.org> (raw)
In-Reply-To: <CAOxkcC6DwZWaE5pKzoEwmU=giqTiA6udkmHsFZ1psdQejTLKyA@mail.gmail.com> (message from Steve Schooler on Sun, 18 Nov 2018 15:54:54 -0800)
tags 33424 notabug
thanks
> From: Steve Schooler <sgschooler@gmail.com>
> Date: Sun, 18 Nov 2018 15:54:54 -0800
>
> Please see https://emacs.stackexchange.com/questions/46072/emacs-26-1-problems-find-file-and-neotree
Thanks, but please in the future describe the issue in detail here. I
will copy the relevant parts of the above URL:
> The Problems:
>
> I just did a full re-install to Fedora 29, which included the dnf install emacs command. This installed emacs 26-1; formerly I was using emacs 25.2. Formerly, my emacs initialization concluded with :
>
> (neotree-dir "/home/steve/")
> ;
> (eww-open-file "~/emacs/neotree/EmacsWiki: Neo Tree.html")
> (find-file "~/notes/notes_todo.txt")
> (find-file "~/emacs/mywork/notes_todo.txt")
> (find-file "~/emacs/mywork/elisp_notes_todo.txt")
> (find-file "~/notes/notes_movies_to_download.txt")
> (find-file "~/notes/notes_watched_tv.txt")
> (find-file "~/math/misc/complex_analysis_01.tex")
>
> In emacs 25.2, this worked fine, with the neotree attached to the frame. In emacs 26-1, the frame is split horizontally into two windows, with the last file opened in the bottom window. Further, when I navigate to the frame's bottom window, and then execute C-x 1 (delete-other-windows), the neotree is also deleted. In emacs 25.2, the neotree would not be deleted here.
>
> Also, sometimes when I open a file, it splits the frame into two windows rather than simply switching to the new file's buffer. I haven't been able to track down the pattern behind this behavior, so I can't be more precise here.
>
> My kludgy temporary initialization workaround:
>
> (eww-open-file "~/emacs/neotree/EmacsWiki: Neo Tree.html")
> (find-file "~/notes/notes_todo.txt")
> (find-file "~/emacs/mywork/notes_todo.txt")
> (find-file "~/emacs/mywork/elisp_notes_todo.txt")
> (find-file "~/notes/notes_movies_to_download.txt")
> (find-file "~/notes/notes_watched_tv.txt")
> (find-file "~/math/misc/complex_analysis_01.tex")
> ;
> (delete-other-windows)
> ;
> (neotree-dir "/home/steve/")
>
> This resolves initialization but does not resolve the subsequent undesired splitting of a frame into windows. Also, it does not resolve preserving neotree when I delete a window from a split frame.
>
> My Research
>
> In emacs 25.2, the relevant code was :
>
> (defun find-file (filename &optional wildcards)
> "..."
> (interactive
> (find-file-read-args "Find file: "
> (confirm-nonexistent-file-or-buffer)))
> (let ((value (find-file-noselect filename nil nil wildcards)))
> (if (listp value)
> (mapcar 'switch-to-buffer (nreverse value))
> ;;else : this comment added by me
> (switch-to-buffer value))))
>
> In emacs 26.1, the relevant code is :
>
> (defun find-file (filename &optional wildcards)
> "..."
> (interactive
> (find-file-read-args "Find file: "
> (confirm-nonexistent-file-or-buffer)))
> (let ((value (find-file-noselect filename nil nil wildcards)))
> (if (listp value)
> (mapcar 'pop-to-buffer-same-window (nreverse value))
> ;;else : this comment added by me
> (pop-to-buffer-same-window value))))
>
> Either:
> 1. I have misunderstood the purpose of (pop-to-buffer-same-window) or
> 2. (pop-to-buffer-same-window) is not working as intended.
AFAICT, pop-to-buffer-same-window is working as intended. It tries to
display the file in the window from which find-file was invoked, but
your original code, which called neotree-dir before loading the files,
caused find-file to be invoked from the neotree window (to which
neotree-dir switches), and that window is dedicated to its buffer. So
pop-to-buffer-same-window cannot reuse that window for another buffer,
and it therefore uses a different window (in this case, creating a new
one).
Your workaround is actually what I would recommend as _the_ solution:
call neotree-dir after loading all of the files (there's no need for
deleting the other windows, at least not in my testing). That will
invoke find-file from a non-dedicated window, and will work as you
expect.
IOW, your original code relied on undocumented behavior of find-file
when invoked from a window that is dedicated to its buffer. That
undocumented behavior was changed to another undocumented behavior,
the only documented aspect of which is that find-file uses some other
window in this case; it is unspecified which window exactly.
Also, I cannot reproduce this part:
> Further, when I navigate to the frame's bottom window, and then execute C-x 1 (delete-other-windows), the neotree is also deleted.
In my testing, the neotree window is not deleted by "C-x 1", as I'd
expect, because it has its no-delete-other-windows parameter set to a
non-nil value. Maybe your neotree installation is outdated? (I tried
the latest version.) Or maybe some other local customizations cause
this?
Bottom line, I see no bugs here. It is all intended and correct
behavior.
next prev parent reply other threads:[~2018-11-19 15:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-18 23:54 bug#33424: pop-to-buffer-same-window in emacs 26-1 Steve Schooler
2018-11-19 15:59 ` Eli Zaretskii [this message]
[not found] ` <CAOxkcC6T_d6EfvsX4fGREik8qAQ_xk8OL1c9E8zX88QLqGh2zQ@mail.gmail.com>
2018-11-20 15:47 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83wop9rrcp.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=33424@debbugs.gnu.org \
--cc=sgschooler@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.