* server-buffer-clients and find-file-hook
@ 2007-12-14 0:25 Lennart Borgman (gmail)
2007-12-20 23:59 ` Stefan Monnier
0 siblings, 1 reply; 3+ messages in thread
From: Lennart Borgman (gmail) @ 2007-12-14 0:25 UTC (permalink / raw)
To: Emacs Devel
server-buffer-clients is nil (Emacs 22) when find-file-hook is run. That
makes it impossible to test if a buffer has clients at that time.
Could this please be corrected?
(I am still using and old Emacs 22. Perhaps this has already been changed?)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: server-buffer-clients and find-file-hook
2007-12-14 0:25 server-buffer-clients and find-file-hook Lennart Borgman (gmail)
@ 2007-12-20 23:59 ` Stefan Monnier
2007-12-21 1:15 ` Lennart Borgman (gmail)
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2007-12-20 23:59 UTC (permalink / raw)
To: Lennart Borgman (gmail); +Cc: Emacs Devel
> server-buffer-clients is nil (Emacs 22) when find-file-hook is run.
> That makes it impossible to test if a buffer has clients at that time.
Seems difficult to solve this one directly: find-file creates the
buffer, so it first creates the buffer then calls find-file-hook then
returns the buffer to server.el (via find-file-noselect): server.el
doesn't get a chance to set server-buffer-clients early enough.
Did this used to work differently in earlier versions of Emacs?
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: server-buffer-clients and find-file-hook
2007-12-20 23:59 ` Stefan Monnier
@ 2007-12-21 1:15 ` Lennart Borgman (gmail)
0 siblings, 0 replies; 3+ messages in thread
From: Lennart Borgman (gmail) @ 2007-12-21 1:15 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Emacs Devel
Stefan Monnier wrote:
>> server-buffer-clients is nil (Emacs 22) when find-file-hook is run.
>> That makes it impossible to test if a buffer has clients at that time.
>
> Seems difficult to solve this one directly: find-file creates the
> buffer, so it first creates the buffer then calls find-file-hook then
> returns the buffer to server.el (via find-file-noselect): server.el
> doesn't get a chance to set server-buffer-clients early enough.
>
> Did this used to work differently in earlier versions of Emacs?
I do not believe it worked differently.
I am using a not-so-very-beatiful work around currently ;-)
(defun as-external-is-from-emacsclient ()
"Return non-nil if buffer has clients waiting, otherwise nil."
(or server-buffer-clients
;; Fix-me: The above does not work because of what I think is a
;; bug in Emacs. Work around:
(let ((bt (with-output-to-string (backtrace)))
;; Hide the regexp in the backtrace:
(hidden-regexp (concat "server-" "visit-file")))
(save-match-data
(string-match hidden-regexp bt)))))
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-12-21 1:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-14 0:25 server-buffer-clients and find-file-hook Lennart Borgman (gmail)
2007-12-20 23:59 ` Stefan Monnier
2007-12-21 1:15 ` Lennart Borgman (gmail)
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.