[Top][All Lists]

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

Re: [Emacs-diffs] trunk r116304: * lisp/desktop.el (desktop-read): Claim

From: Juanma Barranquero
Subject: Re: [Emacs-diffs] trunk r116304: * lisp/desktop.el (desktop-read): Claim the lock when the owner is not the current process.
Date: Sat, 8 Feb 2014 22:08:13 +0100

On Sat, Feb 8, 2014 at 9:29 PM, Juanma Barranquero <address@hidden> wrote:

> Alas, no. It's Windows-specific, and depends on the fact that I know I
> won't have a lock from a remote Emacs instance, and that all my
> instances are launched from executables called emacs.exe.

Well, not really Windows-specific, though it does depend on the other
two conditions. Basically I'm doing something like this:

(setq desktop-load-locked-desktop nil)
(add-hook 'desktop-not-loaded-hook
          (lambda ()
            (let ((owner (desktop-owner))
                  (desktop-load-locked-desktop t))
              (cond ((= owner (emacs-pid))
                    ((let ((command (cdr (assq 'comm
(process-attributes owner))))
                           (case-fold-search t))
                       (and command
"^emacs\\(?:-[0-9.]+\\)?\\(?:\\.exe\\)$" command)))
                     (warn "Locked by Emacs (%s)" owner)
                     (desktop-save-mode -1))
                    ((ignore-errors (delete-file (desktop-full-lock-name)) t)
                     (warn "Stale lock by Emacs (%s) deleted" owner)
                     (warn "Could not delete stale lock by Emacs (%s)" owner)
                     (desktop-save-mode -1))))))

reply via email to

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