unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How can I restart *scratch* buffer?
@ 2019-09-02 12:10 李淼
  2019-09-02 12:22 ` YUE Daian
  2019-09-02 15:30 ` Marcin Borkowski
  0 siblings, 2 replies; 16+ messages in thread
From: 李淼 @ 2019-09-02 12:10 UTC (permalink / raw)
  To: help-gnu-emacs

Sometimes I accidentally turn off the *scratch* buffer while I'm using
emacs. How can I restart *scratch* buffer without restarting emacs?


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

* Re: How can I restart *scratch* buffer?
  2019-09-02 12:10 How can I restart *scratch* buffer? 李淼
@ 2019-09-02 12:22 ` YUE Daian
  2019-09-02 12:24   ` YUE Daian
       [not found]   ` <CALrvcGLBQhJG5wtb41Y2uhx0HECvWFyeSfwvY=T8LG=1NfO0XQ@mail.gmail.com>
  2019-09-02 15:30 ` Marcin Borkowski
  1 sibling, 2 replies; 16+ messages in thread
From: YUE Daian @ 2019-09-02 12:22 UTC (permalink / raw)
  To: 李淼, help-gnu-emacs

On 2019-09-02 20:10, 李淼 <flypigonsky@gmail.com> wrote:
> Sometimes I accidentally turn off the *scratch* buffer while I'm using
> emacs. How can I restart *scratch* buffer without restarting emacs?

Simply create a new buffer named *scratch*.



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

* Re: How can I restart *scratch* buffer?
  2019-09-02 12:22 ` YUE Daian
@ 2019-09-02 12:24   ` YUE Daian
  2019-09-02 12:33     ` Joost Kremers
       [not found]   ` <CALrvcGLBQhJG5wtb41Y2uhx0HECvWFyeSfwvY=T8LG=1NfO0XQ@mail.gmail.com>
  1 sibling, 1 reply; 16+ messages in thread
From: YUE Daian @ 2019-09-02 12:24 UTC (permalink / raw)
  To: 李淼, help-gnu-emacs

On 2019-09-02 20:22, YUE Daian <sheepduke@gmail.com> wrote:
> On 2019-09-02 20:10, 李淼 <flypigonsky@gmail.com> wrote:
>> Sometimes I accidentally turn off the *scratch* buffer while I'm using
>> emacs. How can I restart *scratch* buffer without restarting emacs?
>
> Simply create a new buffer named *scratch*.

Oh, and make it emacs-lisp-mode.



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

* Re: How can I restart *scratch* buffer?
  2019-09-02 12:24   ` YUE Daian
@ 2019-09-02 12:33     ` Joost Kremers
  2019-09-02 13:07       ` Michael Heerdegen
  2019-09-02 14:15       ` Alberto Luaces
  0 siblings, 2 replies; 16+ messages in thread
From: Joost Kremers @ 2019-09-02 12:33 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: 李淼


On Mon, Sep 02 2019, YUE Daian wrote:
> On 2019-09-02 20:22, YUE Daian <sheepduke@gmail.com> wrote:
>> On 2019-09-02 20:10, 李淼 <flypigonsky@gmail.com> wrote:
>>> Sometimes I accidentally turn off the *scratch* buffer while 
>>> I'm using
>>> emacs. How can I restart *scratch* buffer without restarting 
>>> emacs?
>>
>> Simply create a new buffer named *scratch*.
>
> Oh, and make it emacs-lisp-mode.

lisp-interaction-mode, to be precise.

-- 
Joost Kremers
Life has its moments



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

