summaryrefslogtreecommitdiff
path: root/lisp/frame.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/frame.el')
-rw-r--r--lisp/frame.el111
1 files changed, 59 insertions, 52 deletions
diff --git a/lisp/frame.el b/lisp/frame.el
index 20f7f2d5029..0a35b715b3d 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -1874,30 +1874,29 @@ In the 3rd, 4th, and 6th examples, the returned value is relative to
the opposite frame edge from the edge indicated in the input spec."
(cons (car spec) (frame-geom-value-cons (car spec) (cdr spec) frame)))
-
(defun delete-other-frames (&optional frame)
- "Delete all frames on the current terminal, except FRAME.
+ "Delete all frames on FRAME's terminal, except FRAME.
If FRAME uses another frame's minibuffer, the minibuffer frame is
-left untouched. FRAME nil or omitted means use the selected frame."
+left untouched. FRAME must be a live frame and defaults to the
+selected one."
(interactive)
- (unless frame
- (setq frame (selected-frame)))
- (let* ((mini-frame (window-frame (minibuffer-window frame)))
- (frames (delq mini-frame (delq frame (frame-list)))))
- ;; Only consider frames on the same terminal.
- (dolist (frame (prog1 frames (setq frames nil)))
- (if (eq (frame-terminal) (frame-terminal frame))
- (push frame frames)))
- ;; Delete mon-minibuffer-only frames first, because `delete-frame'
- ;; signals an error when trying to delete a mini-frame that's
- ;; still in use by another frame.
- (dolist (frame frames)
- (unless (eq (frame-parameter frame 'minibuffer) 'only)
- (delete-frame frame)))
- ;; Delete minibuffer-only frames.
- (dolist (frame frames)
- (when (eq (frame-parameter frame 'minibuffer) 'only)
- (delete-frame frame)))))
+ (setq frame (window-normalize-frame frame))
+ (let ((minibuffer-frame (window-frame (minibuffer-window frame)))
+ (this (next-frame frame t))
+ next)
+ ;; In a first round consider minibuffer-less frames only.
+ (while (not (eq this frame))
+ (setq next (next-frame this t))
+ (unless (eq (window-frame (minibuffer-window this)) this)
+ (delete-frame this))
+ (setq this next))
+ ;; In a second round consider all remaining frames.
+ (setq this (next-frame frame t))
+ (while (not (eq this frame))
+ (setq next (next-frame this t))
+ (unless (eq this minibuffer-frame)
+ (delete-frame this))
+ (setq this next))))
;; miscellaneous obsolescence declarations
(define-obsolete-variable-alias 'delete-frame-hook
@@ -2022,6 +2021,15 @@ widths."
;; Blinking cursor
+(defvar blink-cursor-idle-timer nil
+ "Timer started after `blink-cursor-delay' seconds of Emacs idle time.
+The function `blink-cursor-start' is called when the timer fires.")
+
+(defvar blink-cursor-timer nil
+ "Timer started from `blink-cursor-start'.
+This timer calls `blink-cursor-timer-function' every
+`blink-cursor-interval' seconds.")
+
(defgroup cursor nil
"Displaying text cursors."
:version "21.1"
@@ -2031,12 +2039,18 @@ widths."
"Seconds of idle time before the first blink of the cursor.
Values smaller than 0.2 sec are treated as 0.2 sec."
:type 'number
- :group 'cursor)
+ :group 'cursor
+ :set (lambda (symbol value)
+ (set-default symbol value)
+ (when blink-cursor-idle-timer (blink-cursor--start-idle-timer))))
(defcustom blink-cursor-interval 0.5
"Length of cursor blink interval in seconds."
:type 'number
- :group 'cursor)
+ :group 'cursor
+ :set (lambda (symbol value)
+ (set-default symbol value)
+ (when blink-cursor-timer (blink-cursor--start-timer))))
(defcustom blink-cursor-blinks 10
"How many times to blink before using a solid cursor on NS, X, and MS-Windows.
@@ -2048,14 +2062,23 @@ Use 0 or negative value to blink forever."
(defvar blink-cursor-blinks-done 1
"Number of blinks done since we started blinking on NS, X, and MS-Windows.")
-(defvar blink-cursor-idle-timer nil
- "Timer started after `blink-cursor-delay' seconds of Emacs idle time.
-The function `blink-cursor-start' is called when the timer fires.")
-
-(defvar blink-cursor-timer nil
- "Timer started from `blink-cursor-start'.
-This timer calls `blink-cursor-timer-function' every
-`blink-cursor-interval' seconds.")
+(defun blink-cursor--start-idle-timer ()
+ "Start the `blink-cursor-idle-timer'."
+ (when blink-cursor-idle-timer (cancel-timer blink-cursor-idle-timer))
+ (setq blink-cursor-idle-timer
+ ;; The 0.2 sec limitation from below is to avoid erratic
+ ;; behavior (or downright failure to display the cursor
+ ;; during command execution) if they set blink-cursor-delay
+ ;; to a very small or even zero value.
+ (run-with-idle-timer (max 0.2 blink-cursor-delay)
+ :repeat #'blink-cursor-start)))
+
+(defun blink-cursor--start-timer ()
+ "Start the `blink-cursor-timer'."
+ (when blink-cursor-timer (cancel-timer blink-cursor-timer))
+ (setq blink-cursor-timer
+ (run-with-timer blink-cursor-interval blink-cursor-interval
+ #'blink-cursor-timer-function)))
(defun blink-cursor-start ()
"Timer function called from the timer `blink-cursor-idle-timer'.
@@ -2066,9 +2089,7 @@ command starts, by installing a pre-command hook."
;; Set up the timer first, so that if this signals an error,
;; blink-cursor-end is not added to pre-command-hook.
(setq blink-cursor-blinks-done 1)
- (setq blink-cursor-timer
- (run-with-timer blink-cursor-interval blink-cursor-interval
- 'blink-cursor-timer-function))
+ (blink-cursor--start-timer)
(add-hook 'pre-command-hook 'blink-cursor-end)
(internal-show-cursor nil nil)))
@@ -2115,14 +2136,7 @@ This is done when a frame gets focus. Blink timers may be stopped by
(when (and blink-cursor-mode
(not blink-cursor-idle-timer))
(remove-hook 'post-command-hook 'blink-cursor-check)
- (setq blink-cursor-idle-timer
- ;; The 0.2 sec limitation from below is to avoid erratic
- ;; behavior (or downright failure to display the cursor
- ;; during command execution) if they set blink-cursor-delay
- ;; to a very small or even zero value.
- (run-with-idle-timer (max 0.2 blink-cursor-delay)
- blink-cursor-delay
- 'blink-cursor-start))))
+ (blink-cursor--start-idle-timer)))
(define-obsolete-variable-alias 'blink-cursor 'blink-cursor-mode "22.1")
@@ -2153,14 +2167,8 @@ terminals, cursor blinking is controlled by the terminal."
(when blink-cursor-mode
(add-hook 'focus-in-hook #'blink-cursor-check)
(add-hook 'focus-out-hook #'blink-cursor-suspend)
- (setq blink-cursor-idle-timer
- ;; The 0.2 sec limitation from below is to avoid erratic
- ;; behavior (or downright failure to display the cursor
- ;; during command execution) if they set blink-cursor-delay
- ;; to a very small or even zero value.
- (run-with-idle-timer (max 0.2 blink-cursor-delay)
- blink-cursor-delay
- #'blink-cursor-start))))
+ (blink-cursor--start-idle-timer)))
+
;; Frame maximization/fullscreen
@@ -2241,9 +2249,8 @@ See also `toggle-frame-maximized'."
'window-system-version "it does not give useful information." "24.3")
;; Variables which should trigger redisplay of the current buffer.
-(setq redisplay--variables (make-hash-table :test 'eq :size 10))
(mapc (lambda (var)
- (puthash var 1 redisplay--variables))
+ (add-variable-watcher var (symbol-function 'set-buffer-redisplay)))
'(line-spacing
overline-margin
line-prefix