unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Question about initial-buffer-choice
       [not found] <2829dbca-971f-4da5-885a-29afce1dbbb1.ref@yahoo.com.tw>
@ 2024-07-12 13:24 ` CToID
  2024-07-12 15:02   ` Eli Zaretskii
  2024-07-13  6:31   ` Joel Reicher
  0 siblings, 2 replies; 9+ messages in thread
From: CToID @ 2024-07-12 13:24 UTC (permalink / raw)
  To: help-gnu-emacs

Hello folks,

So for example, if `initial-buffer-choice` is set to t, and I try to 
open a file in Emacs using command-line, i. e. enter `emacs foobar.js` 
in my terminal.  Then Emacs will start up, but in addition to one window 
displaying the content of `foobar.js`, there is also another window 
containing scratch buffer.

I'm not sure if this is intended behaviour or not, but if Emacs is 
started through command-line, with file arguments given, shouldn't it 
only display the content of file(s), but not the initial buffer?

-- 
Best,
ID



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

* Re: Question about initial-buffer-choice
  2024-07-12 13:24 ` Question about initial-buffer-choice CToID
@ 2024-07-12 15:02   ` Eli Zaretskii
  2024-07-12 15:27     ` CToID
  2024-07-13  6:31   ` Joel Reicher
  1 sibling, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2024-07-12 15:02 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Fri, 12 Jul 2024 21:24:56 +0800
> From: CToID <funk443@yahoo.com.tw>
> 
> So for example, if `initial-buffer-choice` is set to t, and I try to 
> open a file in Emacs using command-line, i. e. enter `emacs foobar.js` 
> in my terminal.  Then Emacs will start up, but in addition to one window 
> displaying the content of `foobar.js`, there is also another window 
> containing scratch buffer.
> 
> I'm not sure if this is intended behaviour or not, but if Emacs is 
> started through command-line, with file arguments given, shouldn't it 
> only display the content of file(s), but not the initial buffer?

When this variable is non-nil, its value is handled as an additional
command-line argument.  So yes, this is the intended behavior when you
start Emacs with names of files or directories from the command line.



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

* Re: Question about initial-buffer-choice
  2024-07-12 15:02   ` Eli Zaretskii
@ 2024-07-12 15:27     ` CToID
  2024-07-12 16:06       ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: CToID @ 2024-07-12 15:27 UTC (permalink / raw)
  To: help-gnu-emacs

On 2024-07-12 Fri 23:02 UTC+0800, Eli Zaretskii <eliz@gnu.org> said:

> 
> When this variable is non-nil, its value is handled as an additional
> command-line argument.  So yes, this is the intended behavior when you
> start Emacs with names of files or directories from the command line.
> 
Myabe it's better to add another variable to control this behaviour?

-- 
Best,
ID




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

* Re: Question about initial-buffer-choice
  2024-07-12 15:27     ` CToID
@ 2024-07-12 16:06       ` Eli Zaretskii
  2024-07-12 17:02         ` CToID
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2024-07-12 16:06 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Fri, 12 Jul 2024 23:27:34 +0800
> From: CToID <funk443@yahoo.com.tw>
> 
> On 2024-07-12 Fri 23:02 UTC+0800, Eli Zaretskii <eliz@gnu.org> said:
> 
> > 
> > When this variable is non-nil, its value is handled as an additional
> > command-line argument.  So yes, this is the intended behavior when you
> > start Emacs with names of files or directories from the command line.
> > 
> Myabe it's better to add another variable to control this behaviour?

What do you want to control?

Why did you set the variable to t, instead of leaving it at its
default value of nil?



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

* Re: Question about initial-buffer-choice
  2024-07-12 16:06       ` Eli Zaretskii
@ 2024-07-12 17:02         ` CToID
  2024-07-12 17:45           ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: CToID @ 2024-07-12 17:02 UTC (permalink / raw)
  To: help-gnu-emacs

On 2024-07-13 Sat 00:06 UTC+0800, Eli Zaretskii <eliz@gnu.org> said:

> 
> What do you want to control?
>

Control whether the whatever buffer `initial-buffer-choice` specifies 
will be shown if Emacs is invoked with a file name in command line.

> Why did you set the variable to t, instead of leaving it at its
> default value of nil?
> 

Setting it to nil works for sure, but that limits your initial buffer to 
scratch, doesn't it?  What if I want a dired or file buffer instead?

-- 
Best,
ID




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