* Re: How can I restart *scratch* buffer?
  2019-09-02 12:33     ` Joost Kremers
@ 2019-09-02 13:07       ` Michael Heerdegen
  2019-09-02 14:15       ` Alberto Luaces
  1 sibling, 0 replies; 16+ messages in thread
From: Michael Heerdegen @ 2019-09-02 13:07 UTC (permalink / raw)
  To: Joost Kremers; +Cc: help-gnu-emacs, 李淼

Joost Kremers <joostkremers@fastmail.fm> writes:

> >> Simply create a new buffer named *scratch*.
> >
> > Oh, and make it emacs-lisp-mode.
>
> lisp-interaction-mode, to be precise.

Doesn't that happen automatically?

Michael.



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

* Re: How can I restart *scratch* buffer?
  2019-09-02 12:33     ` Joost Kremers
  2019-09-02 13:07       ` Michael Heerdegen
@ 2019-09-02 14:15       ` Alberto Luaces
  2019-09-02 14:46         ` 李不显
  1 sibling, 1 reply; 16+ messages in thread
From: Alberto Luaces @ 2019-09-02 14:15 UTC (permalink / raw)
  To: help-gnu-emacs

Joost Kremers writes:

> On Mon, Sep 02 2019, YUE Daian wrote:
>> On 2019-09-02 20:22, YUE Daian <sheepduke@gmail.com> wrote:
>>> On 2019-09-02 20:10, 李淼 <flypigonsky@gmail.com> wrote:
>>>> Sometimes I accidentally turn off the *scratch* buffer while I'm
>>>> using
>>>> emacs. How can I restart *scratch* buffer without restarting
>>>> emacs?
>>>
>>> Simply create a new buffer named *scratch*.
>>
>> Oh, and make it emacs-lisp-mode.
>
> lisp-interaction-mode, to be precise.

Sometimes is easier to remember to use normal-mode.

-- 
Alberto




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

* Re: How can I restart *scratch* buffer?
  2019-09-02 14:15       ` Alberto Luaces
@ 2019-09-02 14:46         ` 李不显
  0 siblings, 0 replies; 16+ messages in thread
From: 李不显 @ 2019-09-02 14:46 UTC (permalink / raw)
  To: Alberto Luaces; +Cc: help-gnu-emacs

Now I have figured out the difference between buffer and file, and have a
new understanding of different modes. Thank you for your answers. :)

Alberto Luaces <aluaces@udc.es> 于2019年9月2日周一 下午10:16写道:

> Joost Kremers writes:
>
> > On Mon, Sep 02 2019, YUE Daian wrote:
> >> On 2019-09-02 20:22, YUE Daian <sheepduke@gmail.com> wrote:
> >>> On 2019-09-02 20:10, 李淼 <flypigonsky@gmail.com> wrote:
> >>>> Sometimes I accidentally turn off the *scratch* buffer while I'm
> >>>> using
> >>>> emacs. How can I restart *scratch* buffer without restarting
> >>>> emacs?
> >>>
> >>> Simply create a new buffer named *scratch*.
> >>
> >> Oh, and make it emacs-lisp-mode.
> >
> > lisp-interaction-mode, to be precise.
>
> Sometimes is easier to remember to use normal-mode.
>
> --
> Alberto
>
>
>


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

* Re: How can I restart *scratch* buffer?
  2019-09-02 12:10 How can I restart *scratch* buffer? 李淼
  2019-09-02 12:22 ` YUE Daian
@ 2019-09-02 15:30 ` Marcin Borkowski
  2019-09-08 12:29   ` 李不显
  1 sibling, 1 reply; 16+ messages in thread
From: Marcin Borkowski @ 2019-09-02 15:30 UTC (permalink / raw)
  To: 李淼; +Cc: help-gnu-emacs


On 2019-09-02, at 14:10, 李淼 <flypigonsky@gmail.com> wrote:

> Sometimes I accidentally turn off the *scratch* buffer while I'm using
> emacs. How can I restart *scratch* buffer without restarting emacs?

How about M-: (startup--get-buffer-create-scratch) RET?

M-: stuff is necessary because this is a non-interactive function.  It
is also internal (because it contains two dashes) and undocumented
(because it does not contain a docstring).  Use at your own risk.

Hth,

-- 
Marcin Borkowski
http://mbork.pl



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

* Fwd: How can I restart *scratch* buffer?
       [not found]     ` <87woeq6qgo.fsf@work.i-did-not-set--mail-host-address--so-tickle-me>
@ 2019-09-08 12:16       ` 李不显
  0 siblings, 0 replies; 16+ messages in thread
