📄 xdoc
字号:
BABYL OPTIONS:Version: 5Labels:Note: This is the header of an rmail file.Note: If you are seeing it in rmail,Note: it means the file has no messages in it.1,,Received: from ATHENA (ATHENA.MIT.EDU) by prep; Thu, 19 Dec 85 23:09:34 estReceived: from PARIS (PARIS.MIT.EDU) by ATHENA (4.12/4.7) id AA02786; Thu, 19 Dec 85 23:07:35 estFrom: martillo@ATHENA.MIT.EDU (Yakim Martillo)Received: by PARIS (5.15/4.7) id AA24170; Thu, 19 Dec 85 23:07:36 ESTDate: Thu, 19 Dec 85 23:07:36 ESTMessage-Id: <8512200407.AA24170@PARIS>To: rms@prepCc: lbmSubject: Gnu Emacs + X documentation*** EOOH ***From: martillo@ATHENA.MIT.EDU (Yakim Martillo)Date: Thu, 19 Dec 85 23:07:36 ESTTo: rms@prepCc: lbmSubject: Gnu Emacs + X documentationThis is the start of my X documentation.I have not finished the last five sections yet. Please give me somesuggestions.JoachimSpecial Terminal InterfacesSome terminals provide special capabilities which can be moreeffectively used via specially written C functions rather than normaltermcap processing. To ease the use of these capabilities and aid theintegration of these C functions, special terminal hooks are provided.The hooks are all externed in the source header file termhooks.h.To determine the arguments, the interested user who wishes to developa special terminal interface should consult term.c.For proper functioning of the user defined C termhook functions, theuser should make certain that the terminal characteristics as externedin termchar.h are properly set. Examples of how to use the termhooks can be found in xterm.c whichcontains the Gnu Emacs to X interface.Gnu Emacs to X InterfaceThe termhooks feature has enough power that termhooks need not berestricted merely to the employment of special terminal capabilities.Termhooks can be used to interface Gnu Emacs to special graphicsdevices or window systems. Gnu Emacs interfaces with not a great dealof difficulty to the MIT/Project Athena X Window system. With not toomuch effort, a competent hacker should be able to interface Gnu Emacsto the Sun, Apollo, or Blit Window systems.What is X?X is a network transparent window system developed at MIT by BobScheiffler, Jim Gettys, Tony della Fera, Ron Newman and others. X isa descendent of the Stanford V kernal system and Gosling's rectanglemanagement system. X has a standard protocol for communication withan X server which talks to the high resolution graphics device driver.The X developers have supplied a library libX.a which provides libraryroutines to handle typical graphics/window system commands. X isnetwork transparent in that a process running on a machine which wantsto make use of a high resolution graphics device will establish anetwork connection to the X server which talks to the driver for thatdevice. The process will be a client of the X server. Since LAN'stypically can move data at megabit rates, running a window system inthis fashion has many advantages. For more information about X,hackers are directed to "Xlib - C Language X Interface Version (?)"written by Jim Gettys (DEC/MIT) and Ron Newman (MIT).New Functionality of Gnu Emacs + XGnu Emacs running as a client of X provides very rapid line insertionand deletion because bit blit commands are sent to the server and thedriver simply tells the device to move the pixels on the screendirectly. In fact, Gnu Emacs running under the xterm terminalemulator can also cause bit blts to take place but bit blits via theterminal emulator are rather slow because of escape sequence parsingoverhead in the terminal emulator and because of context switchingoverhead as the bits take a merry trip through the pty interfaces anddrivers. Gnu Emacs runs in its own X window and therefore no information islost from the xterm session from which the user invoked Gnu Emacs.Gnu Emacs should probably be run in background from the parent Xsession because then the user may continue to do more work in theparent xterm session. As Gnu Emacs should be run in background, thelisp form (put 'suspend-emacs 'disabled t)is passed to the Gnu Emacs lisp interpreter when Gnu Emacs is invokedfrom an xterm terminal emulator. Should the user accidently type thekey sequence for suspend-emacs (initially C-z or C-XC-z), he will bequeried whether he truly wishes to suspend emacs. Unless the user isconfident he should reply n (= no).If the user has an X window manager running, the user can resize theGnu Emacs window using the usual mouse sequences which have beengrabbed by the window manager. Gnu Emacs then automatically resizesitself and updates the display. By using the mouse window manager commands, the user can causeformerly obscured sections of the Gnu Emacs window to be uncovered.These sections have to be repainted. Since Gnu Emacs creates the GnuEmacs window by its lonesome, Gnu Emacs must repaint these sections ofthe window all by itself. If Gnu Emacs is chugging away on someglobal regexp replacement, Gnu Emacs may take its time in repaintingthe display. (Similar repainting may take place on bit blits.)With the Gnu Emacs to X interface the mouse becomes even morepowerful. Some mouse events (basically the ones not grabbed by thewindow manager) are passed to Gnu Emacs. Gnu Emacs is informed of thereception of such events because it receives the key sequence C-cC-m.Therefore a user who wishes to use the Gnu Emacs to X interface shouldnot rebind this key sequence to any function.This key sequence is bound to the lisp function x-mouse-mode whichgoes and checks the special X Mouse Queue for mouse events. Eachcontrol/shift/meta-mouse button sequence is associated with a definedconstant in the lisp file x-mouse.el. The constants are defined asfollows: (defconst x-button-right (char-to-string 0)) (defconst x-button-middle (char-to-string 1)) (defconst x-button-left (char-to-string 2)) (defconst x-button-s-right (char-to-string 16)) (defconst x-button-s-middle (char-to-string 17)) (defconst x-button-s-left (char-to-string 18)) (defconst x-button-m-right (char-to-string 32)) (defconst x-button-m-middle (char-to-string 33)) (defconst x-button-m-left (char-to-string 34)) (defconst x-button-c-right (char-to-string 64)) (defconst x-button-c-middle (char-to-string 65)) (defconst x-button-c-left (char-to-string 66)) (defconst x-button-m-s-right (char-to-string 48)) (defconst x-button-m-s-middle (char-to-string 49)) (defconst x-button-m-s-left (char-to-string 50)) (defconst x-button-c-s-right (char-to-string 80)) (defconst x-button-c-s-middle (char-to-string 81)) (defconst x-button-c-s-left (char-to-string 82)) (defconst x-button-c-m-right (char-to-string 96)) (defconst x-button-c-m-middle (char-to-string 97)) (defconst x-button-c-m-left (char-to-string 98)) (defconst x-button-c-m-s-right (char-to-string 112)) (defconst x-button-c-m-s-middle (char-to-string 113)) (defconst x-button-c-m-s-left (char-to-string 114)).To understand why these constants are so defined, the user shouldcheck out the (C) definition of the lisp function x-mouse-mode in thesrc file xfns.c. (I, Joachim Martillo not RMS, do not claim this code handles mouse events in the best way possible, and allinvolved with maintaining the Gnu Emacs to X interface would be opento suggestions for improvement.)Anyway, using these defined constants, the user may bind his owndefined functions to mouse sequences using the define-key command asbelow: (define-key mouse-map x-button-right 'x-mouse-select).Mouse functions are defined like any of the other lisp functions inGnu Emacs.Here, exempli gratia, is the lisp definition of x-mouse-select: (defun x-mouse-select (arg) "Select Emacs window the mouse is on." (let ((start-w (selected-window)) (done nil) (w (selected-window)) (rel-coordinate nil)) (while (and (not done) (null (setq rel-coordinate (coordinates-in-window-p arg w)))) (setq w (next-window w)) (if (eq w start-w) (setq done t))) (select-window w) rel-coordinate)).When the mouse sequence is received, x-mouse-mode checks out the mousequeue, sees the defined constant associated with that button event,looks up that defined constants binding in the mouse-map and theninvokes this lisp function with arg which is a list of the x and ycoordinates of the mouse when the mouse event under question tookplace. The lisp symbol arg is bound to (x-coordinate y-coordinate).The supplied mouse-functions and bindings are: x-cut-and-wipe-text Function: Kill text between point and mouse; also copy to window system cut buffer. Binding: C-Middle Button. x-cut-text Function: Copy text between point and mouse position into window system cut buffer. Binding: S-Middle Button (i.e. Shift-Middle Button). x-mouse-keep-one-window Function: Select Emacs window mouse is on, then kill all other Emacs windows. Binding: C-S-Right Button. x-mouse-select Function: Select Emacs window the mouse is on. Binding: Right Button. x-mouse-select-and-split Function: Select Emacs window mouse is on, then split it vertically in half. Binding: C-Right Button. x-mouse-set-mark
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -