From a6c2c80cdd8abfb59abcb6c08b42115c50a4aa0b Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 18 Jul 2009 11:59:04 +0000 Subject: [PATCH] (desktop-buffers-not-to-save): Default value is nil. Accept nil in addition to a regexp. (desktop-files-not-to-save): Add "(ftp)$" to the default regexp. Accept nil in addition to a regexp. (desktop-save-buffer-p): Don't use desktop-buffers-not-to-save for buffers that have an associated file. Handle nil values of desktop-buffers-not-to-save and desktop-files-not-to-save. (Bug#3833) --- lisp/ChangeLog | 9 +++++++++ lisp/desktop.el | 18 ++++++++++-------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2849d3639ac..00e8e0bf598 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,14 @@ 2009-07-18 Eli Zaretskii + * desktop.el (desktop-buffers-not-to-save): Default value is nil. + Accept nil in addition to a regexp. + (desktop-files-not-to-save): Add "(ftp)$" to the default regexp. + Accept nil in addition to a regexp. + (desktop-save-buffer-p): Don't use desktop-buffers-not-to-save for + buffers that have an associated file. Handle nil values of + desktop-buffers-not-to-save and desktop-files-not-to-save. + (Bug#3833) + * term/pc-win.el (x-selection-owner-p, x-own-selection-internal) (x-disown-selection-internal): New functions. diff --git a/lisp/desktop.el b/lisp/desktop.el index aae6b971202..b2c04e26ea9 100644 --- a/lisp/desktop.el +++ b/lisp/desktop.el @@ -333,19 +333,18 @@ modes are restored automatically; they should not be listed here." :type '(repeat symbol) :group 'desktop) -;; We skip .log files because they are normally temporary. -;; (ftp) files because they require passwords and whatnot. -(defcustom desktop-buffers-not-to-save - "\\(^nn\\.a[0-9]+\\|(ftp)\\)$" +(defcustom desktop-buffers-not-to-save nil "Regexp identifying buffers that are to be excluded from saving." - :type 'regexp + :type '(choice (const :tag "None" nil) + regexp) :group 'desktop) ;; Skip tramp and ange-ftp files (defcustom desktop-files-not-to-save - "^/[^/:]*:" + "\\(^/[^/:]*:\\|(ftp)$\\)" "Regexp identifying files whose buffers are to be excluded from saving." - :type 'regexp + :type '(choice (const :tag "None" nil) + regexp) :group 'desktop) ;; We skip TAGS files to save time (tags-file-name is saved instead). @@ -812,9 +811,12 @@ FILENAME is the visited file name, BUFNAME is the buffer name, and MODE is the major mode. \n\(fn FILENAME BUFNAME MODE)" (let ((case-fold-search nil)) - (and (not (string-match desktop-buffers-not-to-save bufname)) + (and (not (and (stringp desktop-buffers-not-to-save) + (not filename) + (string-match desktop-buffers-not-to-save bufname))) (not (memq mode desktop-modes-not-to-save)) (or (and filename + (stringp desktop-files-not-to-save) (not (string-match desktop-files-not-to-save filename))) (and (eq mode 'dired-mode) (with-current-buffer bufname -- 2.39.2