From: 李不显 @ 2019-09-08 12:16 UTC (permalink / raw)
  To: help-gnu-emacs

---------- Forwarded message ---------
发件人: YUE Daian <sheepduke@gmail.com>
Date: 2019年9月3日周二 上午10:53
Subject: Re: How can I restart *scratch* buffer?
To: 李淼 <flypigonsky@gmail.com>


On 2019-09-02 20:26, 李淼 <flypigonsky@gmail.com> wrote:
>> Do you mean to create a buffer called *scratch* with c-x c-f, which is
>> equivalent to the *scratch* that comes with emacs startup?
>>
>不是。`C-x C-f` 是用来「打开文件」的。
>
>Emacs 里,打开文件会打开(创建)一个对应的 Buffer,而 Buffer 这个概念只
>表示显示上的一个「区块」,并不一定和文件关联。
>
>*scratch* 是 Emacs 的一个特殊的 Buffer,它不和文件关联。当你把其它所有的
>Buffer 都关掉之后,Emacs 会自动创建这个 Buffer。
>
>你需要用 `switch-to-buffer` 命令然后手动输入 `*scratch*` 来创建这个
>Buffer。
>
>对了你这封邮件是回给我的,不是给邮件列表的,你是不是回错啦?^_^
>
>另:Emacs 邮件列表中推荐使用「顶部引用」格式,即把别人的(部分)回复放在
>你的回复的 *上面*,就像本封邮件。好处即当别人看列表里的邮件时,不需要翻
>上面的邮件就能获知本邮件的上下文。
>
>祝好!

感谢详细的解释,我还是第一次使用邮件列表。你的意思是说只要我把邮件回复给邮件列表,那么你就也能收到了是吧。我这就试试看。谢谢

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

* Re: How can I restart *scratch* buffer?
  2019-09-02 15:30 ` Marcin Borkowski
@ 2019-09-08 12:29   ` 李不显
  2019-09-08 12:56     ` Amin Bandali
  0 siblings, 1 reply; 16+ messages in thread
From: 李不显 @ 2019-09-08 12:29 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: help-gnu-emacs

Marcin Borkowski <mbork@mbork.pl> 于2019年9月2日周一 下午11:30写道:

>
> On 2019-09-02, at 14:10, 李淼 <flypigonsky@gmail.com> wrote:
>
> > Sometimes I accidentally turn off the *scratch* buffer while I'm using
> > emacs. How can I restart *scratch* buffer without restarting emacs?
>
> How about M-: (startup--get-buffer-create-scratch) RET?
>
> M-: stuff is necessary because this is a non-interactive function.  It
> is also internal (because it contains two dashes) and undocumented
> (because it does not contain a docstring).  Use at your own risk.
>
> Hth,
>
> --
> Marcin Borkowski
> http://mbork.pl


I tried to do this, but *backtrace* says:

Debugger entered--Lisp error: (void-function
startup-get-buffer-create-scratch)
  (startup-get-buffer-create-scratch)
  eval((startup-get-buffer-create-scratch) nil)
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)


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

* Re: How can I restart *scratch* buffer?
  2019-09-08 12:29   ` 李不显
@ 2019-09-08 12:56     ` Amin Bandali
  2019-09-08 13:25       ` Stefan Monnier
                         ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Amin Bandali @ 2019-09-08 12:56 UTC (permalink / raw)
  To: 李不显; +Cc: help-gnu-emacs

Hi,

李不显 <flypigonsky@gmail.com> writes:

> Marcin Borkowski <mbork@mbork.pl> 于2019年9月2日周一 下午11:30写道:
[...]
>> How about M-: (startup--get-buffer-create-scratch) RET?
[...]
>
>
> I tried to do this, but *backtrace* says:
>
> Debugger entered--Lisp error: (void-function
> startup-get-buffer-create-scratch)
>   (startup-get-buffer-create-scratch)
>   eval((startup-get-buffer-create-scratch) nil)
>   elisp--eval-last-sexp(nil)
>   eval-last-sexp(nil)
>   funcall-interactively(eval-last-sexp nil)
>   call-interactively(eval-last-sexp nil nil)
>   command-execute(eval-last-sexp)

