emacs-devel
[Top][All Lists]
Advanced

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

Re: server-buffer-clients and find-file-hook


From: Lennart Borgman (gmail)
Subject: Re: server-buffer-clients and find-file-hook
Date: Fri, 21 Dec 2007 02:15:56 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666

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




reply via email to

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