(defvar gc 0) (defvar he 0) (add-hook 'post-gc-hook (lambda () (setq gc (1+ gc)))) (defun show-gc-he () (message "gc: %s ... he: %s" gc he)) (add-hook 'post-command-hook 'show-gc-he) (defun mode-line-default-help-echo (window) "Return default help echo text for WINDOW's mode line." (let* ((frame (window-frame window)) (line-1a ;; Show text to select window only if the window is not ;; selected. (not (eq window (frame-selected-window frame)))) (line-1b ;; Show text to drag mode line if either the window is not ;; at the bottom of its frame or the minibuffer window of ;; this frame can be resized. This matches a corresponding ;; check in `mouse-drag-mode-line'. (or (not (window-at-side-p window 'bottom)) (let ((mini-window (minibuffer-window frame))) (and (eq frame (window-frame mini-window)) (or (minibuffer-window-active-p mini-window) (not resize-mini-windows)))))) (line-2 ;; Show text make window occupy the whole frame ;; only if it doesn't already do that. (not (eq window (frame-root-window frame)))) (line-3 ;; Show text to delete window only if that's possible. (not (eq window (frame-root-window frame))))) (setq he (1+ he)) (when (or line-1a line-1b line-2 line-3) (concat (when (or line-1a line-1b) (concat "mouse-1: " (when line-1a "Select window") (when line-1b (if line-1a " (drag to resize)" "Drag to resize")) (when (or line-2 line-3) "\n"))) (when line-2 (concat "mouse-2: Make window occupy whole frame" (when line-3 "\n"))) (when line-3 "mouse-3: Remove window from frame")))))