There’s a typo; notice that there needs to be two dashes between
“startup” and “get”.

You seem to have used:
    startup-get-buffer-create-scratch

Instead, try using:
    startup--get-buffer-create-scratch

Hope that helps.



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

* Re: How can I restart *scratch* buffer?
  2019-09-08 12:56     ` Amin Bandali
@ 2019-09-08 13:25       ` Stefan Monnier
  2019-09-08 19:59         ` Marcin Borkowski
  2019-09-08 20:32       ` 李不显
  2019-09-08 20:43       ` 李不显
  2 siblings, 1 reply; 16+ messages in thread
From: Stefan Monnier @ 2019-09-08 13:25 UTC (permalink / raw)
  To: help-gnu-emacs

> Instead, try using:
>     startup--get-buffer-create-scratch

Note that this is new in Emacs-27.  Also, the 2 dashes indicate that
this is an internal function.  It may disappear or be renamed or do
something completely different in a later version.


        Stefan




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

* Re: How can I restart *scratch* buffer?
  2019-09-08 13:25       ` Stefan Monnier
@ 2019-09-08 19:59         ` Marcin Borkowski
  2019-09-08 20:21           ` 李不显
  0 siblings, 1 reply; 16+ messages in thread
From: Marcin Borkowski @ 2019-09-08 19:59 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: help-gnu-emacs


On 2019-09-08, at 15:25, Stefan Monnier <monnier@iro.umontreal.ca> wrote:

>> Instead, try using:
>>     startup--get-buffer-create-scratch
>
> Note that this is new in Emacs-27.  Also, the 2 dashes indicate that
> this is an internal function.  It may disappear or be renamed or do
> something completely different in a later version.

Yes, I warned about it in my email.

Would it make sense to provide a UI for resetting the *scratch* buffer,
i.e., exposing `startup--get-buffer-create-scratch' (perhaps as
something like `switch-to-scratch-buffer' or so)?

Best,

--
Marcin Borkowski
http://mbork.pl



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

* Re: How can I restart *scratch* buffer?
  2019-09-08 19:59         ` Marcin Borkowski
@ 2019-09-08 20:21           ` 李不显
  0 siblings, 0 replies; 16+ messages in thread
From: 李不显 @ 2019-09-08 20:21 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: help-gnu-emacs, Stefan Monnier

Marcin Borkowski <mbork@mbork.pl> 于2019年9月9日周一 上午3:59写道:

>
> On 2019-09-08, at 15:25, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>
> >> Instead, try using:
> >>     startup--get-buffer-create-scratch
> >
> > Note that this is new in Emacs-27.  Also, the 2 dashes indicate that
> > this is an internal function.  It may disappear or be renamed or do
> > something completely different in a later version.
>
> Yes, I warned about it in my email.
>
> Would it make sense to provide a UI for resetting the *scratch* buffer,
> i.e., exposing `startup--get-buffer-create-scratch' (perhaps as
> something like `switch-to-scratch-buffer' or so)?
>
> Best,
>
> --
> Marcin Borkowski
> http://mbork.pl
>
> Thank you for your reply. The problem has been solved in so many ways that
it is well solved. It's amazing how many people follow and respond to such
a simple question. Emacser is friendly to rookies :)


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

* Re: How can I restart *scratch* buffer?
  2019-09-08 12:56     ` Amin Bandali
  2019-09-08 13:25       ` Stefan Monnier
@ 2019-09-08 20:32       ` 李不显
  2019-09-08 20:43       ` 李不显
  2 siblings, 0 replies; 16+ messages in thread
From: 李不显 @ 2019-09-08 20:32 UTC (permalink / raw)
  Cc: help-gnu-emacs

Amin Bandali <bandali@gnu.org> 于2019年9月8日周日 下午8:57写道:

