Subject: bug#24213: 25.1.50; Fishy use of delete-window in register.el

From: Lars Ingebrigtsen <[email-masked]>
Date: Sun, 29 Sep 2019 16:58:37 +0200

Andreas Politz <[email-masked]> writes:

> I finally got around to this.  The changes in the following diff seem to
> be all clear cut cases, where the window is created by
> display-buffer/pop-to-buffer without any special window-handling logic
> attached.  Let me know what you think.  

Apparently the patch was not applied at the time, and many of the
instances have later been fixed.

I've respun the patch for Emacs 27, and the remaining fixups (replacing
delete-window with quit-window look logical to me.

Does anybody have any comments?

diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el
index 1b4b55c94f..3535a7b4aa 100644
--- a/lisp/progmodes/idlwave.el
+++ b/lisp/progmodes/idlwave.el
@@ -8271,7 +8271,7 @@ idlwave-quit-help
       (select-window olh-window)
       (idlwave-help-quit))
     (when (window-live-p ri-window)
-      (delete-window ri-window))))
+      (quit-window nil ri-window))))
 
 (defun idlwave-display-calling-sequence (name type class
 					      &optional initial-class)
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index baeaf8b95d..5bfa5f837a 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -7598,8 +7598,7 @@ verilog-complete-word
 	       (display-completion-list allcomp))
 	     ;; Wait for a key press. Then delete *Completion*  window
 	     (momentary-string-display "" (point))
-	     (delete-window (get-buffer-window (get-buffer "*Completions*")))
-	     )))))
+	     (quit-window nil (get-buffer-window "*Completions*")))))))
 
 (defun verilog-show-completions ()
   "Show all possible completions at current point."
@@ -7611,7 +7610,8 @@ verilog-show-completions
     (display-completion-list (nth 2 (verilog-completion-at-point))))
   ;; Wait for a key press. Then delete *Completion*  window
   (momentary-string-display "" (point))
-  (delete-window (get-buffer-window (get-buffer "*Completions*"))))
+  (quit-window nil (get-buffer-window "*Completions*")))
+
 
 (defun verilog-get-default-symbol ()
   "Return symbol around current point as a string."
diff --git a/lisp/startup.el b/lisp/startup.el
index 52d4dbb05c..7eb0180d41 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1853,9 +1853,7 @@ fancy-startup-tail
 		  (customize-set-variable 'inhibit-startup-screen t)
 		  (customize-mark-to-save 'inhibit-startup-screen)
 		  (custom-save-all))
-		(let ((w (get-buffer-window "*GNU Emacs*")))
-		  (and w (not (one-window-p)) (delete-window w)))
-		(kill-buffer "*GNU Emacs*")))
+		(quit-windows-on "*GNU Emacs*" t)))
      "  ")
     (when (or user-init-file custom-file)
       (let ((checked (create-image "checked.xpm"
diff --git a/lisp/strokes.el b/lisp/strokes.el
index 6edf58c7b6..2c88b1eefd 100644
--- a/lisp/strokes.el
+++ b/lisp/strokes.el
@@ -1216,9 +1216,7 @@ strokes-xpm-for-stroke
 
 ;;(defun strokes-edit-quit ()
 ;;  (interactive)
-;;  (or (one-window-p t 0)
-;;      (delete-window))
-;;  (kill-buffer "*Strokes List*"))
+;;  (quit-windows-on "*Strokes List*" t))
 
 ;;(define-derived-mode edit-strokes-mode list-mode
 ;;  "Edit-Strokes"

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no