neomacs icon indicating copy to clipboard operation
neomacs copied to clipboard

[Feature]: openfile on dir -> dired

Open jmikedupont2 opened this issue 1 month ago • 3 comments

Problem statement

in old emacs if i open a file on a dir, it goes into dired,

here it says /mnt/data1/time-2026/10-october/30/gptel-openrouter/ is a directory

Proposed solution

dired

Alternatives considered

No response

Impact

No response

Platform

None

Extra context

No response

jmikedupont2 avatar Oct 31 '26 19:10 jmikedupont2

Hi @jmikedupont2 , Thank you for the report.

What's your neomacs version? ./neomacs --version

eval-exec avatar Nov 01 '26 03:11 eval-exec

Thanks for the report. I tried to reproduce this on current main and on the latest release asset (v0.0.20), with GNU Emacs 31.1 as the reference, and I could not: opening a directory enters dired-mode in every path I tried.

What I tested, Neomacs vs GNU 31.1, both with -Q unless noted:

  • (find-file-noselect "/tmp/dir/"), (find-file-existing "/tmp/dir/"), find-file-literally, and find-file-other-window from --batch.
  • Command line: neomacs -Q --batch /tmp/dir/, GUI startup with neomacs -Q /tmp/dir/ on X11 (Xvfb).
  • The --find-file, -visit, --visit, and --file arguments with a directory.
  • A running GUI server plus neomacsclient /tmp/dir/.
  • A symlinked directory, a trailing slash, and a ../ segment in the path.

All of these produced a dired-mode buffer named after the directory, the same as GNU, on both current main and the v0.0.20 release asset.

The message you quoted is exactly the fallback in find-file-noselect (lisp/files.el:2562-2568):

(or (and find-file-run-dired
         (run-hook-with-args-until-success 'find-directory-functions ...))
    (error "%s is a directory" filename))

So it fires only when find-file-run-dired is nil or every find-directory-functions entry returns nil. I also compared the hook semantics (error propagation, nil fall-through, and non-nil returns) and they match GNU.

To pin this down, could you reply with:

  1. The full output of neomacs --version. The 87b3979cb1 ... line looks like git log -1 --oneline; the v0.0.20 release asset reports Neomacs 0.0.20 / Git commit: 47fa15cc69ae8f8da1ca3fac25e0beb700e8c118.
  2. The exact action (C-x C-f in the GUI? command line? neomacsclient? an M-x package command?) and whether it still happens with neomacs -Q.
  3. In the session where it happens, M-: (list find-file-run-dired find-directory-functions), and whether your init sets either variable.

One adjacent divergence I did find: (insert-file-contents DIR) on a directory signals

  • Neomacs: (file-error "Opening input file" "Is a directory" DIR)
  • GNU 31.1: (file-error "Read error" "Is a directory" DIR) (src/fileio.c:4234)

and with VISIT non-nil Neomacs sets buffer-file-name where GNU leaves it nil. If the message you saw actually included an "Opening input file:" prefix, tell me and I will treat that as the bug instead.

eval-exec avatar Nov 01 '26 10:11 eval-exec

Closing as completed. Current main opens dired when find-file receives a directory: plain name, trailing-slash name, a symlink to a directory, and with find-file-visit-truename set; the find-directory-functions argument is the plain name normally and the truename when find-file-visit-truename is set.

That contract is pinned against GNU Emacs 31.1 (a360712c) by 7d2b3bbeba (crates/neovm-oracle-tests/tests/oracle_find_file_directory.rs). I re-verified it on the current release binary with the same form, and GNU and neomacs both return (dired-mode dired-mode dired-mode dired-mode t t). The <path> is a directory message this report hit is gone.

Reopen if a current build still shows it.

eval-exec avatar Nov 13 '26 14:11 eval-exec