> Hi,
>
> 李不显 <flypigonsky@gmail.com> writes:
>
> > Marcin Borkowski <mbork@mbork.pl> 于2019年9月2日周一 下午11:30写道:
> [...]
> >> How about M-: (startup--get-buffer-create-scratch) RET?
> [...]
> >
> >
> > I tried to do this, but *backtrace* says:
> >
> > Debugger entered--Lisp error: (void-function
> > startup-get-buffer-create-scratch)
> >   (startup-get-buffer-create-scratch)
> >   eval((startup-get-buffer-create-scratch) nil)
> >   elisp--eval-last-sexp(nil)
> >   eval-last-sexp(nil)
> >   funcall-interactively(eval-last-sexp nil)
> >   call-interactively(eval-last-sexp nil nil)
> >   command-execute(eval-last-sexp)
>
> There’s a typo; notice that there needs to be two dashes between
> “startup” and “get”.
>
> You seem to have used:
>     startup-get-buffer-create-scratch
>
> Instead, try using:
>     startup--get-buffer-create-scratch
>
> Hope that helps.
>

I was careless before. I clearly saw it, but I forgot it when I typed it. :)

Thank you for your help!


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

* Re: How can I restart *scratch* buffer?
  2019-09-08 12:56     ` Amin Bandali
  2019-09-08 13:25       ` Stefan Monnier
  2019-09-08 20:32       ` 李不显
@ 2019-09-08 20:43       ` 李不显
  2 siblings, 0 replies; 16+ messages in thread
From: 李不显 @ 2019-09-08 20:43 UTC (permalink / raw)
  To: help-gnu-emacs

Amin Bandali <bandali@gnu.org> 于2019年9月8日周日 下午8:57写道:

> Hi,
>
> 李不显 <flypigonsky@gmail.com> writes:
>
> > Marcin Borkowski <mbork@mbork.pl> 于2019年9月2日周一 下午11:30写道:
> [...]
> >> How about M-: (startup--get-buffer-create-scratch) RET?
> [...]
> >
> >
> > I tried to do this, but *backtrace* says:
> >
> > Debugger entered--Lisp error: (void-function
> > startup-get-buffer-create-scratch)
> >   (startup-get-buffer-create-scratch)
> >   eval((startup-get-buffer-create-scratch) nil)
> >   elisp--eval-last-sexp(nil)
> >   eval-last-sexp(nil)
> >   funcall-interactively(eval-last-sexp nil)
> >   call-interactively(eval-last-sexp nil nil)
> >   command-execute(eval-last-sexp)
>
> There’s a typo; notice that there needs to be two dashes between
> “startup” and “get”.
>
> You seem to have used:
>     startup-get-buffer-create-scratch
>
> Instead, try using:
>     startup--get-buffer-create-scratch
>
> Hope that helps.
>

I was careless before. I clearly saw it, but I forgot it when I typed it. :)

Thank you for your help!


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

end of thread, other threads:[~2019-09-08 20:43 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-02 12:10 How can I restart *scratch* buffer? 李淼
2019-09-02 12:22 ` YUE Daian
2019-09-02 12:24   ` YUE Daian
2019-09-02 12:33     ` Joost Kremers
2019-09-02 13:07       ` Michael Heerdegen
2019-09-02 14:15       ` Alberto Luaces
2019-09-02 14:46         ` 李不显
     [not found]   ` <CALrvcGLBQhJG5wtb41Y2uhx0HECvWFyeSfwvY=T8LG=1NfO0XQ@mail.gmail.com>
     [not found]     ` <87woeq6qgo.fsf@work.i-did-not-set--mail-host-address--so-tickle-me>
2019-09-08 12:16       ` Fwd: " 李不显
2019-09-02 15:30 ` Marcin Borkowski
2019-09-08 12:29   ` 李不显
2019-09-08 12:56     ` Amin Bandali
2019-09-08 13:25       ` Stefan Monnier
2019-09-08 19:59         ` Marcin Borkowski
2019-09-08 20:21           ` 李不显
2019-09-08 20:32       ` 李不显
2019-09-08 20:43       ` 李不显

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).