emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re:


From: Константин Куликов
Subject: Re:
Date: Thu, 20 Dec 2012 11:36:03 +0300

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 Константин Куликов <address@hidden>
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?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]