aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuanma Barranquero2013-07-12 13:21:01 +0200
committerJuanma Barranquero2013-07-12 13:21:01 +0200
commitacfcc8c53bcfca52f4ab4ff527d39533545566d9 (patch)
tree2e2daf8149441a9ae8e4f249f3682f66c8bbf33e
parent40a62423464f2f03bd3c8a87dfd98a727971ae5f (diff)
downloademacs-acfcc8c53bcfca52f4ab4ff527d39533545566d9.tar.gz
emacs-acfcc8c53bcfca52f4ab4ff527d39533545566d9.zip
lisp/desktop.el: Minor fixes.
(desktop--v2s): Remove unused local variable. (desktop-save-buffer): Make defvar-local; adjust docstring. (desktop-auto-save-timeout, desktop-owner): Use ignore-errors. (desktop-clear, desktop-save-buffer-p): Use string-match-p.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/desktop.el39
2 files changed, 24 insertions, 22 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index da2bda0b17b..e312fde4672 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12013-07-12 Juanma Barranquero <lekktu@gmail.com>
2
3 * desktop.el (desktop--v2s): Remove unused local variable.
4 (desktop-save-buffer): Make defvar-local; adjust docstring.
5 (desktop-auto-save-timeout, desktop-owner): Use ignore-errors.
6 (desktop-clear, desktop-save-buffer-p): Use string-match-p.
7
12013-07-12 Andreas Schwab <schwab@linux-m68k.org> 82013-07-12 Andreas Schwab <schwab@linux-m68k.org>
2 9
3 * emacs-lisp/map-ynp.el (map-y-or-n-p): Fix last change. 10 * emacs-lisp/map-ynp.el (map-y-or-n-p): Fix last change.
diff --git a/lisp/desktop.el b/lisp/desktop.el
index 2f4c2a8589c..322b95715a2 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -196,9 +196,7 @@ Zero or nil means disable timer-based auto-saving."
196 (integer :tag "Seconds")) 196 (integer :tag "Seconds"))
197 :set (lambda (symbol value) 197 :set (lambda (symbol value)
198 (set-default symbol value) 198 (set-default symbol value)
199 (condition-case nil 199 (ignore-errors (desktop-auto-save-set-timer)))
200 (desktop-auto-save-set-timer)
201 (error nil)))
202 :group 'desktop 200 :group 'desktop
203 :version "24.4") 201 :version "24.4")
204 202
@@ -416,9 +414,8 @@ See `desktop-restore-eager'."
416 :version "22.1") 414 :version "22.1")
417 415
418;;;###autoload 416;;;###autoload
419(defvar desktop-save-buffer nil 417(defvar-local desktop-save-buffer nil
420 "When non-nil, save buffer status in desktop file. 418 "When non-nil, save buffer status in desktop file.
421This variable becomes buffer local when set.
422 419
423If the value is a function, it is called by `desktop-save' with argument 420If the value is a function, it is called by `desktop-save' with argument
424DESKTOP-DIRNAME to obtain auxiliary information to save in the desktop 421DESKTOP-DIRNAME to obtain auxiliary information to save in the desktop
@@ -430,7 +427,6 @@ When file names are returned, they should be formatted using the call
430Later, when `desktop-read' evaluates the desktop file, auxiliary information 427Later, when `desktop-read' evaluates the desktop file, auxiliary information
431is passed as the argument DESKTOP-BUFFER-MISC to functions in 428is passed as the argument DESKTOP-BUFFER-MISC to functions in
432`desktop-buffer-mode-handlers'.") 429`desktop-buffer-mode-handlers'.")
433(make-variable-buffer-local 'desktop-save-buffer)
434(make-obsolete-variable 'desktop-buffer-modes-to-save 430(make-obsolete-variable 'desktop-buffer-modes-to-save
435 'desktop-save-buffer "22.1") 431 'desktop-save-buffer "22.1")
436(make-obsolete-variable 'desktop-buffer-misc-functions 432(make-obsolete-variable 'desktop-buffer-misc-functions
@@ -582,15 +578,15 @@ Used to detect desktop file conflicts.")
582 "Return the PID of the Emacs process that owns the desktop file in DIRNAME. 578 "Return the PID of the Emacs process that owns the desktop file in DIRNAME.
583Return nil if no desktop file found or no Emacs process is using it. 579Return nil if no desktop file found or no Emacs process is using it.
584DIRNAME omitted or nil means use `desktop-dirname'." 580DIRNAME omitted or nil means use `desktop-dirname'."
585 (let (owner) 581 (let (owner
586 (and (file-exists-p (desktop-full-lock-name dirname)) 582 (file (desktop-full-lock-name dirname)))
587 (condition-case nil 583 (and (file-exists-p file)
588 (with-temp-buffer 584 (ignore-errors
589 (insert-file-contents-literally (desktop-full-lock-name dirname)) 585 (with-temp-buffer
590 (goto-char (point-min)) 586 (insert-file-contents-literally file)
591 (setq owner (read (current-buffer))) 587 (goto-char (point-min))
592 (integerp owner)) 588 (setq owner (read (current-buffer)))
593 (error nil)) 589 (integerp owner)))
594 owner))) 590 owner)))
595 591
596(defun desktop-claim-lock (&optional dirname) 592(defun desktop-claim-lock (&optional dirname)
@@ -636,7 +632,7 @@ Furthermore, it clears the variables listed in `desktop-globals-to-clear'."
636 (let ((bufname (buffer-name (car buffers)))) 632 (let ((bufname (buffer-name (car buffers))))
637 (or 633 (or
638 (null bufname) 634 (null bufname)
639 (string-match preserve-regexp bufname) 635 (string-match-p preserve-regexp bufname)
640 ;; Don't kill buffers made for internal purposes. 636 ;; Don't kill buffers made for internal purposes.
641 (and (not (equal bufname "")) (eq (aref bufname 0) ?\s)) 637 (and (not (equal bufname "")) (eq (aref bufname 0) ?\s))
642 (kill-buffer (car buffers)))) 638 (kill-buffer (car buffers))))
@@ -758,8 +754,7 @@ QUOTE may be `may' (value may be quoted),
758 ((consp value) 754 ((consp value)
759 (let ((p value) 755 (let ((p value)
760 newlist 756 newlist
761 use-list* 757 use-list*)
762 anynil)
763 (while (consp p) 758 (while (consp p)
764 (let ((q.sexp (desktop--v2s (car p)))) 759 (let ((q.sexp (desktop--v2s (car p))))
765 (push q.sexp newlist)) 760 (push q.sexp newlist))
@@ -841,17 +836,17 @@ MODE is the major mode.
841 dired-skip) 836 dired-skip)
842 (and (not (and (stringp desktop-buffers-not-to-save) 837 (and (not (and (stringp desktop-buffers-not-to-save)
843 (not filename) 838 (not filename)
844 (string-match desktop-buffers-not-to-save bufname))) 839 (string-match-p desktop-buffers-not-to-save bufname)))
845 (not (memq mode desktop-modes-not-to-save)) 840 (not (memq mode desktop-modes-not-to-save))
846 ;; FIXME this is broken if desktop-files-not-to-save is nil. 841 ;; FIXME this is broken if desktop-files-not-to-save is nil.
847 (or (and filename 842 (or (and filename
848 (stringp desktop-files-not-to-save) 843 (stringp desktop-files-not-to-save)
849 (not (string-match desktop-files-not-to-save filename))) 844 (not (string-match-p desktop-files-not-to-save filename)))
850 (and (memq mode '(dired-mode vc-dir-mode)) 845 (and (memq mode '(dired-mode vc-dir-mode))
851 (with-current-buffer bufname 846 (with-current-buffer bufname
852 (not (setq dired-skip 847 (not (setq dired-skip
853 (string-match desktop-files-not-to-save 848 (string-match-p desktop-files-not-to-save
854 default-directory))))) 849 default-directory)))))
855 (and (null filename) 850 (and (null filename)
856 (null dired-skip) ; bug#5755 851 (null dired-skip) ; bug#5755
857 (with-current-buffer bufname desktop-save-buffer)))))) 852 (with-current-buffer bufname desktop-save-buffer))))))