[Top][All Lists]

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

[elpa] externals/ebdb 9febf18 02/12: New command ebdb-save-ebdb

From: Eric Abrahamsen
Subject: [elpa] externals/ebdb 9febf18 02/12: New command ebdb-save-ebdb
Date: Tue, 12 Jun 2018 22:06:08 -0400 (EDT)

branch: externals/ebdb
commit 9febf18f016db420f8f788d4a66fb1f2f53c181f
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>

    New command ebdb-save-ebdb
    * ebdb-com.el (ebdb-save-ebdb): New command that calls `ebdb-save' and
      then maybe marks all buffers as unmodified.
    * ebdb.el (ebdb-save): This is no longer an interactive function, and
      doesn't mess with buffers.
 ebdb-com.el | 17 +++++++++++++++--
 ebdb.el     | 18 ++++++++----------
 2 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/ebdb-com.el b/ebdb-com.el
index 9bc7583..fb09b06 100644
--- a/ebdb-com.el
+++ b/ebdb-com.el
@@ -291,8 +291,8 @@ display information."
     (define-key km (kbd "I")            'ebdb-cite-records-ebdb)
     (define-key km (kbd "C-k")         'ebdb-delete-field-or-record)
     (define-key km (kbd "i")           'ebdb-insert-field)
-    (define-key km (kbd "s")           'ebdb-save)
-    (define-key km (kbd "C-x C-s")     'ebdb-save)
+    (define-key km (kbd "s")           'ebdb-save-ebdb)
+    (define-key km (kbd "C-x C-s")     'ebdb-save-ebdb)
     (define-key km (kbd "t")           'ebdb-toggle-records-format)
     (define-key km (kbd "T")           'ebdb-display-records-completely)
     ;; Marking
@@ -1231,6 +1231,19 @@ Derives from `special-mode'; the usual `special-mode' 
bindings apply.
   (add-hook 'post-command-hook 'force-mode-line-update nil t))
+(defun ebdb-save-ebdb (&optional some)
+  "Save all EBDB databases interactively.
+Differs from `ebdb-save' in that it also sets all *EBDB* buffers
+as unmodified.  With prefix arg SOME, prompt to save each
+  (interactive "p")
+  (ebdb-save some)
+  (unless (ebdb-dirty-dbs)
+    (dolist (b (buffer-list))
+      (with-current-buffer b
+       (when (derived-mode-p 'ebdb-mode)
+         (set-buffer-modified-p nil))))))
 (defun ebdb-sendmail-menu (record)
diff --git a/ebdb.el b/ebdb.el
index 3cacfbb..885f073 100644
--- a/ebdb.el
+++ b/ebdb.el
@@ -5120,20 +5120,18 @@ This is a generic function that dispatches on the value 
 ;;; Loading and saving EBDB
-(defun ebdb-save (&optional prompt)
+(defun ebdb-save (&optional interactive)
   "Save the EBDB if it is modified.
-If PROMPT is non-nil, prompt before saving."
-  (interactive (list nil))
+If INTERACTIVE is non-nil, report progess.  If it is 4,
+additionally prompt to save each database individually."
   ;; TODO: Reimplement ebdb-remote-file, or otherwise do something
   ;; about that.
-  (message "Saving the EBDB...")
+  (when interactive
+   (message "Saving the EBDB..."))
   (dolist (s ebdb-db-list)
-    (ebdb-db-save s prompt))
-  (dolist (b (buffer-list))
-    (with-current-buffer b
-      (when (derived-mode-p 'ebdb-mode)
-       (set-buffer-modified-p nil))))
-  (message "Saving the EBDB... done"))
+    (ebdb-db-save s (eq interactive 4)))
+  (when interactive
+   (message "Saving the EBDB... done")))
 ;;; Searching EBDB

reply via email to

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