GNU bug report logs - #32356
26.1; --file visits file later than expected

Previous Next

Package: emacs;

Reported by: starback <at> stp.lingfil.uu.se (Per Starbäck)

Date: Fri, 3 Aug 2018 09:53:02 UTC

Severity: normal

Tags: notabug

Found in version 26.1

Done: Noam Postavsky <npostavs <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 32356 in the body.
You can then email your comments to 32356 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#32356; Package emacs. (Fri, 03 Aug 2018 09:53:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to starback <at> stp.lingfil.uu.se (Per Starbäck):
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 03 Aug 2018 09:53:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: starback <at> stp.lingfil.uu.se (Per Starbäck)
To: bug-gnu-emacs <at> gnu.org
Subject: 26.1; --file visits file later than expected
Date: Fri, 03 Aug 2018 11:51:49 +0200
In GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.26)
Windowing system distributor 'The X.Org Foundation', version 11.0.11905000
System Description:	CentOS Linux release 7.5.1804 (Core) 

I'm not sure if this is a bug or just other unexpected (by me) behavior:

$ emacs -Q --file=test.txt --eval '(princ (frame-selected-window))'

This starts an emacs and prints "#<window 3 on *scratch*>"
I expected it to already have selected a window with test.txt instead.

Only by opening the file with something like

$ emacs -Q --eval '(progn (find-file "test.txt") (princ (frame-selected-window)))'

instead do I get the result "#<window 3 on test.txt>"
that I expected.

If this behavior is intended, I think something could be added to
"(emacs) Action Arguments" about it. I think this text about "--insert" there
gives the impression that action arguments are processed in the order
they are given:

>  Usually, this is the
>     ‘*scratch*’ buffer (*note Lisp Interaction::), but if arguments
>     earlier on the command line visit files or switch buffers, that
>     might be a different buffer.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32356; Package emacs. (Fri, 03 Aug 2018 10:05:02 GMT) Full text and rfc822 format available.

Message #8 received at 32356 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: starback <at> stp.lingfil.uu.se (Per Starbäck)
Cc: 32356 <at> debbugs.gnu.org
Subject: Re: bug#32356: 26.1; --file visits file later than expected
Date: Fri, 03 Aug 2018 06:04:49 -0400
starback <at> stp.lingfil.uu.se (Per Starbäck) writes:

> If this behavior is intended, I think something could be added to
> "(emacs) Action Arguments" about it. I think this text about "--insert" there
> gives the impression that action arguments are processed in the order
> they are given:
>
>>  Usually, this is the
>>     ‘*scratch*’ buffer (*note Lisp Interaction::), but if arguments
>>     earlier on the command line visit files or switch buffers, that
>>     might be a different buffer.

The buffer is set by then, e.g., try

    emacs -Q --file=test.txt --eval '(princ (cons (current-buffer) (frame-selected-window)))'

and you get (test.txt . #<window 3 on *scratch*>).  So it's just that
window selection doesn't happen immediately.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32356; Package emacs. (Fri, 03 Aug 2018 10:17:01 GMT) Full text and rfc822 format available.

Message #11 received at 32356 <at> debbugs.gnu.org (full text, mbox):

From: starback <at> stp.lingfil.uu.se (Per Starbäck)
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: 32356 <at> debbugs.gnu.org
Subject: Re: bug#32356: 26.1; --file visits file later than expected
Date: Fri, 03 Aug 2018 12:16:39 +0200
Noam Postavsky <npostavs <at> gmail.com> writes:

> The buffer is set by then, e.g., try
>
>     emacs -Q --file=test.txt --eval '(princ (cons (current-buffer)
> (frame-selected-window)))'
>
> and you get (test.txt . #<window 3 on *scratch*>).  So it's just that
> window selection doesn't happen immediately.

Thanks! I should have tried that as well when making my test case
smaller.

For what I was actually trying to do I needed that window, and I also
tried (redisplay t) and other stuff in between to make it display before
my code continued, to no avail. Visiting the file explicitly with
find-file instead works for me. I just thought I found something strange
on the way, but evidently not, so this can be closed.







Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32356; Package emacs. (Fri, 03 Aug 2018 11:07:01 GMT) Full text and rfc822 format available.

Message #14 received at 32356 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: starback <at> stp.lingfil.uu.se (Per Starbäck)
Cc: 32356 <at> debbugs.gnu.org
Subject: Re: bug#32356: 26.1; --file visits file later than expected
Date: Fri, 03 Aug 2018 07:06:28 -0400
tags 32356 notabug
close 32356
quit

starback <at> stp.lingfil.uu.se (Per Starbäck) writes:

> For what I was actually trying to do I needed that window, and I also
> tried (redisplay t) and other stuff in between to make it display before
> my code continued, to no avail. Visiting the file explicitly with
> find-file instead works for me. I just thought I found something strange
> on the way, but evidently not, so this can be closed.

Ah, it's because --file only sets the buffer, displaying it in a window
only happens later, when initial-buffer-choice is processed (i.e., after
all command line arguments have been processed).

(elisp) Startup Summary:

     24. [...]
         If one file is given as a command line argument, that file is
         visited and its buffer displayed alongside `initial-buffer-choice'.




Added tag(s) notabug. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 03 Aug 2018 11:07:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 32356 <at> debbugs.gnu.org and starback <at> stp.lingfil.uu.se (Per Starbäck) Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 03 Aug 2018 11:07:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 31 Aug 2018 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 352 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.