changeset 83396:201f610eb492

Update frames-on-display-list to accept terminal id numbers. * lisp/frame.el (frames-on-display-list): Use terminal-id to get the display id. (terminal-id): Also accept X display strings and tty device names. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-436
author Karoly Lorentey <lorentey@elte.hu>
date Mon, 07 Nov 2005 14:17:18 +0000
parents b31326248cf6
children 693e794b57bf
files README.multi-tty lisp/frame.el
diffstat 2 files changed, 45 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/README.multi-tty	Tue Nov 01 06:23:08 2005 +0000
+++ b/README.multi-tty	Mon Nov 07 14:17:18 2005 +0000
@@ -424,9 +424,6 @@
    instead of delete-frame-functions),
    after-delete-terminal-functions, after-create-terminal-functions.
 
-** If the first key pressed on a new tty terminal is a function key,
-   it is not recognized correctly.  May be related to the bug below.
-
 ** Fix set-input-mode for multi-tty.  It's a truly horrible interface;
    what if we'd blow it up into several separate functions (with a
    compatibility definition)?
@@ -472,20 +469,6 @@
     frame-display                       terminal-of-frame
     delete-display			delete-terminal
 
-** The semantics of terminal-local variables are confusing; it is not
-   clear what binding is in effect in any given time.  See if
-   current_kboard (or at least the terminal-local bindings exported to
-   Lisp) might be changed to be tied to the selected frame instead.
-   Currently, `function-key-map' and `key-translation-map' may be
-   accessed reliably only using the hackish
-   `(set-)terminal-local-value' functions.
-
-   Perhaps there should be a difference between `last-command' &co.
-   and these more conventional configuration variables.
-   (E.g. `symbol-value' would use current_kboard to access
-   `last-command', but SELECTED_FRAME()->display->kboard to get the
-   value of `function-key-map'.
-
 ** The single-keyboard mode of MULTI_KBOARD is extremely confusing
    sometimes; Emacs does not respond to stimuli from other keyboards.
    At least a beep or a message would be important, if the single-mode
@@ -1261,5 +1244,27 @@
 
    (Done in patch-431.)
 
+-- The semantics of terminal-local variables are confusing; it is not
+   clear what binding is in effect in any given time.  See if
+   current_kboard (or at least the terminal-local bindings exported to
+   Lisp) might be changed to be tied to the selected frame instead.
+   Currently, `function-key-map' and `key-translation-map' may be
+   accessed reliably only using the hackish
+   `(set-)terminal-local-value' functions.
+
+   Perhaps there should be a difference between `last-command' &co.
+   and these more conventional configuration variables.
+   (E.g. `symbol-value' would use current_kboard to access
+   `last-command', but SELECTED_FRAME()->display->kboard to get the
+   value of `function-key-map'.
+
+   (Fixed in patch-434.)
+
+-- If the first key pressed on a new tty terminal is a function key,
+   it is not recognized correctly.  May be related to the bug below.
+
+   (Seems to have been fixed as a side effect of patch-434.  "The bug
+   below" was the set-input-mode madness.)
+
 ;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d
 
--- a/lisp/frame.el	Tue Nov 01 06:23:08 2005 +0000
+++ b/lisp/frame.el	Mon Nov 07 14:17:18 2005 +0000
@@ -696,17 +696,18 @@
    (function (lambda (frame)
 	       (eq frame (window-frame (minibuffer-window frame)))))))
 
-(defun frames-on-display-list (&optional display)
-  "Return a list of all frames on DISPLAY.
-
-DISPLAY should be a display identifier (an integer), but it may
-also be a name of a display, a string of the form HOST:SERVER.SCREEN.
+(defun frames-on-display-list (&optional terminal)
+  "Return a list of all frames on TERMINAL.
 
-If DISPLAY is omitted or nil, it defaults to the selected frame's display."
-  (let* ((display (or display (frame-display)))
+TERMINAL should be a terminal identifier (an integer), a frame,
+or a name of an X display (a string of the form
+HOST:SERVER.SCREEN).
+
+If TERMINAL is omitted or nil, it defaults to the selected
+frame's terminal device."
+  (let* ((terminal (terminal-id terminal))
 	 (func #'(lambda (frame)
-		   (or (eq (frame-display frame) display)
-		       (equal (frame-parameter frame 'display) display)))))
+		   (eq (frame-display frame) terminal))))
     (filtered-frame-list func)))
 
 (defun framep-on-display (&optional display)
@@ -1430,13 +1431,23 @@
 (defun terminal-id (terminal)
   "Return the numerical id of terminal TERMINAL.
 
-TERMINAL can be a terminal id, a frame, or nil (meaning the
-selected frame's terminal)."
+TERMINAL can be a terminal id (an integer), a frame, or
+nil (meaning the selected frame's terminal).  Alternatively,
+TERMINAL may be the name of an X display
+device (HOST.SERVER.SCREEN) or a tty device file."
   (cond
    ((integerp terminal)
-    terminal)
+    (if (display-live-p terminal)
+	terminal
+      (signal 'wrong-type-argument (list 'display-live-p terminal))))
    ((or (null terminal) (framep terminal))
     (frame-display terminal))
+   ((stringp terminal)
+    (let ((f (car (filtered-frame-list (lambda (frame)
+					 (or (equal (frame-parameter frame 'display) terminal)
+					     (equal (frame-parameter frame 'tty) terminal)))))))
+      (or f (error "Display %s does not exist" terminal))
+      (frame-display f)))
    (t
     (error "Invalid argument %s in `terminal-id'" terminal))))