all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#32356: 26.1; --file visits file later than expected
@ 2018-08-03  9:51 Per Starbäck
  2018-08-03 10:04 ` Noam Postavsky
  0 siblings, 1 reply; 4+ messages in thread
From: Per Starbäck @ 2018-08-03  9:51 UTC (permalink / raw)
  To: 32356

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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#32356: 26.1; --file visits file later than expected
  2018-08-03  9:51 bug#32356: 26.1; --file visits file later than expected Per Starbäck
@ 2018-08-03 10:04 ` Noam Postavsky
  2018-08-03 10:16   ` Per Starbäck
  0 siblings, 1 reply; 4+ messages in thread
From: Noam Postavsky @ 2018-08-03 10:04 UTC (permalink / raw)
  To: Per Starbäck; +Cc: 32356

starback@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.






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#32356: 26.1; --file visits file later than expected
  2018-08-03 10:04 ` Noam Postavsky
@ 2018-08-03 10:16   ` Per Starbäck
  2018-08-03 11:06     ` Noam Postavsky
  0 siblings, 1 reply; 4+ messages in thread
From: Per Starbäck @ 2018-08-03 10:16 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: 32356

Noam Postavsky <npostavs@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.








^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#32356: 26.1; --file visits file later than expected
  2018-08-03 10:16   ` Per Starbäck
@ 2018-08-03 11:06     ` Noam Postavsky
  0 siblings, 0 replies; 4+ messages in thread
From: Noam Postavsky @ 2018-08-03 11:06 UTC (permalink / raw)
  To: Per Starbäck; +Cc: 32356

tags 32356 notabug
close 32356
quit

starback@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'.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-08-03 11:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-03  9:51 bug#32356: 26.1; --file visits file later than expected Per Starbäck
2018-08-03 10:04 ` Noam Postavsky
2018-08-03 10:16   ` Per Starbäck
2018-08-03 11:06     ` Noam Postavsky

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.