For details see the section "(elisp) Mouse Window Auto-selection" in
the ELisp manual.
+---
+*** 'select-frame-by-name' now may return a frame on another display
+if it does not find a suitable one on the current display.
+
---
** 'tcl-auto-fill-mode' is now declared obsolete. Its functionality
can be replicated simply by setting 'comment-auto-fill-only-comments'.
(defvar frame-name-history nil)
(defun select-frame-by-name (name)
- "Select the frame on the current terminal whose name is NAME and raise it.
+ "Select the frame whose name is NAME and raise it.
+Frames on the current terminal are checked first.
If there is no frame by that name, signal an error."
(interactive
(let* ((frame-names-alist (make-frame-names-alist))
(if (= (length input) 0)
(list default)
(list input))))
- (let* ((frame-names-alist (make-frame-names-alist))
- (frame (cdr (assoc name frame-names-alist))))
- (if frame
- (select-frame-set-input-focus frame)
- (error "There is no frame named `%s'" name))))
+ (select-frame-set-input-focus
+ ;; Prefer frames on the current display.
+ (or (cdr (assoc name (make-frame-names-alist)))
+ (catch 'done
+ (dolist (frame (frame-list))
+ (when (equal (frame-parameter frame 'name) name)
+ (throw 'done frame))))
+ (error "There is no frame named `%s'" name))))
\f
;;;; Background mode.