@deffn Command delete-frame &optional frame force
@vindex delete-frame-functions
+@vindex after-delete-frame-functions
This function deletes the frame @var{frame}. The argument @var{frame}
must specify a live frame (see below) and defaults to the selected
frame.
@var{frame} as their ancestor will exist. Then, unless @var{frame}
specifies a tooltip, this function runs the hook
@code{delete-frame-functions} (each function getting one argument,
-@var{frame}) before actually killing the frame.
+@var{frame}) before actually killing the frame. After actually killing
+the frame and removing the frame from the frame list, @code{delete-frame}
+runs @code{after-delete-frame-functions}.
Note that a frame cannot be deleted as long as its minibuffer serves as
surrogate minibuffer for another frame (@pxref{Minibuffers and Frames}).
(cancel-timer blink-cursor-idle-timer)
(setq blink-cursor-idle-timer nil)))
-(defun blink-cursor--should-blink (&optional ignored-frame)
+(defun blink-cursor--should-blink ()
"Determine whether we should be blinking.
-Returns whether we have any focused non-TTY frame. IGNORED-FRAME
-is a frame to ignore during the scan, used when we want to ignore
-a frame about to be deleted."
+Returns whether we have any focused non-TTY frame."
(and blink-cursor-mode
(let ((frame-list (frame-list))
(any-graphical-focused nil))
(while frame-list
(let ((frame (pop frame-list)))
- (when (and (not (eq frame ignored-frame))
- (display-graphic-p frame)
- (frame-focus-state frame))
+ (when (and (display-graphic-p frame) (frame-focus-state frame))
(setf any-graphical-focused t)
(setf frame-list nil))))
any-graphical-focused)))
-(defun blink-cursor-check (&optional ignored-frame)
+(defun blink-cursor-check ()
"Check if cursor blinking shall be restarted.
This is done when a frame gets focus. Blink timers may be
stopped by `blink-cursor-suspend'. Internally calls
`blink-cursor--should-blink' and returns its result."
- (let ((should-blink (blink-cursor--should-blink ignored-frame)))
+ (let ((should-blink (blink-cursor--should-blink)))
(when (and should-blink (not blink-cursor-idle-timer))
(remove-hook 'post-command-hook 'blink-cursor-check)
(blink-cursor--start-idle-timer))
should-blink))
-(defun blink-cursor--rescan-frames (&optional ignored-frame)
- "Called when the set of focused frames changes or when we
-delete a frame. Re-check whether we want to enable blinking.
-IGNORED-FRAME is there so we ignore a frame about to be deleted
-when we're called under via `delete-frame-functions'."
- (unless (blink-cursor-check ignored-frame)
+(defun blink-cursor--rescan-frames (&optional _ign)
+ "Called when the set of focused frames changes or when we delete a frame."
+ (unless (blink-cursor-check)
(blink-cursor-suspend)))
(define-minor-mode blink-cursor-mode
:group 'cursor
:global t
(blink-cursor-suspend)
- (remove-hook 'delete-frame-functions #'blink-cursor--rescan-frames)
+ (remove-hook 'after-delete-frame-functions #'blink-cursor--rescan-frames)
(remove-function after-focus-change-function #'blink-cursor--rescan-frames)
(when blink-cursor-mode
(add-function :after after-focus-change-function #'blink-cursor--rescan-frames)
- (add-hook 'delete-frame-functions #'blink-cursor--rescan-frames)
+ (add-hook 'after-delete-frame-functions #'blink-cursor--rescan-frames)
(blink-cursor--start-idle-timer)))
\f
if (!is_tooltip_frame)
update_mode_lines = 15;
+ /* Now run the post-deletion hooks. */
+ if (NILP (Vrun_hooks) || is_tooltip_frame)
+ ;
+ else if (EQ (force, Qnoelisp))
+ pending_funcalls
+ = Fcons (list3 (Qrun_hook_with_args, Qafter_delete_frame_functions, frame),
+ pending_funcalls);
+ else
+ safe_call2 (Qrun_hook_with_args, Qafter_delete_frame_functions, frame);
+
return Qnil;
}
Vdelete_frame_functions = Qnil;
DEFSYM (Qdelete_frame_functions, "delete-frame-functions");
+ DEFVAR_LISP ("after-delete-frame-functions",
+ Vafter_delete_frame_functions,
+ doc: /* Functions run after deleting a frame.
+The functions are run with one arg, the frame that was deleted and
+which is now dead. */);
+ Vafter_delete_frame_functions = Qnil;
+ DEFSYM (Qafter_delete_frame_functions, "after-delete-frame-functions");
+
DEFVAR_LISP ("menu-bar-mode", Vmenu_bar_mode,
doc: /* Non-nil if Menu-Bar mode is enabled.
See the command `menu-bar-mode' for a description of this minor mode.