emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/desktop.el,v


From: Juanma Barranquero
Subject: [Emacs-diffs] Changes to emacs/lisp/desktop.el,v
Date: Tue, 12 Jun 2007 11:14:28 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Juanma Barranquero <lektu>      07/06/12 11:14:28

Index: desktop.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/desktop.el,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -b -r1.110 -r1.111
--- desktop.el  12 Jun 2007 09:10:05 -0000      1.110
+++ desktop.el  12 Jun 2007 11:14:28 -0000      1.111
@@ -190,6 +190,22 @@
   :group 'desktop
   :version "22.1")
 
+(defcustom desktop-load-locked-desktop 'ask
+  "Specifies whether the desktop should be loaded if locked.
+Possible values are:
+   t    -- load anyway.
+   nil  -- don't load.
+   ask  -- ask the user.
+If the value is nil, or `ask' and the user chooses not to load the desktop,
+the normal hook `desktop-not-loaded-hook' is run."
+  :type
+  '(choice
+    (const :tag "Load anyway" t)
+    (const :tag "Don't load" nil)
+    (const :tag "Ask the user" ask))
+  :group 'desktop
+  :version "23.1")
+
 (defcustom desktop-base-file-name
   (convert-standard-filename ".emacs.desktop")
   "Name of file for Emacs desktop, excluding the directory part."
@@ -557,7 +573,7 @@
 (defun desktop-truncate (list n)
   "Truncate LIST to at most N elements destructively."
   (let ((here (nthcdr (1- n) list)))
-    (if (consp here)
+    (when (consp here)
        (setcdr here nil))))
 
 ;; ----------------------------------------------------------------------------
@@ -776,9 +792,8 @@
     (if (consp varspec)
        (setq var (car varspec) size (cdr varspec))
       (setq var varspec))
-    (if (boundp var)
-       (progn
-         (if (and (integerp size)
+    (when (boundp var)
+      (when (and (integerp size)
                   (> size 0)
                   (listp (eval var)))
              (desktop-truncate (eval var) size))
@@ -786,7 +801,7 @@
                  (symbol-name var)
                  " "
                  (desktop-value-to-string (symbol-value var))
-                 ")\n")))))
+             ")\n"))))
 
 ;; ----------------------------------------------------------------------------
 (defun desktop-save-buffer-p (filename bufname mode &rest dummy)
@@ -944,9 +959,12 @@
              ;; Avoid desktop saving during evaluation of desktop buffer.
              (desktop-save nil))
          (if (and owner
+                  (memq desktop-load-locked-desktop '(nil ask))
+                  (or (null desktop-load-locked-desktop)
                   (not (y-or-n-p (format "Warning: desktop file appears to be 
in use by PID %s.\n\
-Using it may cause conflicts.  Use it anyway? " owner))))
-             (progn (setq desktop-dirname nil)
+Using it may cause conflicts.  Use it anyway? " owner)))))
+             (progn
+               (setq desktop-dirname nil)
                     (let ((default-directory desktop-dirname))
                       (run-hooks 'desktop-not-loaded-hook))
                     (message "Desktop file in use; not loaded."))
@@ -1044,7 +1062,7 @@
                                     desktop-buffer-name
                                     desktop-buffer-misc)
   "Restore a file buffer."
-  (if desktop-buffer-file-name
+  (when desktop-buffer-file-name
       (if (or (file-exists-p desktop-buffer-file-name)
               (let ((msg (format "Desktop: File \"%s\" no longer exists."
                                  desktop-buffer-file-name)))
@@ -1165,7 +1183,7 @@
               (setq mark-active (car (cdr desktop-buffer-mark))))
             (set-mark desktop-buffer-mark)))
         ;; Never override file system if the file really is read-only marked.
-        (if desktop-buffer-read-only (setq buffer-read-only 
desktop-buffer-read-only))
+        (when desktop-buffer-read-only (setq buffer-read-only 
desktop-buffer-read-only))
         (while desktop-buffer-locals
           (let ((this (car desktop-buffer-locals)))
             (if (consp this)




reply via email to

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