emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] master 0d17d8d 25/62: Warn before resetting dictionary during pop


From: Ian Dunn
Subject: [elpa] master 0d17d8d 25/62: Warn before resetting dictionary during population
Date: Sat, 9 Dec 2017 14:34:00 -0500 (EST)

branch: master
commit 0d17d8d89b3513cd1161e6ab5927b16cb75529ca
Author: Ian Dunn <address@hidden>
Commit: Ian Dunn <address@hidden>

    Warn before resetting dictionary during population
    
    * paced.el (paced-populate-warn-about-reset): New defcustom
      (paced-repopulate-named-dictionary): Use it.
---
 paced.el | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/paced.el b/paced.el
index 1d4a2e6..73e2b04 100644
--- a/paced.el
+++ b/paced.el
@@ -115,6 +115,11 @@ allowing all files."
   :group 'paced
   :type 'boolean)
 
+(defcustom paced-populate-warn-about-reset t
+  "Whether to warn the user about resetting a dictionary when repopulating."
+  :group 'paced
+  :type 'boolean)
+
 
 
 (defun paced--default-dictionary-sort-func (usage-hash)
@@ -885,13 +890,15 @@ repopulating it."
 Population commands are stored in the field of the same name.
 
 Note that this will empty the dictionary's contents before
-repopulating it."
+repopulating it.  If `paced-populate-warn-about-reset' is
+non-nil, confirmation will be requested before continuing."
   (interactive
    (list (paced-read-dictionary)))
   (paced-ensure-registered key)
   (let ((dict (paced-named-dictionary key)))
-    ;; TODO: Warn about reset.
-    (paced-dictionary-repopulate dict)))
+    (when (or (not paced-populate-warn-about-reset)
+              (y-or-n-p "Warning: Repopulating dictionary will reset it.  
Continue?"))
+      (paced-dictionary-repopulate dict))))
 
 (defun paced-add-buffer-file-to-dictionary (&optional buffer)
   "Populate the dictionary of BUFFER with BUFFER.



reply via email to

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