Commits

Stephen Weeks  committed 3954b3f

made a y-or-n-p that cleans up the minibuffer after itself

  • Participants
  • Parent commits ec86d0e

Comments (0)

Files changed (2)

 ;; (List.mem '(1 2 3) 4)
 ;; (List.mem '(1 2 3 4) 4)
 
-(defun List.assoc (x_assoc l_assoc) 
+(defun List.assoc (x_assoc l_assoc)
   (let ((res (assoc x_assoc l_assoc)))
     (when res (cdr res))))
 ;; (List.assoc 5 '((5 . 6) (1 . 3)))
       (sit-for 60)
     (delete-overlay overlay)))
 
+(defun Emacs.y-or-n-p (prompt)
+  (let ((result (y-or-n-p prompt)))
+    ;; The [(message nil)] is necessary to clear the minibuffer.
+    (message nil)
+    result))
+
 ;;----------------------------------------------------------------------------;;
 ;; Hg                                                                         ;;
 ;;----------------------------------------------------------------------------;;
 (defun Omake.Env.set (id)
   (let ((ids (Omake.id-to-string id)))
     (if (or (not (Omake.Model.has id))
-            (y-or-n-p
+            (Emacs.y-or-n-p
              (format
               "Project %s is building.\nThis will only affect subsequent builds.  Proceed? "
               ids)))
         (let ((var (completing-read "Var: " Omake.Env.vars nil t))
               (value (completing-read "Value: " '("true" "false") nil t)))
-          (Omake.Server.setenv id var value))
-      ;; The [(message nil)] is necessary to clear the minibuffer.
-      (message nil))))
+          (Omake.Server.setenv id var value)))))
 
 (defun Omake.Env.get (id)
   (let ((var (completing-read "Var: " Omake.Env.vars nil t)))
          (id (Omake.Id.of-path path)))
     (catch 'exit
       (when (Omake.Model.has id)
-        (let ((kill (y-or-n-p
+        (let ((kill (Emacs.y-or-n-p
                      (format
                       "A compilation process for %s is already running.  Kill it? "
                       (Omake.id-to-string id)))))