* Re: Question about initial-buffer-choice
  2024-07-12 17:02         ` CToID
@ 2024-07-12 17:45           ` Eli Zaretskii
  0 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2024-07-12 17:45 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Sat, 13 Jul 2024 01:02:31 +0800
> From: CToID <funk443@yahoo.com.tw>
> 
> On 2024-07-13 Sat 00:06 UTC+0800, Eli Zaretskii <eliz@gnu.org> said:
> 
> > Why did you set the variable to t, instead of leaving it at its
> > default value of nil?
> > 
> 
> Setting it to nil works for sure, but that limits your initial buffer to 
> scratch, doesn't it?  What if I want a dired or file buffer instead?

So you want Emacs to ignore initial-buffer-choice when there are files
from the command-line?  Feel free to submit a feature-request bug
report with this suggestion.



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

* Re: Question about initial-buffer-choice
  2024-07-12 13:24 ` Question about initial-buffer-choice CToID
  2024-07-12 15:02   ` Eli Zaretskii
@ 2024-07-13  6:31   ` Joel Reicher
  2024-07-13  7:24     ` CToID
  1 sibling, 1 reply; 9+ messages in thread
From: Joel Reicher @ 2024-07-13  6:31 UTC (permalink / raw)
  To: CToID; +Cc: help-gnu-emacs

CToID <funk443@yahoo.com.tw> writes:

> So for example, if `initial-buffer-choice` is set to t, and I 
> try to open a file in Emacs using command-line, i. e. enter 
> `emacs foobar.js` in my terminal.  Then Emacs will start up, but 
> in addition to one window displaying the content of `foobar.js`, 
> there is also another window containing scratch buffer.
>
> I'm not sure if this is intended behaviour or not, but if Emacs 
> is started through command-line, with file arguments given, 
> shouldn't it only display the content of file(s), but not the 
> initial buffer?

I get behaviour similar to what I think you want by always using 
emacsclient to open files, and including --no-splash in the 
command for alternate editor.

You might be able to do a different customisation the same way so 
that it applies only when directly opening files when an emacs 
server is not already running.

Regards,

        - Joel



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

* Re: Question about initial-buffer-choice
  2024-07-13  6:31   ` Joel Reicher
@ 2024-07-13  7:24     ` CToID
  2024-07-13  7:54       ` Joel Reicher
  0 siblings, 1 reply; 9+ messages in thread
From: CToID @ 2024-07-13  7:24 UTC (permalink / raw)
  To: help-gnu-emacs

On 2024-07-13 14:31 GMT+08:00, Joel Reicher wrote:
> 
> I get behaviour similar to what I think you want by always using 
> emacsclient to open files, and including --no-splash in the command for 
> alternate editor.
> 

I did some testing, and --no-splash only decides whether Emacs shows the 
splash buffer or not.  It doesn't affect the buffer specified in 
initial-buffer-choice.

-- 
Best,
ID



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

* Re: Question about initial-buffer-choice
  2024-07-13  7:24     ` CToID
@ 2024-07-13  7:54       ` Joel Reicher
  0 siblings, 0 replies; 9+ messages in thread
From: Joel Reicher @ 2024-07-13  7:54 UTC (permalink / raw)
  To: CToID; +Cc: help-gnu-emacs

CToID <funk443@yahoo.com.tw> writes:

> On 2024-07-13 14:31 GMT+08:00, Joel Reicher wrote:
>> I get behaviour similar to what I think you want by always 
>> using emacsclient to open files, and including --no-splash in 
>> the command for alternate editor.
>
> I did some testing, and --no-splash only decides whether Emacs 
> shows the splash buffer or not.  It doesn't affect the buffer 
> specified in initial-buffer-choice.

I know, I wasn't suggesting you use --no-splash; only that you use 
emacsclient with alternate editor for the "situation 
trigger". Perhaps --funcall for something you can define to do 
what you need.

Regards,

        - Joel



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

end of thread, other threads:[~2024-07-13  7:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <2829dbca-971f-4da5-885a-29afce1dbbb1.ref@yahoo.com.tw>
2024-07-12 13:24 ` Question about initial-buffer-choice CToID
2024-07-12 15:02   ` Eli Zaretskii
2024-07-12 15:27     ` CToID
2024-07-12 16:06       ` Eli Zaretskii
2024-07-12 17:02         ` CToID
2024-07-12 17:45           ` Eli Zaretskii
2024-07-13  6:31   ` Joel Reicher
2024-07-13  7:24     ` CToID
2024-07-13  7:54       ` Joel Reicher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).