unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Константин Куликов" <zxnotdead@gmail.com>
To: emacs-devel <emacs-devel@gnu.org>
Subject: Re:
Date: Thu, 20 Dec 2012 11:36:03 +0300	[thread overview]
Message-ID: <CAFkz2yrZ3wuMiyNY2edNLDG4jTAfNKXb5mvC6OYqu+0xE94Qgg@mail.gmail.com> (raw)
In-Reply-To: <CAFkz2yroLhknptDnWyC9B1fbZKEwTCV-T0VttHQiwZoaAW-j6A@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2929 bytes --]

found how code it more correct:
No need to change anything in startup.el
Code for server.el will be:

          (unless (or files commands)
            (let ((type (type-of initial-buffer-choice)))
              (cond
               ((eq 'string type) (find-file initial-buffer-choice))
               ((eq 'buffer type) (switch-to-buffer initial-buffer-choice
                                                    'norecord))
               (t (switch-to-buffer (get-buffer-create "*scratch*")
                                    'norecord)))))

So, someone who has write access to emacs, maybe add this change to trunk?
(if u see no bugs with this code of course =p)


2012/12/20 Константин Куликов <zxnotdead@gmail.com>

> I discribed my problem here:
> http://comments.gmane.org/gmane.emacs.help/88218 .
> short:
> > when you run 'emacsclient -c' the new frame created and window in that
> frame is switched to
> > *scratch* buffer or file with name that is set in
> `initial-buffer-choice'.
> So, I can set `initial-buffer-choice' in the `after-make-frame-functions'
> to switch to buffer other than *scratch* on frame creation, but can't set
> somehow to buffer without underlying file.
>
> I found place where this behaviour handled(server.el:1258):
>
>       ;; If we were told only to open a new client, obey
>       ;; `initial-buffer-choice' if it specifies a file.
>       (unless (or files commands)
>         (if (stringp initial-buffer-choice)
>         (find-file initial-buffer-choice)
>           (switch-to-buffer (get-buffer-create "*scratch*")
>                 'norecord)))
>
> Changed it to this:
>       (unless (or files commands)
>             (typecase initial-buffer-choice
>               (string (find-file initial-buffer-choice))
>               (buffer (switch-to-buffer initial-buffer-choice 'norecord))
>               (t (switch-to-buffer (get-buffer-create "*scratch*")
>                                    'norecord)))
>
> then emacsclient -c it create frame and after short time destroys it with
> error:
> "*ERROR*: Wrong type argument: stringp, #<buffer *scratch*>"
>
> ok. I grepped sources, find startup.el:2325 :
>     (when initial-buffer-choice
>       (cond ((eq initial-buffer-choice t)
>          (switch-to-buffer (get-buffer-create "*scratch*")))
>         ((stringp initial-buffer-choice)
>          (find-file initial-buffer-choice))))
>
> replaced it to:
>     (when initial-buffer-choice
>       (typecase initial-buffer-choice
>         (symbol (when (eq initial-buffer-choice t)
>                   (switch-to-buffer (get-buffer-create "*scratch*"))))
>         (string (find-file initial-buffer-choice))
>         (buffer (switch-to-buffer initial-buffer-choice))))
>
> But still get same error:
> "*ERROR*: Wrong type argument: stringp, #<buffer *scratch*>"
>
> Any suggestions?
>
>

[-- Attachment #2: Type: text/html, Size: 4048 bytes --]

       reply	other threads:[~2012-12-20  8:36 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAFkz2yroLhknptDnWyC9B1fbZKEwTCV-T0VttHQiwZoaAW-j6A@mail.gmail.com>
2012-12-20  8:36 ` Константин Куликов [this message]
2012-12-20 11:05   ` Overriding switch to *scratch* buffer after creating new frame with 'emacsclient -c' martin rudalics
2012-12-20 12:13     ` Константин Куликов
2023-02-15 17:57 Make all tree-sitter modes optional Alan Mackenzie
2023-02-15 18:33 ` Eli Zaretskii
2023-02-17 13:30   ` Alan Mackenzie
2023-02-17 13:37     ` Po Lu
2023-02-17 13:46       ` Stefan Monnier
2023-02-17 14:16         ` Po Lu
2023-02-17 14:40           ` Eli Zaretskii
2023-02-17 14:56             ` Dmitry Gutov
2023-02-17 15:04               ` Eli Zaretskii
     [not found]                 ` <8735741fic.fsf@dick>
2023-02-17 15:41                   ` Alan Mackenzie
  -- strict thread matches above, loose matches on Subject: below --
2021-12-20  2:29 (unknown) Davin Pearson
2021-12-21 14:29 ` Eli Zaretskii
     [not found]   ` <CAG9ihEvK5VVgP9O+TXYSz+BQF1=YzMgzGBbc5s-fewwT34yytA@mail.gmail.com>
     [not found]     ` <CAG9ihEsdD2Dd=paZatMfnD3HJxKsUM=3etTz7c-tDcs-H80PoA@mail.gmail.com>
     [not found]       ` <CAG9ihEsQFkx+uE+pZ7R42GXUFR_C2PSzVK8M5AQuHdtOsND0cg@mail.gmail.com>
     [not found]         ` <CAG9ihEv_OPaYhTgfh2WnfckC5r21U5Hv0qW7Msnwz4Bbvz6ccg@mail.gmail.com>
2021-12-28 17:51           ` Re: Eli Zaretskii
2021-12-28 23:41             ` Re: Davin Pearson
2021-12-31 15:23               ` Re: Anders Lindgren
2022-01-02  1:15                 ` Re: Davin Pearson
2022-01-02  5:19                   ` Re: Stefan Monnier
2022-01-03  0:53                     ` Re: Davin Pearson
2021-12-02 14:09 Re: Angelo Graziosi
2021-11-04  6:36 Re: Pedro Andres Aranda Gutierrez
2017-10-24 18:52 wait_reading_process_ouput hangs in certain cases (w/ patches) Matthias Dahl
2017-11-14 16:03 ` Eli Zaretskii
2017-11-14 16:23   ` Eli Zaretskii
2017-11-14 21:54     ` Paul Eggert
2017-11-15 14:03       ` Matthias Dahl
2017-11-16 16:46         ` Paul Eggert
2017-11-18 14:24           ` Matthias Dahl
2017-11-19  7:07             ` Paul Eggert
2017-11-20 15:29               ` Matthias Dahl
2017-11-21 14:44                 ` Matthias Dahl
2017-11-22  8:55                   ` Paul Eggert
2017-12-04  9:40                     ` Matthias Dahl
2018-02-13 14:25                       ` Matthias Dahl
2018-02-16 16:01                         ` Eli Zaretskii
2018-02-16 16:09                           ` Lars Ingebrigtsen
2018-02-22 11:45                             ` andres.ramirez
2018-02-26 14:39                               ` Matthias Dahl
2018-02-26 15:11                                 ` andrés ramírez
2018-02-26 15:17                                   ` Lars Ingebrigtsen
2018-02-26 15:29                                     ` andrés ramírez
2018-02-26 16:52                                       ` Daniel Colascione
2018-02-26 17:19                                         ` andrés ramírez
2018-02-26 17:24                                           ` Daniel Colascione
2018-02-27  1:53                                             ` Re: andrés ramírez
2016-02-08  7:54 (unknown) steve
2016-02-08 12:56 ` Artur Malabarba
2016-02-08 19:05   ` Re: Steve Purcell
2016-02-08 20:16     ` Re: Artur Malabarba
2005-09-10 14:39 Re: Abdulaim
2005-07-06 17:37 Re: Ishok
2005-03-20  5:29 Re: info
2005-01-06 12:16 Re: Документ
2004-11-26 21:10 Re: Robbie Womack
2004-10-10 18:45 Re: John Gard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFkz2yrZ3wuMiyNY2edNLDG4jTAfNKXb5mvC6OYqu+0xE94Qgg@mail.gmail.com \
    --to=zxnotdead@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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