1

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.

When I examine the emacs 26.1 code, I see no pertinent variables that I could initialize that would affect the code's behavior.

I did find 28.17 Dedicated Windows in the elisp manual. However, if this can solve my problems, any attempt by me to use this without guidance would be blundering in the dark.

What I Want:

  1. When I open a file, I never want the frame to split into windows. If I desire a split, I will subsequently execute C-x 2 (split-window-below).

  2. When I have neotree attached to a frame and my frame is also split into windows, when I use C-x 1 (delete-other-windows), I never want the neotree deleted. If I subsequently want to delete the neotree, I will execute (neotree toggle).

Addendum

Just exchanged emails with emacs-gnu-support, re possible bugs. My main problem was that I needed to change to the most recent copy of neotree. This change resolved most of my problems. Now, C-x 1 `(delete-other-windows) does not delete the neotree. I reported an underlying anomaly that (I think) might reasonably be construed as not a bug. Replication:

  1. At the end of your initialization, have find-file open a file, and then invoke neotree.
  2. Without mouse-clicking in the buffer area, use the mouse to take the menu <-> buffers menu option, and then use the mouse to open a file.

The frame will split into windows, perhaps because the pop-to-buffer-same-window function regards the frame as belonging to neotree.

7
  • Yes, they are purging the Emacs sources of non-interactive uses of switch-to-buffer. It's possible that you have a case where the simple replacement of it by pop-to-buffer-same-window does not do the right thing - at least not what you expect/want. You might consider filing a bug report about this case: M-x report-emacs-bug.
    – Drew
    Commented Nov 18, 2018 at 23:32
  • @Drew Interesting, thanks. I did file a bug report.
    – zugzwang
    Commented Nov 18, 2018 at 23:56
  • @Drew I would welcome your response to both this link:emacs.stackexchange.com/questions/46075/downgrading-emacs as well as this link: emacs.meta.stackexchange.com/questions/537/…
    – zugzwang
    Commented Nov 19, 2018 at 3:00
  • I don't have much to say about either, mainly because I don't build Emacs and I don't use it on GNU/Linux (unfortunately). I use it on MS Windows, given a Windows binary. I know very little about the questions raised on those pages. That said, in my ignorance about such things I'd think that questions about building, installing, upgrading, downgrading, etc. Emacs would be on topic here. (But I won't be contributing to them because of my unfamiliarity.) Off-topic would be questions that dig into the OS beyond such Emacsy questions.
    – Drew
    Commented Nov 19, 2018 at 4:44
  • Can you post your own answer to this question and mark it as the solution?
    – user12563
    Commented Nov 20, 2018 at 18:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.