frames.texi 117 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853
  1. @c -*-texinfo-*-
  2. @c This is part of the GNU Emacs Lisp Reference Manual.
  3. @c Copyright (C) 1990-1995, 1998-1999, 2001-2015 Free Software
  4. @c Foundation, Inc.
  5. @c See the file elisp.texi for copying conditions.
  6. @node Frames
  7. @chapter Frames
  8. @cindex frame
  9. A @dfn{frame} is a screen object that contains one or more Emacs
  10. windows (@pxref{Windows}). It is the kind of object called a
  11. ``window'' in the terminology of graphical environments; but we can't
  12. call it a ``window'' here, because Emacs uses that word in a different
  13. way. In Emacs Lisp, a @dfn{frame object} is a Lisp object that
  14. represents a frame on the screen. @xref{Frame Type}.
  15. A frame initially contains a single main window and/or a minibuffer
  16. window; you can subdivide the main window vertically or horizontally
  17. into smaller windows. @xref{Splitting Windows}.
  18. @cindex terminal
  19. A @dfn{terminal} is a display device capable of displaying one or
  20. more Emacs frames. In Emacs Lisp, a @dfn{terminal object} is a Lisp
  21. object that represents a terminal. @xref{Terminal Type}.
  22. @cindex text terminal
  23. @cindex graphical terminal
  24. @cindex graphical display
  25. There are two classes of terminals: @dfn{text terminals} and
  26. @dfn{graphical terminals}. Text terminals are non-graphics-capable
  27. displays, including @command{xterm} and other terminal emulators. On
  28. a text terminal, each Emacs frame occupies the terminal's entire
  29. screen; although you can create additional frames and switch between
  30. them, the terminal only shows one frame at a time. Graphical
  31. terminals, on the other hand, are managed by graphical display systems
  32. such as the X Window System, which allow Emacs to show multiple frames
  33. simultaneously on the same display.
  34. On GNU and Unix systems, you can create additional frames on any
  35. available terminal, within a single Emacs session, regardless of
  36. whether Emacs was started on a text or graphical terminal. Emacs can
  37. display on both graphical and text terminals simultaneously. This
  38. comes in handy, for instance, when you connect to the same session
  39. from several remote locations. @xref{Multiple Terminals}.
  40. @defun framep object
  41. This predicate returns a non-@code{nil} value if @var{object} is a
  42. frame, and @code{nil} otherwise. For a frame, the value indicates which
  43. kind of display the frame uses:
  44. @table @code
  45. @item t
  46. The frame is displayed on a text terminal.
  47. @item x
  48. The frame is displayed on an X graphical terminal.
  49. @item w32
  50. The frame is displayed on a MS-Windows graphical terminal.
  51. @item ns
  52. The frame is displayed on a GNUstep or Macintosh Cocoa graphical
  53. terminal.
  54. @item pc
  55. The frame is displayed on an MS-DOS terminal.
  56. @end table
  57. @end defun
  58. @defun frame-terminal &optional frame
  59. This function returns the terminal object that displays @var{frame}.
  60. If @var{frame} is @code{nil} or unspecified, it defaults to the
  61. selected frame.
  62. @end defun
  63. @defun terminal-live-p object
  64. This predicate returns a non-@code{nil} value if @var{object} is a
  65. terminal that is live (i.e., not deleted), and @code{nil} otherwise.
  66. For live terminals, the return value indicates what kind of frames are
  67. displayed on that terminal; the list of possible values is the same as
  68. for @code{framep} above.
  69. @end defun
  70. @menu
  71. * Creating Frames:: Creating additional frames.
  72. * Multiple Terminals:: Displaying on several different devices.
  73. * Frame Parameters:: Controlling frame size, position, font, etc.
  74. * Terminal Parameters:: Parameters common for all frames on terminal.
  75. * Frame Titles:: Automatic updating of frame titles.
  76. * Deleting Frames:: Frames last until explicitly deleted.
  77. * Finding All Frames:: How to examine all existing frames.
  78. * Minibuffers and Frames:: How a frame finds the minibuffer to use.
  79. * Input Focus:: Specifying the selected frame.
  80. * Visibility of Frames:: Frames may be visible or invisible, or icons.
  81. * Raising and Lowering:: Raising a frame makes it hide other windows;
  82. lowering it makes the others hide it.
  83. * Frame Configurations:: Saving the state of all frames.
  84. * Mouse Tracking:: Getting events that say when the mouse moves.
  85. * Mouse Position:: Asking where the mouse is, or moving it.
  86. * Pop-Up Menus:: Displaying a menu for the user to select from.
  87. * Dialog Boxes:: Displaying a box to ask yes or no.
  88. * Pointer Shape:: Specifying the shape of the mouse pointer.
  89. * Window System Selections:: Transferring text to and from other X clients.
  90. * Drag and Drop:: Internals of Drag-and-Drop implementation.
  91. * Color Names:: Getting the definitions of color names.
  92. * Text Terminal Colors:: Defining colors for text terminals.
  93. * Resources:: Getting resource values from the server.
  94. * Display Feature Testing:: Determining the features of a terminal.
  95. @end menu
  96. @node Creating Frames
  97. @section Creating Frames
  98. @cindex frame creation
  99. To create a new frame, call the function @code{make-frame}.
  100. @deffn Command make-frame &optional alist
  101. This function creates and returns a new frame, displaying the current
  102. buffer.
  103. The @var{alist} argument is an alist that specifies frame parameters
  104. for the new frame. @xref{Frame Parameters}. If you specify the
  105. @code{terminal} parameter in @var{alist}, the new frame is created on
  106. that terminal. Otherwise, if you specify the @code{window-system}
  107. frame parameter in @var{alist}, that determines whether the frame
  108. should be displayed on a text terminal or a graphical terminal.
  109. @xref{Window Systems}. If neither is specified, the new frame is
  110. created in the same terminal as the selected frame.
  111. Any parameters not mentioned in @var{alist} default to the values in
  112. the alist @code{default-frame-alist} (@pxref{Initial Parameters});
  113. parameters not specified there default from the X resources or its
  114. equivalent on your operating system (@pxref{X Resources,, X Resources,
  115. emacs, The GNU Emacs Manual}). After the frame is created, Emacs
  116. applies any parameters listed in @code{frame-inherited-parameters}
  117. (see below) and not present in the argument, taking the values from
  118. the frame that was selected when @code{make-frame} was called.
  119. Note that on multi-monitor displays (@pxref{Multiple Terminals}), the
  120. window manager might position the frame differently than specified by
  121. the positional parameters in @var{alist} (@pxref{Position
  122. Parameters}). For example, some window managers have a policy of
  123. displaying the frame on the monitor that contains the largest part of
  124. the window (a.k.a.@: the @dfn{dominating} monitor).
  125. This function itself does not make the new frame the selected frame.
  126. @xref{Input Focus}. The previously selected frame remains selected.
  127. On graphical terminals, however, the windowing system may select the
  128. new frame for its own reasons.
  129. @end deffn
  130. @defvar before-make-frame-hook
  131. A normal hook run by @code{make-frame} before it creates the frame.
  132. @end defvar
  133. @defvar after-make-frame-functions
  134. An abnormal hook run by @code{make-frame} after it creates the frame.
  135. Each function in @code{after-make-frame-functions} receives one argument, the
  136. frame just created.
  137. @end defvar
  138. @defvar frame-inherited-parameters
  139. This variable specifies the list of frame parameters that a newly
  140. created frame inherits from the currently selected frame. For each
  141. parameter (a symbol) that is an element in the list and is not present
  142. in the argument to @code{make-frame}, the function sets the value of
  143. that parameter in the created frame to its value in the selected
  144. frame.
  145. @end defvar
  146. @node Multiple Terminals
  147. @section Multiple Terminals
  148. @cindex multiple terminals
  149. @cindex multi-tty
  150. @cindex multiple X displays
  151. @cindex displays, multiple
  152. Emacs represents each terminal as a @dfn{terminal object} data type
  153. (@pxref{Terminal Type}). On GNU and Unix systems, Emacs can use
  154. multiple terminals simultaneously in each session. On other systems,
  155. it can only use a single terminal. Each terminal object has the
  156. following attributes:
  157. @itemize @bullet
  158. @item
  159. The name of the device used by the terminal (e.g., @samp{:0.0} or
  160. @file{/dev/tty}).
  161. @item
  162. The terminal and keyboard coding systems used on the terminal.
  163. @xref{Terminal I/O Encoding}.
  164. @item
  165. The kind of display associated with the terminal. This is the symbol
  166. returned by the function @code{terminal-live-p} (i.e., @code{x},
  167. @code{t}, @code{w32}, @code{ns}, or @code{pc}). @xref{Frames}.
  168. @item
  169. A list of terminal parameters. @xref{Terminal Parameters}.
  170. @end itemize
  171. There is no primitive for creating terminal objects. Emacs creates
  172. them as needed, such as when you call @code{make-frame-on-display}
  173. (described below).
  174. @defun terminal-name &optional terminal
  175. This function returns the file name of the device used by
  176. @var{terminal}. If @var{terminal} is omitted or @code{nil}, it
  177. defaults to the selected frame's terminal. @var{terminal} can also be
  178. a frame, meaning that frame's terminal.
  179. @end defun
  180. @defun terminal-list
  181. This function returns a list of all live terminal objects.
  182. @end defun
  183. @defun get-device-terminal device
  184. This function returns a terminal whose device name is given by
  185. @var{device}. If @var{device} is a string, it can be either the file
  186. name of a terminal device, or the name of an X display of the form
  187. @samp{@var{host}:@var{server}.@var{screen}}. If @var{device} is a
  188. frame, this function returns that frame's terminal; @code{nil} means
  189. the selected frame. Finally, if @var{device} is a terminal object
  190. that represents a live terminal, that terminal is returned. The
  191. function signals an error if its argument is none of the above.
  192. @end defun
  193. @defun delete-terminal &optional terminal force
  194. This function deletes all frames on @var{terminal} and frees the
  195. resources used by it. It runs the abnormal hook
  196. @code{delete-terminal-functions}, passing @var{terminal} as the
  197. argument to each function.
  198. If @var{terminal} is omitted or @code{nil}, it defaults to the
  199. selected frame's terminal. @var{terminal} can also be a frame,
  200. meaning that frame's terminal.
  201. Normally, this function signals an error if you attempt to delete the
  202. sole active terminal, but if @var{force} is non-@code{nil}, you are
  203. allowed to do so. Emacs automatically calls this function when the
  204. last frame on a terminal is deleted (@pxref{Deleting Frames}).
  205. @end defun
  206. @defvar delete-terminal-functions
  207. An abnormal hook run by @code{delete-terminal}. Each function
  208. receives one argument, the @var{terminal} argument passed to
  209. @code{delete-terminal}. Due to technical details, the functions may
  210. be called either just before the terminal is deleted, or just
  211. afterwards.
  212. @end defvar
  213. @cindex terminal-local variables
  214. A few Lisp variables are @dfn{terminal-local}; that is, they have a
  215. separate binding for each terminal. The binding in effect at any time
  216. is the one for the terminal that the currently selected frame belongs
  217. to. These variables include @code{default-minibuffer-frame},
  218. @code{defining-kbd-macro}, @code{last-kbd-macro}, and
  219. @code{system-key-alist}. They are always terminal-local, and can
  220. never be buffer-local (@pxref{Buffer-Local Variables}).
  221. On GNU and Unix systems, each X display is a separate graphical
  222. terminal. When Emacs is started from within the X window system, it
  223. uses the X display specified by the @env{DISPLAY} environment
  224. variable, or by the @samp{--display} option (@pxref{Initial Options,,,
  225. emacs, The GNU Emacs Manual}). Emacs can connect to other X displays
  226. via the command @code{make-frame-on-display}. Each X display has its
  227. own selected frame and its own minibuffer windows; however, only one
  228. of those frames is ``@emph{the} selected frame'' at any given moment
  229. (@pxref{Input Focus}). Emacs can even connect to other text
  230. terminals, by interacting with the @command{emacsclient} program.
  231. @xref{Emacs Server,,, emacs, The GNU Emacs Manual}.
  232. @cindex X display names
  233. @cindex display name on X
  234. A single X server can handle more than one display. Each X display
  235. has a three-part name,
  236. @samp{@var{hostname}:@var{displaynumber}.@var{screennumber}}. The
  237. first part, @var{hostname}, specifies the name of the machine to which
  238. the display is physically connected. The second part,
  239. @var{displaynumber}, is a zero-based number that identifies one or
  240. more monitors connected to that machine that share a common keyboard
  241. and pointing device (mouse, tablet, etc.). The third part,
  242. @var{screennumber}, identifies a zero-based screen number (a separate
  243. monitor) that is part of a single monitor collection on that X server.
  244. When you use two or more screens belonging to one server, Emacs knows
  245. by the similarity in their names that they share a single keyboard.
  246. Systems that don't use the X window system, such as MS-Windows,
  247. don't support the notion of X displays, and have only one display on
  248. each host. The display name on these systems doesn't follow the above
  249. 3-part format; for example, the display name on MS-Windows systems is
  250. a constant string @samp{w32}, and exists for compatibility, so that
  251. you could pass it to functions that expect a display name.
  252. @deffn Command make-frame-on-display display &optional parameters
  253. This function creates and returns a new frame on @var{display}, taking
  254. the other frame parameters from the alist @var{parameters}.
  255. @var{display} should be the name of an X display (a string).
  256. Before creating the frame, this function ensures that Emacs is ``set
  257. up'' to display graphics. For instance, if Emacs has not processed X
  258. resources (e.g., if it was started on a text terminal), it does so at
  259. this time. In all other respects, this function behaves like
  260. @code{make-frame} (@pxref{Creating Frames}).
  261. @end deffn
  262. @defun x-display-list
  263. This function returns a list that indicates which X displays Emacs has
  264. a connection to. The elements of the list are strings, and each one
  265. is a display name.
  266. @end defun
  267. @defun x-open-connection display &optional xrm-string must-succeed
  268. This function opens a connection to the X display @var{display},
  269. without creating a frame on that display. Normally, Emacs Lisp
  270. programs need not call this function, as @code{make-frame-on-display}
  271. calls it automatically. The only reason for calling it is to check
  272. whether communication can be established with a given X display.
  273. The optional argument @var{xrm-string}, if not @code{nil}, is a string
  274. of resource names and values, in the same format used in the
  275. @file{.Xresources} file. @xref{X Resources,, X Resources, emacs, The
  276. GNU Emacs Manual}. These values apply to all Emacs frames created on
  277. this display, overriding the resource values recorded in the X server.
  278. Here's an example of what this string might look like:
  279. @example
  280. "*BorderWidth: 3\n*InternalBorder: 2\n"
  281. @end example
  282. If @var{must-succeed} is non-@code{nil}, failure to open the connection
  283. terminates Emacs. Otherwise, it is an ordinary Lisp error.
  284. @end defun
  285. @defun x-close-connection display
  286. This function closes the connection to display @var{display}. Before
  287. you can do this, you must first delete all the frames that were open
  288. on that display (@pxref{Deleting Frames}).
  289. @end defun
  290. @cindex multi-monitor
  291. On some ``multi-monitor'' setups, a single X display outputs to more
  292. than one physical monitor. You can use the functions
  293. @code{display-monitor-attributes-list} and @code{frame-monitor-attributes}
  294. to obtain information about such setups.
  295. @defun display-monitor-attributes-list &optional display
  296. This function returns a list of physical monitor attributes on
  297. @var{display}, which can be a display name (a string), a terminal, or
  298. a frame; if omitted or @code{nil}, it defaults to the selected frame's
  299. display. Each element of the list is an association list,
  300. representing the attributes of a physical monitor. The first element
  301. corresponds to the primary monitor. The attribute keys and values
  302. are:
  303. @table @samp
  304. @item geometry
  305. Position of the top-left corner of the monitor's screen and its size,
  306. in pixels, as @samp{(@var{x} @var{y} @var{width} @var{height})}. Note
  307. that, if the monitor is not the primary monitor, some of the
  308. coordinates might be negative.
  309. @item workarea
  310. Position of the top-left corner and size of the work area (``usable''
  311. space) in pixels as @samp{(@var{x} @var{y} @var{width} @var{height})}.
  312. This may be different from @samp{geometry} in that space occupied by
  313. various window manager features (docks, taskbars, etc.)@: may be
  314. excluded from the work area. Whether or not such features actually
  315. subtract from the work area depends on the platform and environment.
  316. Again, if the monitor is not the primary monitor, some of the
  317. coordinates might be negative.
  318. @item mm-size
  319. Width and height in millimeters as @samp{(@var{width} @var{height})}
  320. @item frames
  321. List of frames that this physical monitor dominates (see below).
  322. @item name
  323. Name of the physical monitor as @var{string}.
  324. @item source
  325. Source of the multi-monitor information as @var{string};
  326. e.g., @samp{XRandr} or @samp{Xinerama}.
  327. @end table
  328. @var{x}, @var{y}, @var{width}, and @var{height} are integers.
  329. @samp{name} and @samp{source} may be absent.
  330. A frame is @dfn{dominated} by a physical monitor when either the
  331. largest area of the frame resides in that monitor, or (if the frame
  332. does not intersect any physical monitors) that monitor is the closest
  333. to the frame. Every (non-tooltip) frame (whether visible or not) in a
  334. graphical display is dominated by exactly one physical monitor at a
  335. time, though the frame can span multiple (or no) physical monitors.
  336. Here's an example of the data produced by this function on a 2-monitor
  337. display:
  338. @lisp
  339. (display-monitor-attributes-list)
  340. @result{}
  341. (((geometry 0 0 1920 1080) ;; @r{Left-hand, primary monitor}
  342. (workarea 0 0 1920 1050) ;; @r{A taskbar occupies some of the height}
  343. (mm-size 677 381)
  344. (name . "DISPLAY1")
  345. (frames #<frame emacs@@host *Messages* 0x11578c0>
  346. #<frame emacs@@host *scratch* 0x114b838>))
  347. ((geometry 1920 0 1680 1050) ;; @r{Right-hand monitor}
  348. (workarea 1920 0 1680 1050) ;; @r{Whole screen can be used}
  349. (mm-size 593 370)
  350. (name . "DISPLAY2")
  351. (frames)))
  352. @end lisp
  353. @end defun
  354. @defun frame-monitor-attributes &optional frame
  355. This function returns the attributes of the physical monitor
  356. dominating (see above) @var{frame}, which defaults to the selected frame.
  357. @end defun
  358. @node Frame Parameters
  359. @section Frame Parameters
  360. @cindex frame parameters
  361. A frame has many parameters that control its appearance and behavior.
  362. Just what parameters a frame has depends on what display mechanism it
  363. uses.
  364. Frame parameters exist mostly for the sake of graphical displays.
  365. Most frame parameters have no effect when applied to a frame on a text
  366. terminal; only the @code{height}, @code{width}, @code{name},
  367. @code{title}, @code{menu-bar-lines}, @code{buffer-list} and
  368. @code{buffer-predicate} parameters do something special. If the
  369. terminal supports colors, the parameters @code{foreground-color},
  370. @code{background-color}, @code{background-mode} and
  371. @code{display-type} are also meaningful. If the terminal supports
  372. frame transparency, the parameter @code{alpha} is also meaningful.
  373. @menu
  374. * Parameter Access:: How to change a frame's parameters.
  375. * Initial Parameters:: Specifying frame parameters when you make a frame.
  376. * Window Frame Parameters:: List of frame parameters for window systems.
  377. * Size and Position:: Changing the size and position of a frame.
  378. * Geometry:: Parsing geometry specifications.
  379. @end menu
  380. @node Parameter Access
  381. @subsection Access to Frame Parameters
  382. These functions let you read and change the parameter values of a
  383. frame.
  384. @defun frame-parameter frame parameter
  385. This function returns the value of the parameter @var{parameter} (a
  386. symbol) of @var{frame}. If @var{frame} is @code{nil}, it returns the
  387. selected frame's parameter. If @var{frame} has no setting for
  388. @var{parameter}, this function returns @code{nil}.
  389. @end defun
  390. @defun frame-parameters &optional frame
  391. The function @code{frame-parameters} returns an alist listing all the
  392. parameters of @var{frame} and their values. If @var{frame} is
  393. @code{nil} or omitted, this returns the selected frame's parameters
  394. @end defun
  395. @defun modify-frame-parameters frame alist
  396. This function alters the parameters of frame @var{frame} based on the
  397. elements of @var{alist}. Each element of @var{alist} has the form
  398. @code{(@var{parm} . @var{value})}, where @var{parm} is a symbol naming a
  399. parameter. If you don't mention a parameter in @var{alist}, its value
  400. doesn't change. If @var{frame} is @code{nil}, it defaults to the selected
  401. frame.
  402. @end defun
  403. @defun set-frame-parameter frame parm value
  404. This function sets the frame parameter @var{parm} to the specified
  405. @var{value}. If @var{frame} is @code{nil}, it defaults to the
  406. selected frame.
  407. @end defun
  408. @defun modify-all-frames-parameters alist
  409. This function alters the frame parameters of all existing frames
  410. according to @var{alist}, then modifies @code{default-frame-alist}
  411. (and, if necessary, @code{initial-frame-alist}) to apply the same
  412. parameter values to frames that will be created henceforth.
  413. @end defun
  414. @node Initial Parameters
  415. @subsection Initial Frame Parameters
  416. @cindex parameters of initial frame
  417. You can specify the parameters for the initial startup frame by
  418. setting @code{initial-frame-alist} in your init file (@pxref{Init
  419. File}).
  420. @defopt initial-frame-alist
  421. This variable's value is an alist of parameter values used when
  422. creating the initial frame. You can set this variable to specify the
  423. appearance of the initial frame without altering subsequent frames.
  424. Each element has the form:
  425. @example
  426. (@var{parameter} . @var{value})
  427. @end example
  428. Emacs creates the initial frame before it reads your init
  429. file. After reading that file, Emacs checks @code{initial-frame-alist},
  430. and applies the parameter settings in the altered value to the already
  431. created initial frame.
  432. If these settings affect the frame geometry and appearance, you'll see
  433. the frame appear with the wrong ones and then change to the specified
  434. ones. If that bothers you, you can specify the same geometry and
  435. appearance with X resources; those do take effect before the frame is
  436. created. @xref{X Resources,, X Resources, emacs, The GNU Emacs Manual}.
  437. X resource settings typically apply to all frames. If you want to
  438. specify some X resources solely for the sake of the initial frame, and
  439. you don't want them to apply to subsequent frames, here's how to achieve
  440. this. Specify parameters in @code{default-frame-alist} to override the
  441. X resources for subsequent frames; then, to prevent these from affecting
  442. the initial frame, specify the same parameters in
  443. @code{initial-frame-alist} with values that match the X resources.
  444. @end defopt
  445. @cindex minibuffer-only frame
  446. If these parameters include @code{(minibuffer . nil)}, that indicates
  447. that the initial frame should have no minibuffer. In this case, Emacs
  448. creates a separate @dfn{minibuffer-only frame} as well.
  449. @defopt minibuffer-frame-alist
  450. This variable's value is an alist of parameter values used when
  451. creating an initial minibuffer-only frame (i.e., the minibuffer-only
  452. frame that Emacs creates if @code{initial-frame-alist} specifies a
  453. frame with no minibuffer).
  454. @end defopt
  455. @defopt default-frame-alist
  456. This is an alist specifying default values of frame parameters for all
  457. Emacs frames---the first frame, and subsequent frames. When using the X
  458. Window System, you can get the same results by means of X resources
  459. in many cases.
  460. Setting this variable does not affect existing frames. Furthermore,
  461. functions that display a buffer in a separate frame may override the
  462. default parameters by supplying their own parameters.
  463. @end defopt
  464. If you invoke Emacs with command-line options that specify frame
  465. appearance, those options take effect by adding elements to either
  466. @code{initial-frame-alist} or @code{default-frame-alist}. Options
  467. which affect just the initial frame, such as @samp{--geometry} and
  468. @samp{--maximized}, add to @code{initial-frame-alist}; the others add
  469. to @code{default-frame-alist}. @pxref{Emacs Invocation,, Command Line
  470. Arguments for Emacs Invocation, emacs, The GNU Emacs Manual}.
  471. @node Window Frame Parameters
  472. @subsection Window Frame Parameters
  473. @cindex frame parameters for windowed displays
  474. Just what parameters a frame has depends on what display mechanism
  475. it uses. This section describes the parameters that have special
  476. meanings on some or all kinds of terminals. Of these, @code{name},
  477. @code{title}, @code{height}, @code{width}, @code{buffer-list} and
  478. @code{buffer-predicate} provide meaningful information in terminal
  479. frames, and @code{tty-color-mode} is meaningful only for frames on
  480. text terminals.
  481. @menu
  482. * Basic Parameters:: Parameters that are fundamental.
  483. * Position Parameters:: The position of the frame on the screen.
  484. * Size Parameters:: Frame's size.
  485. * Layout Parameters:: Size of parts of the frame, and
  486. enabling or disabling some parts.
  487. * Buffer Parameters:: Which buffers have been or should be shown.
  488. * Management Parameters:: Communicating with the window manager.
  489. * Cursor Parameters:: Controlling the cursor appearance.
  490. * Font and Color Parameters:: Fonts and colors for the frame text.
  491. @end menu
  492. @node Basic Parameters
  493. @subsubsection Basic Parameters
  494. These frame parameters give the most basic information about the
  495. frame. @code{title} and @code{name} are meaningful on all terminals.
  496. @table @code
  497. @vindex display, a frame parameter
  498. @item display
  499. The display on which to open this frame. It should be a string of the
  500. form @samp{@var{host}:@var{dpy}.@var{screen}}, just like the
  501. @env{DISPLAY} environment variable. @xref{Multiple Terminals}, for
  502. more details about display names.
  503. @vindex display-type, a frame parameter
  504. @item display-type
  505. This parameter describes the range of possible colors that can be used
  506. in this frame. Its value is @code{color}, @code{grayscale} or
  507. @code{mono}.
  508. @vindex title, a frame parameter
  509. @item title
  510. If a frame has a non-@code{nil} title, it appears in the window
  511. system's title bar at the top of the frame, and also in the mode line
  512. of windows in that frame if @code{mode-line-frame-identification} uses
  513. @samp{%F} (@pxref{%-Constructs}). This is normally the case when
  514. Emacs is not using a window system, and can only display one frame at
  515. a time. @xref{Frame Titles}.
  516. @vindex name, a frame parameter
  517. @item name
  518. The name of the frame. The frame name serves as a default for the frame
  519. title, if the @code{title} parameter is unspecified or @code{nil}. If
  520. you don't specify a name, Emacs sets the frame name automatically
  521. (@pxref{Frame Titles}).
  522. If you specify the frame name explicitly when you create the frame, the
  523. name is also used (instead of the name of the Emacs executable) when
  524. looking up X resources for the frame.
  525. @item explicit-name
  526. If the frame name was specified explicitly when the frame was created,
  527. this parameter will be that name. If the frame wasn't explicitly
  528. named, this parameter will be @code{nil}.
  529. @end table
  530. @node Position Parameters
  531. @subsubsection Position Parameters
  532. @cindex window position on display
  533. @cindex frame position
  534. Position parameters' values are normally measured in pixels, but on
  535. text terminals they count characters or lines instead.
  536. @table @code
  537. @vindex left, a frame parameter
  538. @item left
  539. The position, in pixels, of the left (or right) edge of the frame with
  540. respect to the left (or right) edge of the screen. The value may be:
  541. @table @asis
  542. @item an integer
  543. A positive integer relates the left edge of the frame to the left edge
  544. of the screen. A negative integer relates the right frame edge to the
  545. right screen edge.
  546. @item @code{(+ @var{pos})}
  547. This specifies the position of the left frame edge relative to the left
  548. screen edge. The integer @var{pos} may be positive or negative; a
  549. negative value specifies a position outside the screen or on a monitor
  550. other than the primary one (for multi-monitor displays).
  551. @item @code{(- @var{pos})}
  552. This specifies the position of the right frame edge relative to the right
  553. screen edge. The integer @var{pos} may be positive or negative; a
  554. negative value specifies a position outside the screen or on a monitor
  555. other than the primary one (for multi-monitor displays).
  556. @end table
  557. Some window managers ignore program-specified positions. If you want to
  558. be sure the position you specify is not ignored, specify a
  559. non-@code{nil} value for the @code{user-position} parameter as well.
  560. @vindex top, a frame parameter
  561. @item top
  562. The screen position of the top (or bottom) edge, in pixels, with respect
  563. to the top (or bottom) edge of the screen. It works just like
  564. @code{left}, except vertically instead of horizontally.
  565. @vindex icon-left, a frame parameter
  566. @item icon-left
  567. The screen position of the left edge of the frame's icon, in pixels,
  568. counting from the left edge of the screen. This takes effect when the
  569. frame is iconified, if the window manager supports this feature. If
  570. you specify a value for this parameter, then you must also specify a
  571. value for @code{icon-top} and vice versa.
  572. @vindex icon-top, a frame parameter
  573. @item icon-top
  574. The screen position of the top edge of the frame's icon, in pixels,
  575. counting from the top edge of the screen. This takes effect when the
  576. frame is iconified, if the window manager supports this feature.
  577. @vindex user-position, a frame parameter
  578. @item user-position
  579. When you create a frame and specify its screen position with the
  580. @code{left} and @code{top} parameters, use this parameter to say whether
  581. the specified position was user-specified (explicitly requested in some
  582. way by a human user) or merely program-specified (chosen by a program).
  583. A non-@code{nil} value says the position was user-specified.
  584. @cindex window positions and window managers
  585. Window managers generally heed user-specified positions, and some heed
  586. program-specified positions too. But many ignore program-specified
  587. positions, placing the window in a default fashion or letting the user
  588. place it with the mouse. Some window managers, including @code{twm},
  589. let the user specify whether to obey program-specified positions or
  590. ignore them.
  591. When you call @code{make-frame}, you should specify a non-@code{nil}
  592. value for this parameter if the values of the @code{left} and @code{top}
  593. parameters represent the user's stated preference; otherwise, use
  594. @code{nil}.
  595. @end table
  596. @node Size Parameters
  597. @subsubsection Size Parameters
  598. @cindex window size on display
  599. Frame parameters specify frame sizes in character units. On
  600. graphical displays, the @code{default} face determines the actual
  601. pixel sizes of these character units (@pxref{Face Attributes}).
  602. @table @code
  603. @vindex height, a frame parameter
  604. @item height
  605. The height of the frame's text area (@pxref{Size and Position}), in
  606. characters.
  607. @vindex width, a frame parameter
  608. @item width
  609. The width of the frame's text area (@pxref{Size and Position}), in
  610. characters.
  611. @vindex user-size, a frame parameter
  612. @item user-size
  613. This does for the size parameters @code{height} and @code{width} what
  614. the @code{user-position} parameter (@pxref{Position Parameters,
  615. user-position}) does for the position parameters @code{top} and
  616. @code{left}.
  617. @cindex full-screen frames
  618. @vindex fullscreen, a frame parameter
  619. @item fullscreen
  620. Specify that width, height or both shall be maximized. The value
  621. @code{fullwidth} specifies that width shall be as wide as possible. The
  622. value @code{fullheight} specifies that height shall be as tall as
  623. possible. The value @code{fullboth} specifies that both the width and
  624. the height shall be set to the size of the screen. The value
  625. @code{maximized} specifies that the frame shall be maximized.
  626. The difference between @code{maximized} and @code{fullboth} is that a
  627. maximized frame usually keeps its title bar and the buttons for resizing
  628. and closing the frame. Also, maximized frames typically avoid hiding
  629. any task bar or panels displayed on the desktop. ``Fullboth'' frames,
  630. on the other hand, usually omit the title bar and occupy the entire
  631. available screen space.
  632. ``Fullheight'' and ``fullwidth'' frames are more similar to maximized
  633. frames in this regard. However, these typically display an external
  634. border which might be absent with maximized frames. Hence the heights
  635. of maximized and fullheight frames and the widths of maximized and
  636. fullwidth frames often differ by a few pixels.
  637. With some window managers you may have to customize the variable
  638. @code{frame-resize-pixelwise} (@pxref{Size and Position}) in order to
  639. make a frame truly appear ``maximized'' or ``fullscreen''. Moreover,
  640. some window managers might not support smooth transition between the
  641. various fullscreen or maximization states. Customizing the variable
  642. @code{x-frame-normalize-before-maximize} can help to overcome that.
  643. @vindex fullscreen-restore, a frame parameter
  644. @item fullscreen-restore
  645. This parameter specifies the desired ``fullscreen'' state of the frame
  646. after invoking the @code{toggle-frame-fullscreen} command (@pxref{Frame
  647. Commands,,, emacs, The GNU Emacs Manual}) in the ``fullboth'' state.
  648. Normally this parameter is installed automatically by that command when
  649. toggling the state to fullboth. If, however, you start Emacs in the
  650. fullboth state, you have to specify the desired behavior in your initial
  651. file as, for example
  652. @example
  653. (setq default-frame-alist
  654. '((fullscreen . fullboth) (fullscreen-restore . fullheight)))
  655. @end example
  656. This will give a new frame full height after typing in it @key{F11} for
  657. the first time.
  658. @end table
  659. @node Layout Parameters
  660. @subsubsection Layout Parameters
  661. @cindex layout parameters of frames
  662. @cindex frame layout parameters
  663. These frame parameters enable or disable various parts of the
  664. frame, or control their sizes.
  665. @table @code
  666. @vindex border-width, a frame parameter
  667. @item border-width
  668. The width in pixels of the frame's border.
  669. @vindex internal-border-width, a frame parameter
  670. @item internal-border-width
  671. The distance in pixels between text (or fringe) and the frame's border.
  672. @vindex vertical-scroll-bars, a frame parameter
  673. @item vertical-scroll-bars
  674. Whether the frame has scroll bars for vertical scrolling, and which side
  675. of the frame they should be on. The possible values are @code{left},
  676. @code{right}, and @code{nil} for no scroll bars.
  677. @vindex horizontal-scroll-bars, a frame parameter
  678. @item horizontal-scroll-bars
  679. Whether the frame has scroll bars for horizontal scrolling (@code{t} and
  680. @code{bottom} mean yes, @code{nil} means no).
  681. @vindex scroll-bar-width, a frame parameter
  682. @item scroll-bar-width
  683. The width of vertical scroll bars, in pixels, or @code{nil} meaning to
  684. use the default width.
  685. @vindex scroll-bar-height, a frame parameter
  686. @item scroll-bar-height
  687. The height of horizontal scroll bars, in pixels, or @code{nil} meaning
  688. to use the default height.
  689. @vindex left-fringe, a frame parameter
  690. @vindex right-fringe, a frame parameter
  691. @item left-fringe
  692. @itemx right-fringe
  693. The default width of the left and right fringes of windows in this
  694. frame (@pxref{Fringes}). If either of these is zero, that effectively
  695. removes the corresponding fringe.
  696. When you use @code{frame-parameter} to query the value of either of
  697. these two frame parameters, the return value is always an integer.
  698. When using @code{set-frame-parameter}, passing a @code{nil} value
  699. imposes an actual default value of 8 pixels.
  700. @vindex right-divider-width, a frame parameter
  701. @item right-divider-width
  702. The width (thickness) reserved for the right divider (@pxref{Window
  703. Dividers}) of any window on the frame, in pixels. A value of zero means
  704. to not draw right dividers.
  705. @vindex bottom-divider-width, a frame parameter
  706. @item bottom-divider-width
  707. The width (thickness) reserved for the bottom divider (@pxref{Window
  708. Dividers}) of any window on the frame, in pixels. A value of zero means
  709. to not draw bottom dividers.
  710. @vindex menu-bar-lines frame parameter
  711. @item menu-bar-lines
  712. The number of lines to allocate at the top of the frame for a menu
  713. bar. The default is 1 if Menu Bar mode is enabled, and 0 otherwise.
  714. @xref{Menu Bars,,,emacs, The GNU Emacs Manual}.
  715. @vindex tool-bar-lines frame parameter
  716. @item tool-bar-lines
  717. The number of lines to use for the tool bar. The default is 1 if Tool
  718. Bar mode is enabled, and 0 otherwise. @xref{Tool Bars,,,emacs, The
  719. GNU Emacs Manual}.
  720. @vindex tool-bar-position frame parameter
  721. @item tool-bar-position
  722. The position of the tool bar. Currently only for the GTK tool bar.
  723. Value can be one of @code{top}, @code{bottom} @code{left}, @code{right}.
  724. The default is @code{top}.
  725. @vindex line-spacing, a frame parameter
  726. @item line-spacing
  727. Additional space to leave below each text line, in pixels (a positive
  728. integer). @xref{Line Height}, for more information.
  729. @end table
  730. @node Buffer Parameters
  731. @subsubsection Buffer Parameters
  732. @cindex frame, which buffers to display
  733. @cindex buffers to display on frame
  734. These frame parameters, meaningful on all kinds of terminals, deal
  735. with which buffers have been, or should, be displayed in the frame.
  736. @table @code
  737. @vindex minibuffer, a frame parameter
  738. @item minibuffer
  739. Whether this frame has its own minibuffer. The value @code{t} means
  740. yes, @code{nil} means no, @code{only} means this frame is just a
  741. minibuffer. If the value is a minibuffer window (in some other
  742. frame), the frame uses that minibuffer.
  743. This frame parameter takes effect when the frame is created, and can
  744. not be changed afterwards.
  745. @vindex buffer-predicate, a frame parameter
  746. @item buffer-predicate
  747. The buffer-predicate function for this frame. The function
  748. @code{other-buffer} uses this predicate (from the selected frame) to
  749. decide which buffers it should consider, if the predicate is not
  750. @code{nil}. It calls the predicate with one argument, a buffer, once for
  751. each buffer; if the predicate returns a non-@code{nil} value, it
  752. considers that buffer.
  753. @vindex buffer-list, a frame parameter
  754. @item buffer-list
  755. A list of buffers that have been selected in this frame, ordered
  756. most-recently-selected first.
  757. @vindex unsplittable, a frame parameter
  758. @item unsplittable
  759. If non-@code{nil}, this frame's window is never split automatically.
  760. @end table
  761. @node Management Parameters
  762. @subsubsection Window Management Parameters
  763. @cindex window manager interaction, and frame parameters
  764. The following frame parameters control various aspects of the
  765. frame's interaction with the window manager. They have no effect on
  766. text terminals.
  767. @table @code
  768. @vindex visibility, a frame parameter
  769. @item visibility
  770. The state of visibility of the frame. There are three possibilities:
  771. @code{nil} for invisible, @code{t} for visible, and @code{icon} for
  772. iconified. @xref{Visibility of Frames}.
  773. @vindex auto-raise, a frame parameter
  774. @item auto-raise
  775. If non-@code{nil}, Emacs automatically raises the frame when it is
  776. selected. Some window managers do not allow this.
  777. @vindex auto-lower, a frame parameter
  778. @item auto-lower
  779. If non-@code{nil}, Emacs automatically lowers the frame when it is
  780. deselected. Some window managers do not allow this.
  781. @vindex icon-type, a frame parameter
  782. @item icon-type
  783. The type of icon to use for this frame. If the value is a string,
  784. that specifies a file containing a bitmap to use; @code{nil} specifies
  785. no icon (in which case the window manager decides what to show); any
  786. other non-@code{nil} value specifies the default Emacs icon.
  787. @vindex icon-name, a frame parameter
  788. @item icon-name
  789. The name to use in the icon for this frame, when and if the icon
  790. appears. If this is @code{nil}, the frame's title is used.
  791. @vindex window-id, a frame parameter
  792. @item window-id
  793. The ID number which the graphical display uses for this frame. Emacs
  794. assigns this parameter when the frame is created; changing the
  795. parameter has no effect on the actual ID number.
  796. @vindex outer-window-id, a frame parameter
  797. @item outer-window-id
  798. The ID number of the outermost window-system window in which the frame
  799. exists. As with @code{window-id}, changing this parameter has no
  800. actual effect.
  801. @vindex wait-for-wm, a frame parameter
  802. @item wait-for-wm
  803. If non-@code{nil}, tell Xt to wait for the window manager to confirm
  804. geometry changes. Some window managers, including versions of Fvwm2
  805. and KDE, fail to confirm, so Xt hangs. Set this to @code{nil} to
  806. prevent hanging with those window managers.
  807. @vindex sticky, a frame parameter
  808. @item sticky
  809. If non-@code{nil}, the frame is visible on all virtual desktops on systems
  810. with virtual desktops.
  811. @ignore
  812. @vindex parent-id, a frame parameter
  813. @item parent-id
  814. @c ??? Not yet working.
  815. The X window number of the window that should be the parent of this one.
  816. Specifying this lets you create an Emacs window inside some other
  817. application's window. (It is not certain this will be implemented; try
  818. it and see if it works.)
  819. @end ignore
  820. @end table
  821. @node Cursor Parameters
  822. @subsubsection Cursor Parameters
  823. @cindex cursor, and frame parameters
  824. This frame parameter controls the way the cursor looks.
  825. @table @code
  826. @vindex cursor-type, a frame parameter
  827. @item cursor-type
  828. How to display the cursor. Legitimate values are:
  829. @table @code
  830. @item box
  831. Display a filled box. (This is the default.)
  832. @item hollow
  833. Display a hollow box.
  834. @item nil
  835. Don't display a cursor.
  836. @item bar
  837. Display a vertical bar between characters.
  838. @item (bar . @var{width})
  839. Display a vertical bar @var{width} pixels wide between characters.
  840. @item hbar
  841. Display a horizontal bar.
  842. @item (hbar . @var{height})
  843. Display a horizontal bar @var{height} pixels high.
  844. @end table
  845. @end table
  846. @vindex cursor-type
  847. The @code{cursor-type} frame parameter may be overridden by the
  848. variables @code{cursor-type} and
  849. @code{cursor-in-non-selected-windows}:
  850. @defvar cursor-type
  851. This buffer-local variable controls how the cursor looks in a selected
  852. window showing the buffer. If its value is @code{t}, that means to
  853. use the cursor specified by the @code{cursor-type} frame parameter.
  854. Otherwise, the value should be one of the cursor types listed above,
  855. and it overrides the @code{cursor-type} frame parameter.
  856. @end defvar
  857. @defopt cursor-in-non-selected-windows
  858. This buffer-local variable controls how the cursor looks in a window
  859. that is not selected. It supports the same values as the
  860. @code{cursor-type} frame parameter; also, @code{nil} means don't
  861. display a cursor in nonselected windows, and @code{t} (the default)
  862. means use a standard modification of the usual cursor type (solid box
  863. becomes hollow box, and bar becomes a narrower bar).
  864. @end defopt
  865. @defopt blink-cursor-alist
  866. This variable specifies how to blink the cursor. Each element has the
  867. form @code{(@var{on-state} . @var{off-state})}. Whenever the cursor
  868. type equals @var{on-state} (comparing using @code{equal}), the
  869. corresponding @var{off-state} specifies what the cursor looks like
  870. when it blinks ``off''. Both @var{on-state} and @var{off-state}
  871. should be suitable values for the @code{cursor-type} frame parameter.
  872. There are various defaults for how to blink each type of cursor, if
  873. the type is not mentioned as an @var{on-state} here. Changes in this
  874. variable do not take effect immediately, only when you specify the
  875. @code{cursor-type} frame parameter.
  876. @end defopt
  877. @node Font and Color Parameters
  878. @subsubsection Font and Color Parameters
  879. @cindex font and color, frame parameters
  880. These frame parameters control the use of fonts and colors.
  881. @table @code
  882. @vindex font-backend, a frame parameter
  883. @item font-backend
  884. A list of symbols, specifying the @dfn{font backends} to use for
  885. drawing fonts in the frame, in order of priority. On X, there are
  886. currently two available font backends: @code{x} (the X core font
  887. driver) and @code{xft} (the Xft font driver). On MS-Windows, there are
  888. currently two available font backends: @code{gdi} and
  889. @code{uniscribe} (@pxref{Windows Fonts,,, emacs, The GNU Emacs
  890. Manual}). On other systems, there is only one available font backend,
  891. so it does not make sense to modify this frame parameter.
  892. @vindex background-mode, a frame parameter
  893. @item background-mode
  894. This parameter is either @code{dark} or @code{light}, according
  895. to whether the background color is a light one or a dark one.
  896. @vindex tty-color-mode, a frame parameter
  897. @item tty-color-mode
  898. @cindex standard colors for character terminals
  899. This parameter overrides the terminal's color support as given by the
  900. system's terminal capabilities database in that this parameter's value
  901. specifies the color mode to use on a text terminal. The value can be
  902. either a symbol or a number. A number specifies the number of colors
  903. to use (and, indirectly, what commands to issue to produce each
  904. color). For example, @code{(tty-color-mode . 8)} specifies use of the
  905. ANSI escape sequences for 8 standard text colors. A value of -1 turns
  906. off color support.
  907. If the parameter's value is a symbol, it specifies a number through
  908. the value of @code{tty-color-mode-alist}, and the associated number is
  909. used instead.
  910. @vindex screen-gamma, a frame parameter
  911. @item screen-gamma
  912. @cindex gamma correction
  913. If this is a number, Emacs performs ``gamma correction'' which adjusts
  914. the brightness of all colors. The value should be the screen gamma of
  915. your display.
  916. Usual PC monitors have a screen gamma of 2.2, so color values in
  917. Emacs, and in X windows generally, are calibrated to display properly
  918. on a monitor with that gamma value. If you specify 2.2 for
  919. @code{screen-gamma}, that means no correction is needed. Other values
  920. request correction, designed to make the corrected colors appear on
  921. your screen the way they would have appeared without correction on an
  922. ordinary monitor with a gamma value of 2.2.
  923. If your monitor displays colors too light, you should specify a
  924. @code{screen-gamma} value smaller than 2.2. This requests correction
  925. that makes colors darker. A screen gamma value of 1.5 may give good
  926. results for LCD color displays.
  927. @vindex alpha, a frame parameter
  928. @item alpha
  929. @cindex opacity, frame
  930. @cindex transparency, frame
  931. @vindex frame-alpha-lower-limit
  932. This parameter specifies the opacity of the frame, on graphical
  933. displays that support variable opacity. It should be an integer
  934. between 0 and 100, where 0 means completely transparent and 100 means
  935. completely opaque. It can also have a @code{nil} value, which tells
  936. Emacs not to set the frame opacity (leaving it to the window manager).
  937. To prevent the frame from disappearing completely from view, the
  938. variable @code{frame-alpha-lower-limit} defines a lower opacity limit.
  939. If the value of the frame parameter is less than the value of this
  940. variable, Emacs uses the latter. By default,
  941. @code{frame-alpha-lower-limit} is 20.
  942. The @code{alpha} frame parameter can also be a cons cell
  943. @code{(@samp{active} . @samp{inactive})}, where @samp{active} is the
  944. opacity of the frame when it is selected, and @samp{inactive} is the
  945. opacity when it is not selected.
  946. @end table
  947. The following frame parameters are semi-obsolete in that they are
  948. automatically equivalent to particular face attributes of particular
  949. faces (@pxref{Standard Faces,,, emacs, The Emacs Manual}):
  950. @table @code
  951. @vindex font, a frame parameter
  952. @item font
  953. The name of the font for displaying text in the frame. This is a
  954. string, either a valid font name for your system or the name of an Emacs
  955. fontset (@pxref{Fontsets}). It is equivalent to the @code{font}
  956. attribute of the @code{default} face.
  957. @vindex foreground-color, a frame parameter
  958. @item foreground-color
  959. The color to use for the image of a character. It is equivalent to
  960. the @code{:foreground} attribute of the @code{default} face.
  961. @vindex background-color, a frame parameter
  962. @item background-color
  963. The color to use for the background of characters. It is equivalent to
  964. the @code{:background} attribute of the @code{default} face.
  965. @vindex mouse-color, a frame parameter
  966. @item mouse-color
  967. The color for the mouse pointer. It is equivalent to the @code{:background}
  968. attribute of the @code{mouse} face.
  969. @vindex cursor-color, a frame parameter
  970. @item cursor-color
  971. The color for the cursor that shows point. It is equivalent to the
  972. @code{:background} attribute of the @code{cursor} face.
  973. @vindex border-color, a frame parameter
  974. @item border-color
  975. The color for the border of the frame. It is equivalent to the
  976. @code{:background} attribute of the @code{border} face.
  977. @vindex scroll-bar-foreground, a frame parameter
  978. @item scroll-bar-foreground
  979. If non-@code{nil}, the color for the foreground of scroll bars. It is
  980. equivalent to the @code{:foreground} attribute of the
  981. @code{scroll-bar} face.
  982. @vindex scroll-bar-background, a frame parameter
  983. @item scroll-bar-background
  984. If non-@code{nil}, the color for the background of scroll bars. It is
  985. equivalent to the @code{:background} attribute of the
  986. @code{scroll-bar} face.
  987. @end table
  988. @node Size and Position
  989. @subsection Frame Size and Position
  990. @cindex size of frame
  991. @cindex screen size
  992. @cindex frame size
  993. @cindex resize frame
  994. You can read or change the size and position of a frame using the frame
  995. parameters @code{left}, @code{top}, @code{height}, and @code{width}.
  996. Whatever geometry parameters you don't specify are chosen by the window
  997. manager in its usual fashion.
  998. Here are some special features for working with sizes and positions.
  999. Most of the functions described below use a @var{frame} argument which
  1000. has to specify a live frame. If omitted or @code{nil}, it specifies the
  1001. selected frame, see @ref{Input Focus}.
  1002. @defun set-frame-position frame left top
  1003. This function sets the position of the top left corner of @var{frame} to
  1004. @var{left} and @var{top}. These arguments are measured in pixels, and
  1005. normally count from the top left corner of the screen to the top left
  1006. corner of the rectangle allotted to the frame by the window manager.
  1007. Negative parameter values position the bottom edge of that rectangle up
  1008. from the bottom edge of the screen, or the right rectangle edge to the
  1009. left of the right edge of the screen. It would probably be better if
  1010. the values were always counted from the left and top, so that negative
  1011. arguments would position the frame partly off the top or left edge of
  1012. the screen, but it seems inadvisable to change that now.
  1013. @end defun
  1014. @cindex frame default font
  1015. @cindex default font of a frame
  1016. Each frame has a @dfn{default font} which specifies the canonical height
  1017. and width of a character on that frame. The default font is used when
  1018. retrieving or changing the size of a frame in terms of columns or lines.
  1019. It is also used when resizing (@pxref{Window Sizes}) or splitting
  1020. (@pxref{Splitting Windows}) windows.
  1021. @defun frame-char-height &optional frame
  1022. @defunx frame-char-width &optional frame
  1023. These functions return the canonical height and width of a character in
  1024. @var{frame}, measured in pixels. Together, these values establish the
  1025. size of the default font on @var{frame}. The values depend on the
  1026. choice of font for @var{frame}, see @ref{Font and Color Parameters}.
  1027. @end defun
  1028. The default font can be also set directly with the following function:
  1029. @deffn Command set-frame-font font &optional keep-size frames
  1030. This sets the default font to @var{font}. When called interactively, it
  1031. prompts for the name of a font, and uses that font on the selected
  1032. frame. When called from Lisp, @var{font} should be a font name (a
  1033. string), a font object, font entity, or a font spec.
  1034. If the optional argument @var{keep-size} is @code{nil}, this keeps the
  1035. number of frame lines and columns fixed. (If non-@code{nil}, the option
  1036. @code{frame-inhibit-implied-resize} described below will override this.)
  1037. If @var{keep-size} is non-@code{nil} (or with a prefix argument), it
  1038. tries to keep the size of the display area of the current frame fixed by
  1039. adjusting the number of lines and columns.
  1040. If the optional argument @var{frames} is @code{nil}, this applies the
  1041. font to the selected frame only. If @var{frames} is non-@code{nil}, it
  1042. should be a list of frames to act upon, or @code{t} meaning all existing
  1043. graphical frames.
  1044. @end deffn
  1045. @cindex frame display area
  1046. @cindex display area of a frame
  1047. The @dfn{display area} of a frame is a rectangular area within the area
  1048. allotted to the frame by the window manager. The display area neither
  1049. includes the title bar (@pxref{Frame Titles}) nor any other decorations
  1050. provided by the window manager (like an external border used for
  1051. resizing frames via mouse dragging).
  1052. The actual height of the display area depends on the window-system
  1053. and toolkit in use. With GTK+, the display area does not include any
  1054. tool bar or menu bar. With the Motif or Lucid toolkits and with
  1055. Windows, the display area includes the tool bar but not the menu bar.
  1056. In a graphical version with no toolkit, it includes both the tool bar
  1057. and menu bar. On a text terminal, the display area includes the menu
  1058. bar.
  1059. @defun frame-pixel-height &optional frame
  1060. @defunx frame-pixel-width &optional frame
  1061. These functions return the height and width of the display area of
  1062. @var{frame}, measured in pixels. For a text terminal, the results are
  1063. in characters rather than pixels.
  1064. @end defun
  1065. @cindex frame text area
  1066. @cindex text area of a frame
  1067. The @dfn{text area} of a frame is a concept implicitly used by all
  1068. functions that change a frame's height or width. It is a rectangle
  1069. located within the display area. Its size is obtained from that of the
  1070. display area by subtracting the sizes of any tool or menu bars that are
  1071. part of the display area, any internal borders, one vertical and one
  1072. horizontal scroll bar, and one left and one right fringe as specified
  1073. for this frame, see @ref{Layout Parameters}.
  1074. @defun frame-text-height &optional frame
  1075. @defunx frame-text-width &optional frame
  1076. These functions return the height and width of the text area of
  1077. @var{frame}, measured in pixels. For a text terminal, the results are
  1078. in characters rather than pixels.
  1079. The value returned by @code{frame-text-height} differs from that
  1080. returned by @code{frame-pixel-height} by not including the heights of
  1081. any tool bar or menu bar, the height of one horizontal scroll bar and
  1082. the widths of the internal border.
  1083. The value returned by @code{frame-text-width} differs from that returned
  1084. by @code{frame-pixel-width} by not including the width of one vertical
  1085. scroll bar, the widths of one left and one right fringe and the widths
  1086. of the internal border.
  1087. @end defun
  1088. @defun frame-height &optional frame
  1089. @defunx frame-width &optional frame
  1090. These functions return the height and width of the text area of
  1091. @var{frame}, measured in units of the default font height and width of
  1092. @var{frame}. These functions are plain shorthands for writing
  1093. @code{(frame-parameter frame 'height)} and @code{(frame-parameter frame
  1094. 'width)}.
  1095. If the text area of @var{frame} measured in pixles is not a multiple of
  1096. its default font size, the values returned by this functions are rounded
  1097. down to the number of characters of the default font that fully fit into
  1098. the text area.
  1099. @end defun
  1100. @defopt frame-resize-pixelwise
  1101. If this option is @code{nil}, a frame's size is usually rounded to a
  1102. multiple of the current values of that frame's @code{frame-char-height}
  1103. and @code{frame-char-width}. If this is non-@code{nil}, no rounding
  1104. occurs, hence frame sizes can increase/decrease by one pixel.
  1105. Setting this causes the next resize operation to pass the corresponding
  1106. size hints to the window manager. This means that this variable should
  1107. be set only in a user's initial file; applications should never bind it
  1108. temporarily.
  1109. The precise meaning of a value of @code{nil} for this option depends
  1110. on the toolkit used. Dragging the frame border with the mouse is usually
  1111. done character-wise. Calling @code{set-frame-size} (see below)
  1112. with arguments that do not specify the frame size as an integer multiple
  1113. of its character size, however, may: be ignored, cause a
  1114. rounding (GTK+), or be accepted (Lucid, Motif, MS-Windows).
  1115. With some window managers you may have to set this to non-@code{nil} in
  1116. order to make a frame appear truly ``maximized'' or ``fullscreen''.
  1117. @end defopt
  1118. @defun set-frame-size frame width height pixelwise
  1119. This function sets the size of the text area of @var{frame}, measured in
  1120. characters; @var{width} and @var{height} specify the new width in
  1121. columns and the new height in lines.
  1122. The optional argument @var{pixelwise} non-@code{nil} means to measure
  1123. the new width and height in units of pixels instead. Note that if
  1124. @code{frame-resize-pixelwise} is @code{nil}, some toolkits may refuse to
  1125. fully honor the request if it does not increase/decrease the frame size
  1126. to a multiple of its character size.
  1127. @end defun
  1128. @defun set-frame-height frame height &optional pretend pixelwise
  1129. This function resizes the text area of @var{frame} to a height of
  1130. @var{height} lines. The sizes of existing windows in @var{frame} are
  1131. altered proportionally to fit.
  1132. If @var{pretend} is non-@code{nil}, then Emacs displays @var{height}
  1133. lines of output in @var{frame}, but does not change its value for the
  1134. actual height of the frame. This is only useful on text terminals.
  1135. Using a smaller height than the terminal actually implements may be
  1136. useful to reproduce behavior observed on a smaller screen, or if the
  1137. terminal malfunctions when using its whole screen. Setting the frame
  1138. height ``for real'' does not always work, because knowing the correct
  1139. actual size may be necessary for correct cursor positioning on
  1140. text terminals.
  1141. The optional fourth argument @var{pixelwise} non-@code{nil} means that
  1142. @var{frame} should be @var{height} pixels high. Note that if
  1143. @code{frame-resize-pixelwise} is @code{nil}, some toolkits may refuse to
  1144. fully honor the request if it does not increase/decrease the frame
  1145. height to a multiple of its character height.
  1146. @end defun
  1147. @defun set-frame-width frame width &optional pretend pixelwise
  1148. This function sets the width of the text area of @var{frame}, measured
  1149. in characters. The argument @var{pretend} has the same meaning as in
  1150. @code{set-frame-height}.
  1151. The optional fourth argument @var{pixelwise} non-@code{nil} means that
  1152. @var{frame} should be @var{width} pixels wide. Note that if
  1153. @code{frame-resize-pixelwise} is @code{nil}, some toolkits may refuse to
  1154. fully honor the request if it does not increase/decrease the frame width
  1155. to a multiple of its character width.
  1156. @end defun
  1157. None of these three functions will make a frame smaller than needed to
  1158. display all of its windows together with their scroll bars, fringes,
  1159. margins, dividers, mode and header lines. This contrasts with requests
  1160. by the window manager triggered, for example, by dragging the external
  1161. border of a frame with the mouse. Such requests are always honored by
  1162. clipping, if necessary, portions that cannot be displayed at the right,
  1163. bottom corner of the frame.
  1164. By default, Emacs tries to keep the number of lines and columns of a
  1165. frame's text area unaltered when, for example, adding or removing a menu
  1166. bar, changing the default font or setting the width of the frame's
  1167. scroll bars. This means, however, that in such case Emacs must ask the
  1168. window manager to resize the display area of the frame in order to
  1169. accommodate the size change. Note that wrapping a menu or tool bar
  1170. usually does not resize the frame's display area, hence this will alter
  1171. the number of displayed lines.
  1172. Occasionally, such implied resizing of the display area may be
  1173. unwanted, for example, when the frame is maximized or made fullscreen
  1174. where it's turned off by default. In other cases you can disable
  1175. implied resizing with the following option:
  1176. @defopt frame-inhibit-implied-resize
  1177. If this option is @code{nil}, changing font, menu bar, tool bar,
  1178. internal borders, fringes or scroll bars of a specific frame may
  1179. implicitly resize the frame's display area in order to preserve the
  1180. number of columns or lines the frame displays. If this option is
  1181. non-@code{nil}, no implied resizing is done.
  1182. The value of this option can be also be a list of frame parameters. In
  1183. that case, implied resizing is inhibited when changing a parameter that
  1184. appears in this list. The frame parameters currently handled by this
  1185. option are: @code{font}, @code{font-backend},
  1186. @code{internal-border-width}, @code{menu-bar-lines} and
  1187. @code{tool-bar-lines}.
  1188. Changing any of the @code{scroll-bar-width}, @code{scroll-bar-height},
  1189. @code{vertical-scroll-bars}, @code{horizontal-scroll-bars},
  1190. @code{left-fringe} and @code{right-fringe} frame parameters is handled
  1191. as if the frame contained just one live window. This means, for
  1192. example, that removing vertical scroll bars on a frame containing
  1193. several side by side windows will shrink the frame width by the width of
  1194. one scroll bar provided this option is @code{nil} and keep it unchanged
  1195. if this option is either @code{t} or a list containing
  1196. @code{vertical-scroll-bars}.
  1197. The default value is @code{'(tool-bar-lines)} for Lucid, Motif and
  1198. Windows (which means that adding/removing a tool bar there does not
  1199. change the frame height), @code{nil} on all other window systems
  1200. including GTK+ (which means that changing any of the parameters listed
  1201. above may change the size of the frame), and @code{t} otherwise (which
  1202. means the frame size never changes implicitly when there's no window
  1203. system support).
  1204. Note that when a frame is not large enough to accommodate a change of
  1205. any of the parameters listed above, Emacs may try to enlarge the frame
  1206. even if this option is non-@code{nil}.
  1207. @end defopt
  1208. @c FIXME? Belongs more in Emacs manual than here?
  1209. @c But, e.g., fit-window-to-buffer is in this manual.
  1210. If you have a frame that displays only one window, you can fit that
  1211. frame to its buffer using the command @code{fit-frame-to-buffer}.
  1212. @deffn Command fit-frame-to-buffer &optional frame max-height min-height max-width min-width only
  1213. This command adjusts the size of @var{frame} to display the contents of
  1214. its buffer exactly. @var{frame} can be any live frame and defaults to
  1215. the selected one. Fitting is done only if @var{frame}'s root window is
  1216. live. The arguments @var{max-height}, @var{min-height}, @var{max-width}
  1217. and @var{min-width} specify bounds on the new total size of
  1218. @var{frame}'s root window. @var{min-height} and @var{min-width} default
  1219. to the values of @code{window-min-height} and @code{window-min-width}
  1220. respectively.
  1221. If the optional argument @var{only} is @code{vertically}, this function
  1222. may resize the frame vertically only. If @var{only} is
  1223. @code{horizontally}, it may resize the frame horizontally only.
  1224. @end deffn
  1225. The behavior of @code{fit-frame-to-buffer} can be controlled with the
  1226. help of the two options listed next.
  1227. @defopt fit-frame-to-buffer-margins
  1228. This option can be used to specify margins around frames to be fit by
  1229. @code{fit-frame-to-buffer}. Such margins can be useful to avoid, for
  1230. example, that such frames overlap the taskbar.
  1231. It specifies the numbers of pixels to be left free on the left, above,
  1232. the right, and below a frame that shall be fit. The default specifies
  1233. @code{nil} for each which means to use no margins. The value specified
  1234. here can be overridden for a specific frame by that frame's
  1235. @code{fit-frame-to-buffer-margins} parameter, if present.
  1236. @end defopt
  1237. @defopt fit-frame-to-buffer-sizes
  1238. This option specifies size boundaries for @code{fit-frame-to-buffer}.
  1239. It specifies the total maximum and minimum lines and maximum and minimum
  1240. columns of the root window of any frame that shall be fit to its buffer.
  1241. If any of these values is non-@code{nil}, it overrides the corresponding
  1242. argument of @code{fit-frame-to-buffer}.
  1243. @end defopt
  1244. @node Geometry
  1245. @subsection Geometry
  1246. Here's how to examine the data in an X-style window geometry
  1247. specification:
  1248. @defun x-parse-geometry geom
  1249. @cindex geometry specification
  1250. The function @code{x-parse-geometry} converts a standard X window
  1251. geometry string to an alist that you can use as part of the argument to
  1252. @code{make-frame}.
  1253. The alist describes which parameters were specified in @var{geom}, and
  1254. gives the values specified for them. Each element looks like
  1255. @code{(@var{parameter} . @var{value})}. The possible @var{parameter}
  1256. values are @code{left}, @code{top}, @code{width}, and @code{height}.
  1257. For the size parameters, the value must be an integer. The position
  1258. parameter names @code{left} and @code{top} are not totally accurate,
  1259. because some values indicate the position of the right or bottom edges
  1260. instead. The @var{value} possibilities for the position parameters are:
  1261. an integer, a list @code{(+ @var{pos})}, or a list @code{(- @var{pos})};
  1262. as previously described (@pxref{Position Parameters}).
  1263. Here is an example:
  1264. @example
  1265. (x-parse-geometry "35x70+0-0")
  1266. @result{} ((height . 70) (width . 35)
  1267. (top - 0) (left . 0))
  1268. @end example
  1269. @end defun
  1270. @node Terminal Parameters
  1271. @section Terminal Parameters
  1272. @cindex terminal parameters
  1273. Each terminal has a list of associated parameters. These
  1274. @dfn{terminal parameters} are mostly a convenient way of storage for
  1275. terminal-local variables, but some terminal parameters have a special
  1276. meaning.
  1277. This section describes functions to read and change the parameter values
  1278. of a terminal. They all accept as their argument either a terminal or
  1279. a frame; the latter means use that frame's terminal. An argument of
  1280. @code{nil} means the selected frame's terminal.
  1281. @defun terminal-parameters &optional terminal
  1282. This function returns an alist listing all the parameters of
  1283. @var{terminal} and their values.
  1284. @end defun
  1285. @defun terminal-parameter terminal parameter
  1286. This function returns the value of the parameter @var{parameter} (a
  1287. symbol) of @var{terminal}. If @var{terminal} has no setting for
  1288. @var{parameter}, this function returns @code{nil}.
  1289. @end defun
  1290. @defun set-terminal-parameter terminal parameter value
  1291. This function sets the parameter @var{parm} of @var{terminal} to the
  1292. specified @var{value}, and returns the previous value of that
  1293. parameter.
  1294. @end defun
  1295. Here's a list of a few terminal parameters that have a special
  1296. meaning:
  1297. @table @code
  1298. @item background-mode
  1299. The classification of the terminal's background color, either
  1300. @code{light} or @code{dark}.
  1301. @item normal-erase-is-backspace
  1302. Value is either 1 or 0, depending on whether
  1303. @code{normal-erase-is-backspace-mode} is turned on or off on this
  1304. terminal. @xref{DEL Does Not Delete,,, emacs, The Emacs Manual}.
  1305. @item terminal-initted
  1306. After the terminal is initialized, this is set to the
  1307. terminal-specific initialization function.
  1308. @item tty-mode-set-strings
  1309. When present, a list of strings containing escape sequences that Emacs
  1310. will output while configuring a tty for rendering. Emacs emits these
  1311. strings only when configuring a terminal: if you want to enable a mode
  1312. on a terminal that is already active (for example, while in
  1313. @code{tty-setup-hook}), explicitly output the necessary escape
  1314. sequence using @code{send-string-to-terminal} in addition to adding
  1315. the sequence to @code{tty-mode-set-strings}.
  1316. @item tty-mode-reset-strings
  1317. When present, a list of strings that undo the effects of the strings
  1318. in @code{tty-mode-set-strings}. Emacs emits these strings when
  1319. exiting, deleting a terminal, or suspending itself.
  1320. @end table
  1321. @node Frame Titles
  1322. @section Frame Titles
  1323. @cindex frame title
  1324. Every frame has a @code{name} parameter; this serves as the default
  1325. for the frame title which window systems typically display at the top of
  1326. the frame. You can specify a name explicitly by setting the @code{name}
  1327. frame property.
  1328. Normally you don't specify the name explicitly, and Emacs computes the
  1329. frame name automatically based on a template stored in the variable
  1330. @code{frame-title-format}. Emacs recomputes the name each time the
  1331. frame is redisplayed.
  1332. @defvar frame-title-format
  1333. This variable specifies how to compute a name for a frame when you have
  1334. not explicitly specified one. The variable's value is actually a mode
  1335. line construct, just like @code{mode-line-format}, except that the
  1336. @samp{%c} and @samp{%l} constructs are ignored. @xref{Mode Line
  1337. Data}.
  1338. @end defvar
  1339. @defvar icon-title-format
  1340. This variable specifies how to compute the name for an iconified frame,
  1341. when you have not explicitly specified the frame title. This title
  1342. appears in the icon itself.
  1343. @end defvar
  1344. @defvar multiple-frames
  1345. This variable is set automatically by Emacs. Its value is @code{t} when
  1346. there are two or more frames (not counting minibuffer-only frames or
  1347. invisible frames). The default value of @code{frame-title-format} uses
  1348. @code{multiple-frames} so as to put the buffer name in the frame title
  1349. only when there is more than one frame.
  1350. The value of this variable is not guaranteed to be accurate except
  1351. while processing @code{frame-title-format} or
  1352. @code{icon-title-format}.
  1353. @end defvar
  1354. @node Deleting Frames
  1355. @section Deleting Frames
  1356. @cindex deleting frames
  1357. A @dfn{live frame} is one that has not been deleted. When a frame
  1358. is deleted, it is removed from its terminal display, although it may
  1359. continue to exist as a Lisp object until there are no more references
  1360. to it.
  1361. @deffn Command delete-frame &optional frame force
  1362. @vindex delete-frame-functions
  1363. This function deletes the frame @var{frame}. Unless @var{frame} is a
  1364. tooltip, it first runs the hook @code{delete-frame-functions} (each
  1365. function gets one argument, @var{frame}). By default, @var{frame} is
  1366. the selected frame.
  1367. A frame cannot be deleted if its minibuffer is used by other frames.
  1368. Normally, you cannot delete a frame if all other frames are invisible,
  1369. but if @var{force} is non-@code{nil}, then you are allowed to do so.
  1370. @end deffn
  1371. @defun frame-live-p frame
  1372. The function @code{frame-live-p} returns non-@code{nil} if the frame
  1373. @var{frame} has not been deleted. The possible non-@code{nil} return
  1374. values are like those of @code{framep}. @xref{Frames}.
  1375. @end defun
  1376. Some window managers provide a command to delete a window. These work
  1377. by sending a special message to the program that operates the window.
  1378. When Emacs gets one of these commands, it generates a
  1379. @code{delete-frame} event, whose normal definition is a command that
  1380. calls the function @code{delete-frame}. @xref{Misc Events}.
  1381. @node Finding All Frames
  1382. @section Finding All Frames
  1383. @cindex frames, scanning all
  1384. @defun frame-list
  1385. This function returns a list of all the live frames, i.e., those that
  1386. have not been deleted. It is analogous to @code{buffer-list} for
  1387. buffers, and includes frames on all terminals. The list that you get
  1388. is newly created, so modifying the list doesn't have any effect on the
  1389. internals of Emacs.
  1390. @end defun
  1391. @defun visible-frame-list
  1392. This function returns a list of just the currently visible frames.
  1393. @xref{Visibility of Frames}. Frames on text terminals always count as
  1394. ``visible'', even though only the selected one is actually displayed.
  1395. @end defun
  1396. @defun next-frame &optional frame minibuf
  1397. This function lets you cycle conveniently through all the frames on
  1398. the current display from an arbitrary starting point. It returns the
  1399. ``next'' frame after @var{frame} in the cycle. If @var{frame} is
  1400. omitted or @code{nil}, it defaults to the selected frame (@pxref{Input
  1401. Focus}).
  1402. The second argument, @var{minibuf}, says which frames to consider:
  1403. @table @asis
  1404. @item @code{nil}
  1405. Exclude minibuffer-only frames.
  1406. @item @code{visible}
  1407. Consider all visible frames.
  1408. @item 0
  1409. Consider all visible or iconified frames.
  1410. @item a window
  1411. Consider only the frames using that particular window as their
  1412. minibuffer.
  1413. @item anything else
  1414. Consider all frames.
  1415. @end table
  1416. @end defun
  1417. @defun previous-frame &optional frame minibuf
  1418. Like @code{next-frame}, but cycles through all frames in the opposite
  1419. direction.
  1420. @end defun
  1421. See also @code{next-window} and @code{previous-window}, in @ref{Cyclic
  1422. Window Ordering}.
  1423. @node Minibuffers and Frames
  1424. @section Minibuffers and Frames
  1425. Normally, each frame has its own minibuffer window at the bottom, which
  1426. is used whenever that frame is selected. If the frame has a minibuffer,
  1427. you can get it with @code{minibuffer-window} (@pxref{Definition of
  1428. minibuffer-window}).
  1429. @cindex frame without a minibuffer
  1430. However, you can also create a frame with no minibuffer. Such a frame
  1431. must use the minibuffer window of some other frame. When you create the
  1432. frame, you can explicitly specify the minibuffer window to use (in some
  1433. other frame). If you don't, then the minibuffer is found in the frame
  1434. which is the value of the variable @code{default-minibuffer-frame}. Its
  1435. value should be a frame that does have a minibuffer.
  1436. If you use a minibuffer-only frame, you might want that frame to raise
  1437. when you enter the minibuffer. If so, set the variable
  1438. @code{minibuffer-auto-raise} to @code{t}. @xref{Raising and Lowering}.
  1439. @defvar default-minibuffer-frame
  1440. This variable specifies the frame to use for the minibuffer window, by
  1441. default. It does not affect existing frames. It is always local to
  1442. the current terminal and cannot be buffer-local. @xref{Multiple
  1443. Terminals}.
  1444. @end defvar
  1445. @node Input Focus
  1446. @section Input Focus
  1447. @cindex input focus
  1448. @c @cindex selected frame Duplicates selected-frame, same for selected-window.
  1449. At any time, one frame in Emacs is the @dfn{selected frame}. The selected
  1450. window always resides on the selected frame.
  1451. When Emacs displays its frames on several terminals (@pxref{Multiple
  1452. Terminals}), each terminal has its own selected frame. But only one
  1453. of these is ``@emph{the} selected frame'': it's the frame that belongs
  1454. to the terminal from which the most recent input came. That is, when
  1455. Emacs runs a command that came from a certain terminal, the selected
  1456. frame is the one of that terminal. Since Emacs runs only a single
  1457. command at any given time, it needs to consider only one selected
  1458. frame at a time; this frame is what we call @dfn{the selected frame}
  1459. in this manual. The display on which the selected frame is shown is
  1460. the @dfn{selected frame's display}.
  1461. @defun selected-frame
  1462. This function returns the selected frame.
  1463. @end defun
  1464. Some window systems and window managers direct keyboard input to the
  1465. window object that the mouse is in; others require explicit clicks or
  1466. commands to @dfn{shift the focus} to various window objects. Either
  1467. way, Emacs automatically keeps track of which frame has the focus. To
  1468. explicitly switch to a different frame from a Lisp function, call
  1469. @code{select-frame-set-input-focus}.
  1470. Lisp programs can also switch frames ``temporarily'' by calling the
  1471. function @code{select-frame}. This does not alter the window system's
  1472. concept of focus; rather, it escapes from the window manager's control
  1473. until that control is somehow reasserted.
  1474. When using a text terminal, only one frame can be displayed at a time
  1475. on the terminal, so after a call to @code{select-frame}, the next
  1476. redisplay actually displays the newly selected frame. This frame
  1477. remains selected until a subsequent call to @code{select-frame}. Each
  1478. frame on a text terminal has a number which appears in the mode line
  1479. before the buffer name (@pxref{Mode Line Variables}).
  1480. @defun select-frame-set-input-focus frame &optional norecord
  1481. This function selects @var{frame}, raises it (should it happen to be
  1482. obscured by other frames) and tries to give it the X server's focus.
  1483. On a text terminal, the next redisplay displays the new frame on the
  1484. entire terminal screen. The optional argument @var{norecord} has the
  1485. same meaning as for @code{select-frame} (see below). The return value
  1486. of this function is not significant.
  1487. @end defun
  1488. @deffn Command select-frame frame &optional norecord
  1489. This function selects frame @var{frame}, temporarily disregarding the
  1490. focus of the X server if any. The selection of @var{frame} lasts until
  1491. the next time the user does something to select a different frame, or
  1492. until the next time this function is called. (If you are using a
  1493. window system, the previously selected frame may be restored as the
  1494. selected frame after return to the command loop, because it still may
  1495. have the window system's input focus.)
  1496. The specified @var{frame} becomes the selected frame, and its terminal
  1497. becomes the selected terminal. This function then calls
  1498. @code{select-window} as a subroutine, passing the window selected
  1499. within @var{frame} as its first argument and @var{norecord} as its
  1500. second argument (hence, if @var{norecord} is non-@code{nil}, this
  1501. avoids changing the order of recently selected windows nor the buffer
  1502. list). @xref{Selecting Windows}.
  1503. This function returns @var{frame}, or @code{nil} if @var{frame} has
  1504. been deleted.
  1505. In general, you should never use @code{select-frame} in a way that
  1506. could switch to a different terminal without switching back when
  1507. you're done.
  1508. @end deffn
  1509. Emacs cooperates with the window system by arranging to select frames as
  1510. the server and window manager request. It does so by generating a
  1511. special kind of input event, called a @dfn{focus} event, when
  1512. appropriate. The command loop handles a focus event by calling
  1513. @code{handle-switch-frame}. @xref{Focus Events}.
  1514. @deffn Command handle-switch-frame frame
  1515. This function handles a focus event by selecting frame @var{frame}.
  1516. Focus events normally do their job by invoking this command.
  1517. Don't call it for any other reason.
  1518. @end deffn
  1519. @defun redirect-frame-focus frame &optional focus-frame
  1520. This function redirects focus from @var{frame} to @var{focus-frame}.
  1521. This means that @var{focus-frame} will receive subsequent keystrokes and
  1522. events intended for @var{frame}. After such an event, the value of
  1523. @code{last-event-frame} will be @var{focus-frame}. Also, switch-frame
  1524. events specifying @var{frame} will instead select @var{focus-frame}.
  1525. If @var{focus-frame} is omitted or @code{nil}, that cancels any existing
  1526. redirection for @var{frame}, which therefore once again receives its own
  1527. events.
  1528. One use of focus redirection is for frames that don't have minibuffers.
  1529. These frames use minibuffers on other frames. Activating a minibuffer
  1530. on another frame redirects focus to that frame. This puts the focus on
  1531. the minibuffer's frame, where it belongs, even though the mouse remains
  1532. in the frame that activated the minibuffer.
  1533. Selecting a frame can also change focus redirections. Selecting frame
  1534. @code{bar}, when @code{foo} had been selected, changes any redirections
  1535. pointing to @code{foo} so that they point to @code{bar} instead. This
  1536. allows focus redirection to work properly when the user switches from
  1537. one frame to another using @code{select-window}.
  1538. This means that a frame whose focus is redirected to itself is treated
  1539. differently from a frame whose focus is not redirected.
  1540. @code{select-frame} affects the former but not the latter.
  1541. The redirection lasts until @code{redirect-frame-focus} is called to
  1542. change it.
  1543. @end defun
  1544. @defvar focus-in-hook
  1545. This is a normal hook run when an Emacs frame gains input focus.
  1546. @end defvar
  1547. @defvar focus-out-hook
  1548. This is a normal hook run when an Emacs frame loses input focus.
  1549. @end defvar
  1550. @defopt focus-follows-mouse
  1551. This option is how you inform Emacs whether the window manager transfers
  1552. focus when the user moves the mouse. Non-@code{nil} says that it does.
  1553. When this is so, the command @code{other-frame} moves the mouse to a
  1554. position consistent with the new selected frame.
  1555. @end defopt
  1556. @node Visibility of Frames
  1557. @section Visibility of Frames
  1558. @cindex visible frame
  1559. @cindex invisible frame
  1560. @cindex iconified frame
  1561. @cindex minimized frame
  1562. @cindex frame visibility
  1563. A frame on a graphical display may be @dfn{visible}, @dfn{invisible},
  1564. or @dfn{iconified}. If it is visible, its contents are displayed in
  1565. the usual manner. If it is iconified, its contents are not displayed,
  1566. but there is a little icon somewhere to bring the frame back into view
  1567. (some window managers refer to this state as @dfn{minimized} rather
  1568. than @dfn{iconified}, but from Emacs' point of view they are the same
  1569. thing). If a frame is invisible, it is not displayed at all.
  1570. Visibility is meaningless on text terminals, since only the selected
  1571. one is actually displayed in any case.
  1572. @defun frame-visible-p frame
  1573. This function returns the visibility status of frame @var{frame}. The
  1574. value is @code{t} if @var{frame} is visible, @code{nil} if it is
  1575. invisible, and @code{icon} if it is iconified.
  1576. On a text terminal, all frames are considered ``visible'' for the
  1577. purposes of this function, even though only one frame is displayed.
  1578. @xref{Raising and Lowering}.
  1579. @end defun
  1580. @deffn Command iconify-frame &optional frame
  1581. This function iconifies frame @var{frame}. If you omit @var{frame}, it
  1582. iconifies the selected frame.
  1583. @end deffn
  1584. @deffn Command make-frame-visible &optional frame
  1585. This function makes frame @var{frame} visible. If you omit
  1586. @var{frame}, it makes the selected frame visible. This does not raise
  1587. the frame, but you can do that with @code{raise-frame} if you wish
  1588. (@pxref{Raising and Lowering}).
  1589. @end deffn
  1590. @deffn Command make-frame-invisible &optional frame force
  1591. This function makes frame @var{frame} invisible. If you omit
  1592. @var{frame}, it makes the selected frame invisible.
  1593. Unless @var{force} is non-@code{nil}, this function refuses to make
  1594. @var{frame} invisible if all other frames are invisible..
  1595. @end deffn
  1596. The visibility status of a frame is also available as a frame
  1597. parameter. You can read or change it as such. @xref{Management
  1598. Parameters}. The user can also iconify and deiconify frames with the
  1599. window manager. This happens below the level at which Emacs can exert
  1600. any control, but Emacs does provide events that you can use to keep
  1601. track of such changes. @xref{Misc Events}.
  1602. @node Raising and Lowering
  1603. @section Raising and Lowering Frames
  1604. @cindex raising a frame
  1605. @cindex lowering a frame
  1606. Most window systems use a desktop metaphor. Part of this metaphor
  1607. is the idea that system-level windows (e.g., Emacs frames) are
  1608. stacked in a notional third dimension perpendicular to the screen
  1609. surface. Where two overlap, the one higher up covers the one
  1610. underneath. You can @dfn{raise} or @dfn{lower} a frame using the
  1611. functions @code{raise-frame} and @code{lower-frame}.
  1612. @deffn Command raise-frame &optional frame
  1613. This function raises frame @var{frame} (default, the selected frame).
  1614. If @var{frame} is invisible or iconified, this makes it visible.
  1615. @end deffn
  1616. @deffn Command lower-frame &optional frame
  1617. This function lowers frame @var{frame} (default, the selected frame).
  1618. @end deffn
  1619. @defopt minibuffer-auto-raise
  1620. If this is non-@code{nil}, activation of the minibuffer raises the frame
  1621. that the minibuffer window is in.
  1622. @end defopt
  1623. On window systems, you can also enable auto-raising (on frame
  1624. selection) or auto-lowering (on frame deselection) using frame
  1625. parameters. @xref{Management Parameters}.
  1626. @cindex top frame
  1627. The concept of raising and lowering frames also applies to text
  1628. terminal frames. On each text terminal, only the top frame is
  1629. displayed at any one time.
  1630. @defun tty-top-frame terminal
  1631. This function returns the top frame on @var{terminal}. @var{terminal}
  1632. should be a terminal object, a frame (meaning that frame's terminal),
  1633. or @code{nil} (meaning the selected frame's terminal). If it does not
  1634. refer to a text terminal, the return value is @code{nil}.
  1635. @end defun
  1636. @node Frame Configurations
  1637. @section Frame Configurations
  1638. @cindex frame configuration
  1639. A @dfn{frame configuration} records the current arrangement of frames,
  1640. all their properties, and the window configuration of each one.
  1641. (@xref{Window Configurations}.)
  1642. @defun current-frame-configuration
  1643. This function returns a frame configuration list that describes
  1644. the current arrangement of frames and their contents.
  1645. @end defun
  1646. @defun set-frame-configuration configuration &optional nodelete
  1647. This function restores the state of frames described in
  1648. @var{configuration}. However, this function does not restore deleted
  1649. frames.
  1650. Ordinarily, this function deletes all existing frames not listed in
  1651. @var{configuration}. But if @var{nodelete} is non-@code{nil}, the
  1652. unwanted frames are iconified instead.
  1653. @end defun
  1654. @node Mouse Tracking
  1655. @section Mouse Tracking
  1656. @cindex mouse tracking
  1657. @c @cindex tracking the mouse Duplicates track-mouse
  1658. Sometimes it is useful to @dfn{track} the mouse, which means to display
  1659. something to indicate where the mouse is and move the indicator as the
  1660. mouse moves. For efficient mouse tracking, you need a way to wait until
  1661. the mouse actually moves.
  1662. The convenient way to track the mouse is to ask for events to represent
  1663. mouse motion. Then you can wait for motion by waiting for an event. In
  1664. addition, you can easily handle any other sorts of events that may
  1665. occur. That is useful, because normally you don't want to track the
  1666. mouse forever---only until some other event, such as the release of a
  1667. button.
  1668. @defspec track-mouse body@dots{}
  1669. This special form executes @var{body}, with generation of mouse motion
  1670. events enabled. Typically, @var{body} would use @code{read-event} to
  1671. read the motion events and modify the display accordingly. @xref{Motion
  1672. Events}, for the format of mouse motion events.
  1673. The value of @code{track-mouse} is that of the last form in @var{body}.
  1674. You should design @var{body} to return when it sees the up-event that
  1675. indicates the release of the button, or whatever kind of event means
  1676. it is time to stop tracking.
  1677. @end defspec
  1678. The usual purpose of tracking mouse motion is to indicate on the screen
  1679. the consequences of pushing or releasing a button at the current
  1680. position.
  1681. In many cases, you can avoid the need to track the mouse by using
  1682. the @code{mouse-face} text property (@pxref{Special Properties}).
  1683. That works at a much lower level and runs more smoothly than
  1684. Lisp-level mouse tracking.
  1685. @ignore
  1686. @c These are not implemented yet.
  1687. These functions change the screen appearance instantaneously. The
  1688. effect is transient, only until the next ordinary Emacs redisplay. That
  1689. is OK for mouse tracking, since it doesn't make sense for mouse tracking
  1690. to change the text, and the body of @code{track-mouse} normally reads
  1691. the events itself and does not do redisplay.
  1692. @defun x-contour-region window beg end
  1693. This function draws lines to make a box around the text from @var{beg}
  1694. to @var{end}, in window @var{window}.
  1695. @end defun
  1696. @defun x-uncontour-region window beg end
  1697. This function erases the lines that would make a box around the text
  1698. from @var{beg} to @var{end}, in window @var{window}. Use it to remove
  1699. a contour that you previously made by calling @code{x-contour-region}.
  1700. @end defun
  1701. @defun x-draw-rectangle frame left top right bottom
  1702. This function draws a hollow rectangle on frame @var{frame} with the
  1703. specified edge coordinates, all measured in pixels from the inside top
  1704. left corner. It uses the cursor color, the one used for indicating the
  1705. location of point.
  1706. @end defun
  1707. @defun x-erase-rectangle frame left top right bottom
  1708. This function erases a hollow rectangle on frame @var{frame} with the
  1709. specified edge coordinates, all measured in pixels from the inside top
  1710. left corner. Erasure means redrawing the text and background that
  1711. normally belong in the specified rectangle.
  1712. @end defun
  1713. @end ignore
  1714. @node Mouse Position
  1715. @section Mouse Position
  1716. @cindex mouse position
  1717. @cindex position of mouse
  1718. The functions @code{mouse-position} and @code{set-mouse-position}
  1719. give access to the current position of the mouse.
  1720. @defun mouse-position
  1721. This function returns a description of the position of the mouse. The
  1722. value looks like @code{(@var{frame} @var{x} . @var{y})}, where @var{x}
  1723. and @var{y} are integers giving the position in characters relative to
  1724. the top left corner of the inside of @var{frame}.
  1725. @end defun
  1726. @defvar mouse-position-function
  1727. If non-@code{nil}, the value of this variable is a function for
  1728. @code{mouse-position} to call. @code{mouse-position} calls this
  1729. function just before returning, with its normal return value as the
  1730. sole argument, and it returns whatever this function returns to it.
  1731. This abnormal hook exists for the benefit of packages like
  1732. @file{xt-mouse.el} that need to do mouse handling at the Lisp level.
  1733. @end defvar
  1734. @defun set-mouse-position frame x y
  1735. This function @dfn{warps the mouse} to position @var{x}, @var{y} in
  1736. frame @var{frame}. The arguments @var{x} and @var{y} are integers,
  1737. giving the position in characters relative to the top left corner of the
  1738. inside of @var{frame}. If @var{frame} is not visible, this function
  1739. does nothing. The return value is not significant.
  1740. @end defun
  1741. @defun mouse-pixel-position
  1742. This function is like @code{mouse-position} except that it returns
  1743. coordinates in units of pixels rather than units of characters.
  1744. @end defun
  1745. @defun set-mouse-pixel-position frame x y
  1746. This function warps the mouse like @code{set-mouse-position} except that
  1747. @var{x} and @var{y} are in units of pixels rather than units of
  1748. characters. These coordinates are not required to be within the frame.
  1749. If @var{frame} is not visible, this function does nothing. The return
  1750. value is not significant.
  1751. @end defun
  1752. @defun frame-pointer-visible-p &optional frame
  1753. This predicate function returns non-@code{nil} if the mouse pointer
  1754. displayed on @var{frame} is visible; otherwise it returns @code{nil}.
  1755. @var{frame} omitted or @code{nil} means the selected frame. This is
  1756. useful when @code{make-pointer-invisible} is set to @code{t}: it
  1757. allows to know if the pointer has been hidden.
  1758. @xref{Mouse Avoidance,,,emacs, The Emacs Manual}.
  1759. @end defun
  1760. @need 3000
  1761. @node Pop-Up Menus
  1762. @section Pop-Up Menus
  1763. @cindex menus, popup
  1764. A Lisp program can pop up a menu so that the user can choose an
  1765. alternative with the mouse. On a text terminal, if the mouse is not
  1766. available, the user can choose an alternative using the keyboard
  1767. motion keys---@kbd{C-n}, @kbd{C-p}, or up- and down-arrow keys.
  1768. @defun x-popup-menu position menu
  1769. This function displays a pop-up menu and returns an indication of
  1770. what selection the user makes.
  1771. The argument @var{position} specifies where on the screen to put the
  1772. top left corner of the menu. It can be either a mouse button event
  1773. (which says to put the menu where the user actuated the button) or a
  1774. list of this form:
  1775. @example
  1776. ((@var{xoffset} @var{yoffset}) @var{window})
  1777. @end example
  1778. @noindent
  1779. where @var{xoffset} and @var{yoffset} are coordinates, measured in
  1780. pixels, counting from the top left corner of @var{window}. @var{window}
  1781. may be a window or a frame.
  1782. If @var{position} is @code{t}, it means to use the current mouse
  1783. position (or the top-left corner of the frame if the mouse is not
  1784. available on a text terminal). If @var{position} is @code{nil}, it
  1785. means to precompute the key binding equivalents for the keymaps
  1786. specified in @var{menu}, without actually displaying or popping up the
  1787. menu.
  1788. The argument @var{menu} says what to display in the menu. It can be a
  1789. keymap or a list of keymaps (@pxref{Menu Keymaps}). In this case, the
  1790. return value is the list of events corresponding to the user's choice.
  1791. This list has more than one element if the choice occurred in a
  1792. submenu. (Note that @code{x-popup-menu} does not actually execute the
  1793. command bound to that sequence of events.) On text terminals and
  1794. toolkits that support menu titles, the title is taken from the prompt
  1795. string of @var{menu} if @var{menu} is a keymap, or from the prompt
  1796. string of the first keymap in @var{menu} if it is a list of keymaps
  1797. (@pxref{Defining Menus}).
  1798. Alternatively, @var{menu} can have the following form:
  1799. @example
  1800. (@var{title} @var{pane1} @var{pane2}...)
  1801. @end example
  1802. @noindent
  1803. where each pane is a list of form
  1804. @example
  1805. (@var{title} @var{item1} @var{item2}...)
  1806. @end example
  1807. Each @var{item} should be a cons cell, @code{(@var{line} . @var{value})},
  1808. where @var{line} is a string and @var{value} is the value to return if
  1809. that @var{line} is chosen. Unlike in a menu keymap, a @code{nil}
  1810. @var{value} does not make the menu item non-selectable.
  1811. Alternatively, each @var{item} can be a string rather than a cons
  1812. cell; this makes a non-selectable menu item.
  1813. If the user gets rid of the menu without making a valid choice, for
  1814. instance by clicking the mouse away from a valid choice or by typing
  1815. @kbd{C-g}, then this normally results in a quit and
  1816. @code{x-popup-menu} does not return. But if @var{position} is a mouse
  1817. button event (indicating that the user invoked the menu with the
  1818. mouse) then no quit occurs and @code{x-popup-menu} returns @code{nil}.
  1819. @end defun
  1820. @strong{Usage note:} Don't use @code{x-popup-menu} to display a menu
  1821. if you could do the job with a prefix key defined with a menu keymap.
  1822. If you use a menu keymap to implement a menu, @kbd{C-h c} and @kbd{C-h
  1823. a} can see the individual items in that menu and provide help for them.
  1824. If instead you implement the menu by defining a command that calls
  1825. @code{x-popup-menu}, the help facilities cannot know what happens inside
  1826. that command, so they cannot give any help for the menu's items.
  1827. The menu bar mechanism, which lets you switch between submenus by
  1828. moving the mouse, cannot look within the definition of a command to see
  1829. that it calls @code{x-popup-menu}. Therefore, if you try to implement a
  1830. submenu using @code{x-popup-menu}, it cannot work with the menu bar in
  1831. an integrated fashion. This is why all menu bar submenus are
  1832. implemented with menu keymaps within the parent menu, and never with
  1833. @code{x-popup-menu}. @xref{Menu Bar}.
  1834. If you want a menu bar submenu to have contents that vary, you should
  1835. still use a menu keymap to implement it. To make the contents vary, add
  1836. a hook function to @code{menu-bar-update-hook} to update the contents of
  1837. the menu keymap as necessary.
  1838. @node Dialog Boxes
  1839. @section Dialog Boxes
  1840. @cindex dialog boxes
  1841. A dialog box is a variant of a pop-up menu---it looks a little
  1842. different, it always appears in the center of a frame, and it has just
  1843. one level and one or more buttons. The main use of dialog boxes is
  1844. for asking questions that the user can answer with ``yes'', ``no'',
  1845. and a few other alternatives. With a single button, they can also
  1846. force the user to acknowledge important information. The functions
  1847. @code{y-or-n-p} and @code{yes-or-no-p} use dialog boxes instead of the
  1848. keyboard, when called from commands invoked by mouse clicks.
  1849. @defun x-popup-dialog position contents &optional header
  1850. This function displays a pop-up dialog box and returns an indication of
  1851. what selection the user makes. The argument @var{contents} specifies
  1852. the alternatives to offer; it has this format:
  1853. @example
  1854. (@var{title} (@var{string} . @var{value})@dots{})
  1855. @end example
  1856. @noindent
  1857. which looks like the list that specifies a single pane for
  1858. @code{x-popup-menu}.
  1859. The return value is @var{value} from the chosen alternative.
  1860. As for @code{x-popup-menu}, an element of the list may be just a
  1861. string instead of a cons cell @code{(@var{string} . @var{value})}.
  1862. That makes a box that cannot be selected.
  1863. If @code{nil} appears in the list, it separates the left-hand items from
  1864. the right-hand items; items that precede the @code{nil} appear on the
  1865. left, and items that follow the @code{nil} appear on the right. If you
  1866. don't include a @code{nil} in the list, then approximately half the
  1867. items appear on each side.
  1868. Dialog boxes always appear in the center of a frame; the argument
  1869. @var{position} specifies which frame. The possible values are as in
  1870. @code{x-popup-menu}, but the precise coordinates or the individual
  1871. window don't matter; only the frame matters.
  1872. If @var{header} is non-@code{nil}, the frame title for the box is
  1873. @samp{Information}, otherwise it is @samp{Question}. The former is used
  1874. for @code{message-box} (@pxref{message-box}). (On text terminals, the
  1875. box title is not displayed.)
  1876. In some configurations, Emacs cannot display a real dialog box; so
  1877. instead it displays the same items in a pop-up menu in the center of the
  1878. frame.
  1879. If the user gets rid of the dialog box without making a valid choice,
  1880. for instance using the window manager, then this produces a quit and
  1881. @code{x-popup-dialog} does not return.
  1882. @end defun
  1883. @node Pointer Shape
  1884. @section Pointer Shape
  1885. @cindex pointer shape
  1886. @cindex mouse pointer shape
  1887. You can specify the mouse pointer style for particular text or
  1888. images using the @code{pointer} text property, and for images with the
  1889. @code{:pointer} and @code{:map} image properties. The values you can
  1890. use in these properties are @code{text} (or @code{nil}), @code{arrow},
  1891. @code{hand}, @code{vdrag}, @code{hdrag}, @code{modeline}, and
  1892. @code{hourglass}. @code{text} stands for the usual mouse pointer
  1893. style used over text.
  1894. Over void parts of the window (parts that do not correspond to any
  1895. of the buffer contents), the mouse pointer usually uses the
  1896. @code{arrow} style, but you can specify a different style (one of
  1897. those above) by setting @code{void-text-area-pointer}.
  1898. @defopt void-text-area-pointer
  1899. This variable specifies the mouse pointer style for void text areas.
  1900. These include the areas after the end of a line or below the last line
  1901. in the buffer. The default is to use the @code{arrow} (non-text)
  1902. pointer style.
  1903. @end defopt
  1904. When using X, you can specify what the @code{text} pointer style
  1905. really looks like by setting the variable @code{x-pointer-shape}.
  1906. @defvar x-pointer-shape
  1907. This variable specifies the pointer shape to use ordinarily in the
  1908. Emacs frame, for the @code{text} pointer style.
  1909. @end defvar
  1910. @defvar x-sensitive-text-pointer-shape
  1911. This variable specifies the pointer shape to use when the mouse
  1912. is over mouse-sensitive text.
  1913. @end defvar
  1914. These variables affect newly created frames. They do not normally
  1915. affect existing frames; however, if you set the mouse color of a
  1916. frame, that also installs the current value of those two variables.
  1917. @xref{Font and Color Parameters}.
  1918. The values you can use, to specify either of these pointer shapes, are
  1919. defined in the file @file{lisp/term/x-win.el}. Use @kbd{M-x apropos
  1920. @key{RET} x-pointer @key{RET}} to see a list of them.
  1921. @node Window System Selections
  1922. @section Window System Selections
  1923. @cindex selection (for window systems)
  1924. @cindex clipboard
  1925. @cindex primary selection
  1926. @cindex secondary selection
  1927. In the X window system, data can be transferred between different
  1928. applications by means of @dfn{selections}. X defines an arbitrary
  1929. number of @dfn{selection types}, each of which can store its own data;
  1930. however, only three are commonly used: the @dfn{clipboard},
  1931. @dfn{primary selection}, and @dfn{secondary selection}. @xref{Cut and
  1932. Paste,, Cut and Paste, emacs, The GNU Emacs Manual}, for Emacs
  1933. commands that make use of these selections. This section documents
  1934. the low-level functions for reading and setting X selections.
  1935. @deffn Command x-set-selection type data
  1936. This function sets an X selection. It takes two arguments: a
  1937. selection type @var{type}, and the value to assign to it, @var{data}.
  1938. @var{type} should be a symbol; it is usually one of @code{PRIMARY},
  1939. @code{SECONDARY} or @code{CLIPBOARD}. These are symbols with
  1940. upper-case names, in accord with X Window System conventions. If
  1941. @var{type} is @code{nil}, that stands for @code{PRIMARY}.
  1942. If @var{data} is @code{nil}, it means to clear out the selection.
  1943. Otherwise, @var{data} may be a string, a symbol, an integer (or a cons
  1944. of two integers or list of two integers), an overlay, or a cons of two
  1945. markers pointing to the same buffer. An overlay or a pair of markers
  1946. stands for text in the overlay or between the markers. The argument
  1947. @var{data} may also be a vector of valid non-vector selection values.
  1948. This function returns @var{data}.
  1949. @end deffn
  1950. @defun x-get-selection &optional type data-type
  1951. This function accesses selections set up by Emacs or by other X
  1952. clients. It takes two optional arguments, @var{type} and
  1953. @var{data-type}. The default for @var{type}, the selection type, is
  1954. @code{PRIMARY}.
  1955. The @var{data-type} argument specifies the form of data conversion to
  1956. use, to convert the raw data obtained from another X client into Lisp
  1957. data. Meaningful values include @code{TEXT}, @code{STRING},
  1958. @code{UTF8_STRING}, @code{TARGETS}, @code{LENGTH}, @code{DELETE},
  1959. @code{FILE_NAME}, @code{CHARACTER_POSITION}, @code{NAME},
  1960. @code{LINE_NUMBER}, @code{COLUMN_NUMBER}, @code{OWNER_OS},
  1961. @code{HOST_NAME}, @code{USER}, @code{CLASS}, @code{ATOM}, and
  1962. @code{INTEGER}. (These are symbols with upper-case names in accord
  1963. with X conventions.) The default for @var{data-type} is
  1964. @code{STRING}.
  1965. @end defun
  1966. @defopt selection-coding-system
  1967. This variable specifies the coding system to use when reading and
  1968. writing selections or the clipboard. @xref{Coding
  1969. Systems}. The default is @code{compound-text-with-extensions}, which
  1970. converts to the text representation that X11 normally uses.
  1971. @end defopt
  1972. @cindex clipboard support (for MS-Windows)
  1973. When Emacs runs on MS-Windows, it does not implement X selections in
  1974. general, but it does support the clipboard. @code{x-get-selection}
  1975. and @code{x-set-selection} on MS-Windows support the text data type
  1976. only; if the clipboard holds other types of data, Emacs treats the
  1977. clipboard as empty.
  1978. @node Drag and Drop
  1979. @section Drag and Drop
  1980. @cindex drag and drop
  1981. @vindex x-dnd-test-function
  1982. @vindex x-dnd-known-types
  1983. When a user drags something from another application over Emacs, that other
  1984. application expects Emacs to tell it if Emacs can handle the data that is
  1985. dragged. The variable @code{x-dnd-test-function} is used by Emacs to determine
  1986. what to reply. The default value is @code{x-dnd-default-test-function}
  1987. which accepts drops if the type of the data to be dropped is present in
  1988. @code{x-dnd-known-types}. You can customize @code{x-dnd-test-function} and/or
  1989. @code{x-dnd-known-types} if you want Emacs to accept or reject drops based
  1990. on some other criteria.
  1991. @vindex x-dnd-types-alist
  1992. If you want to change the way Emacs handles drop of different types
  1993. or add a new type, customize @code{x-dnd-types-alist}. This requires
  1994. detailed knowledge of what types other applications use for drag and
  1995. drop.
  1996. @vindex dnd-protocol-alist
  1997. When an URL is dropped on Emacs it may be a file, but it may also be
  1998. another URL type (ftp, http, etc.). Emacs first checks
  1999. @code{dnd-protocol-alist} to determine what to do with the URL@. If
  2000. there is no match there and if @code{browse-url-browser-function} is
  2001. an alist, Emacs looks for a match there. If no match is found the
  2002. text for the URL is inserted. If you want to alter Emacs behavior,
  2003. you can customize these variables.
  2004. @node Color Names
  2005. @section Color Names
  2006. @cindex color names
  2007. @cindex specify color
  2008. @cindex numerical RGB color specification
  2009. A color name is text (usually in a string) that specifies a color.
  2010. Symbolic names such as @samp{black}, @samp{white}, @samp{red}, etc.,
  2011. are allowed; use @kbd{M-x list-colors-display} to see a list of
  2012. defined names. You can also specify colors numerically in forms such
  2013. as @samp{#@var{rgb}} and @samp{RGB:@var{r}/@var{g}/@var{b}}, where
  2014. @var{r} specifies the red level, @var{g} specifies the green level,
  2015. and @var{b} specifies the blue level. You can use either one, two,
  2016. three, or four hex digits for @var{r}; then you must use the same
  2017. number of hex digits for all @var{g} and @var{b} as well, making
  2018. either 3, 6, 9 or 12 hex digits in all. (See the documentation of the
  2019. X Window System for more details about numerical RGB specification of
  2020. colors.)
  2021. These functions provide a way to determine which color names are
  2022. valid, and what they look like. In some cases, the value depends on the
  2023. @dfn{selected frame}, as described below; see @ref{Input Focus}, for the
  2024. meaning of the term ``selected frame''.
  2025. To read user input of color names with completion, use
  2026. @code{read-color} (@pxref{High-Level Completion, read-color}).
  2027. @defun color-defined-p color &optional frame
  2028. This function reports whether a color name is meaningful. It returns
  2029. @code{t} if so; otherwise, @code{nil}. The argument @var{frame} says
  2030. which frame's display to ask about; if @var{frame} is omitted or
  2031. @code{nil}, the selected frame is used.
  2032. Note that this does not tell you whether the display you are using
  2033. really supports that color. When using X, you can ask for any defined
  2034. color on any kind of display, and you will get some result---typically,
  2035. the closest it can do. To determine whether a frame can really display
  2036. a certain color, use @code{color-supported-p} (see below).
  2037. @findex x-color-defined-p
  2038. This function used to be called @code{x-color-defined-p},
  2039. and that name is still supported as an alias.
  2040. @end defun
  2041. @defun defined-colors &optional frame
  2042. This function returns a list of the color names that are defined
  2043. and supported on frame @var{frame} (default, the selected frame).
  2044. If @var{frame} does not support colors, the value is @code{nil}.
  2045. @findex x-defined-colors
  2046. This function used to be called @code{x-defined-colors},
  2047. and that name is still supported as an alias.
  2048. @end defun
  2049. @defun color-supported-p color &optional frame background-p
  2050. This returns @code{t} if @var{frame} can really display the color
  2051. @var{color} (or at least something close to it). If @var{frame} is
  2052. omitted or @code{nil}, the question applies to the selected frame.
  2053. Some terminals support a different set of colors for foreground and
  2054. background. If @var{background-p} is non-@code{nil}, that means you are
  2055. asking whether @var{color} can be used as a background; otherwise you
  2056. are asking whether it can be used as a foreground.
  2057. The argument @var{color} must be a valid color name.
  2058. @end defun
  2059. @defun color-gray-p color &optional frame
  2060. This returns @code{t} if @var{color} is a shade of gray, as defined on
  2061. @var{frame}'s display. If @var{frame} is omitted or @code{nil}, the
  2062. question applies to the selected frame. If @var{color} is not a valid
  2063. color name, this function returns @code{nil}.
  2064. @end defun
  2065. @defun color-values color &optional frame
  2066. @cindex rgb value
  2067. This function returns a value that describes what @var{color} should
  2068. ideally look like on @var{frame}. If @var{color} is defined, the
  2069. value is a list of three integers, which give the amount of red, the
  2070. amount of green, and the amount of blue. Each integer ranges in
  2071. principle from 0 to 65535, but some displays may not use the full
  2072. range. This three-element list is called the @dfn{rgb values} of the
  2073. color.
  2074. If @var{color} is not defined, the value is @code{nil}.
  2075. @example
  2076. (color-values "black")
  2077. @result{} (0 0 0)
  2078. (color-values "white")
  2079. @result{} (65280 65280 65280)
  2080. (color-values "red")
  2081. @result{} (65280 0 0)
  2082. (color-values "pink")
  2083. @result{} (65280 49152 51968)
  2084. (color-values "hungry")
  2085. @result{} nil
  2086. @end example
  2087. The color values are returned for @var{frame}'s display. If
  2088. @var{frame} is omitted or @code{nil}, the information is returned for
  2089. the selected frame's display. If the frame cannot display colors, the
  2090. value is @code{nil}.
  2091. @findex x-color-values
  2092. This function used to be called @code{x-color-values},
  2093. and that name is still supported as an alias.
  2094. @end defun
  2095. @node Text Terminal Colors
  2096. @section Text Terminal Colors
  2097. @cindex colors on text terminals
  2098. Text terminals usually support only a small number of colors, and
  2099. the computer uses small integers to select colors on the terminal.
  2100. This means that the computer cannot reliably tell what the selected
  2101. color looks like; instead, you have to inform your application which
  2102. small integers correspond to which colors. However, Emacs does know
  2103. the standard set of colors and will try to use them automatically.
  2104. The functions described in this section control how terminal colors
  2105. are used by Emacs.
  2106. Several of these functions use or return @dfn{rgb values}, described
  2107. in @ref{Color Names}.
  2108. These functions accept a display (either a frame or the name of a
  2109. terminal) as an optional argument. We hope in the future to make
  2110. Emacs support different colors on different text terminals; then this
  2111. argument will specify which terminal to operate on (the default being
  2112. the selected frame's terminal; @pxref{Input Focus}). At present,
  2113. though, the @var{frame} argument has no effect.
  2114. @defun tty-color-define name number &optional rgb frame
  2115. This function associates the color name @var{name} with
  2116. color number @var{number} on the terminal.
  2117. The optional argument @var{rgb}, if specified, is an rgb value, a list
  2118. of three numbers that specify what the color actually looks like.
  2119. If you do not specify @var{rgb}, then this color cannot be used by
  2120. @code{tty-color-approximate} to approximate other colors, because
  2121. Emacs will not know what it looks like.
  2122. @end defun
  2123. @defun tty-color-clear &optional frame
  2124. This function clears the table of defined colors for a text terminal.
  2125. @end defun
  2126. @defun tty-color-alist &optional frame
  2127. This function returns an alist recording the known colors supported by
  2128. a text terminal.
  2129. Each element has the form @code{(@var{name} @var{number} . @var{rgb})}
  2130. or @code{(@var{name} @var{number})}. Here, @var{name} is the color
  2131. name, @var{number} is the number used to specify it to the terminal.
  2132. If present, @var{rgb} is a list of three color values (for red, green,
  2133. and blue) that says what the color actually looks like.
  2134. @end defun
  2135. @defun tty-color-approximate rgb &optional frame
  2136. This function finds the closest color, among the known colors
  2137. supported for @var{display}, to that described by the rgb value
  2138. @var{rgb} (a list of color values). The return value is an element of
  2139. @code{tty-color-alist}.
  2140. @end defun
  2141. @defun tty-color-translate color &optional frame
  2142. This function finds the closest color to @var{color} among the known
  2143. colors supported for @var{display} and returns its index (an integer).
  2144. If the name @var{color} is not defined, the value is @code{nil}.
  2145. @end defun
  2146. @node Resources
  2147. @section X Resources
  2148. This section describes some of the functions and variables for
  2149. querying and using X resources, or their equivalent on your operating
  2150. system. @xref{X Resources,, X Resources, emacs, The GNU Emacs
  2151. Manual}, for more information about X resources.
  2152. @defun x-get-resource attribute class &optional component subclass
  2153. The function @code{x-get-resource} retrieves a resource value from the X
  2154. Window defaults database.
  2155. Resources are indexed by a combination of a @dfn{key} and a @dfn{class}.
  2156. This function searches using a key of the form
  2157. @samp{@var{instance}.@var{attribute}} (where @var{instance} is the name
  2158. under which Emacs was invoked), and using @samp{Emacs.@var{class}} as
  2159. the class.
  2160. The optional arguments @var{component} and @var{subclass} add to the key
  2161. and the class, respectively. You must specify both of them or neither.
  2162. If you specify them, the key is
  2163. @samp{@var{instance}.@var{component}.@var{attribute}}, and the class is
  2164. @samp{Emacs.@var{class}.@var{subclass}}.
  2165. @end defun
  2166. @defvar x-resource-class
  2167. This variable specifies the application name that @code{x-get-resource}
  2168. should look up. The default value is @code{"Emacs"}. You can examine X
  2169. resources for application names other than ``Emacs'' by binding this
  2170. variable to some other string, around a call to @code{x-get-resource}.
  2171. @end defvar
  2172. @defvar x-resource-name
  2173. This variable specifies the instance name that @code{x-get-resource}
  2174. should look up. The default value is the name Emacs was invoked with,
  2175. or the value specified with the @samp{-name} or @samp{-rn} switches.
  2176. @end defvar
  2177. To illustrate some of the above, suppose that you have the line:
  2178. @example
  2179. xterm.vt100.background: yellow
  2180. @end example
  2181. @noindent
  2182. in your X resources file (whose name is usually @file{~/.Xdefaults}
  2183. or @file{~/.Xresources}). Then:
  2184. @example
  2185. @group
  2186. (let ((x-resource-class "XTerm") (x-resource-name "xterm"))
  2187. (x-get-resource "vt100.background" "VT100.Background"))
  2188. @result{} "yellow"
  2189. @end group
  2190. @group
  2191. (let ((x-resource-class "XTerm") (x-resource-name "xterm"))
  2192. (x-get-resource "background" "VT100" "vt100" "Background"))
  2193. @result{} "yellow"
  2194. @end group
  2195. @end example
  2196. @defvar inhibit-x-resources
  2197. If this variable is non-@code{nil}, Emacs does not look up X
  2198. resources, and X resources do not have any effect when creating new
  2199. frames.
  2200. @end defvar
  2201. @node Display Feature Testing
  2202. @section Display Feature Testing
  2203. @cindex display feature testing
  2204. The functions in this section describe the basic capabilities of a
  2205. particular display. Lisp programs can use them to adapt their behavior
  2206. to what the display can do. For example, a program that ordinarily uses
  2207. a popup menu could use the minibuffer if popup menus are not supported.
  2208. The optional argument @var{display} in these functions specifies which
  2209. display to ask the question about. It can be a display name, a frame
  2210. (which designates the display that frame is on), or @code{nil} (which
  2211. refers to the selected frame's display, @pxref{Input Focus}).
  2212. @xref{Color Names}, @ref{Text Terminal Colors}, for other functions to
  2213. obtain information about displays.
  2214. @defun display-popup-menus-p &optional display
  2215. This function returns @code{t} if popup menus are supported on
  2216. @var{display}, @code{nil} if not. Support for popup menus requires
  2217. that the mouse be available, since the menu is popped up by clicking
  2218. the mouse on some portion of the Emacs display.
  2219. @end defun
  2220. @defun display-graphic-p &optional display
  2221. This function returns @code{t} if @var{display} is a graphic display
  2222. capable of displaying several frames and several different fonts at
  2223. once. This is true for displays that use a window system such as X,
  2224. and false for text terminals.
  2225. @end defun
  2226. @defun display-mouse-p &optional display
  2227. @cindex mouse, availability
  2228. This function returns @code{t} if @var{display} has a mouse available,
  2229. @code{nil} if not.
  2230. @end defun
  2231. @defun display-color-p &optional display
  2232. @findex x-display-color-p
  2233. This function returns @code{t} if the screen is a color screen.
  2234. It used to be called @code{x-display-color-p}, and that name
  2235. is still supported as an alias.
  2236. @end defun
  2237. @defun display-grayscale-p &optional display
  2238. This function returns @code{t} if the screen can display shades of gray.
  2239. (All color displays can do this.)
  2240. @end defun
  2241. @defun display-supports-face-attributes-p attributes &optional display
  2242. @anchor{Display Face Attribute Testing}
  2243. This function returns non-@code{nil} if all the face attributes in
  2244. @var{attributes} are supported (@pxref{Face Attributes}).
  2245. The definition of ``supported'' is somewhat heuristic, but basically
  2246. means that a face containing all the attributes in @var{attributes},
  2247. when merged with the default face for display, can be represented in a
  2248. way that's
  2249. @enumerate
  2250. @item
  2251. different in appearance than the default face, and
  2252. @item
  2253. ``close in spirit'' to what the attributes specify, if not exact.
  2254. @end enumerate
  2255. Point (2) implies that a @code{:weight black} attribute will be
  2256. satisfied by any display that can display bold, as will
  2257. @code{:foreground "yellow"} as long as some yellowish color can be
  2258. displayed, but @code{:slant italic} will @emph{not} be satisfied by
  2259. the tty display code's automatic substitution of a ``dim'' face for
  2260. italic.
  2261. @end defun
  2262. @defun display-selections-p &optional display
  2263. This function returns @code{t} if @var{display} supports selections.
  2264. Windowed displays normally support selections, but they may also be
  2265. supported in some other cases.
  2266. @end defun
  2267. @defun display-images-p &optional display
  2268. This function returns @code{t} if @var{display} can display images.
  2269. Windowed displays ought in principle to handle images, but some
  2270. systems lack the support for that. On a display that does not support
  2271. images, Emacs cannot display a tool bar.
  2272. @end defun
  2273. @defun display-screens &optional display
  2274. This function returns the number of screens associated with the display.
  2275. @end defun
  2276. @defun display-pixel-height &optional display
  2277. This function returns the height of the screen in pixels.
  2278. On a character terminal, it gives the height in characters.
  2279. For graphical terminals, note that on ``multi-monitor'' setups this
  2280. refers to the pixel height for all physical monitors associated with
  2281. @var{display}. @xref{Multiple Terminals}.
  2282. @end defun
  2283. @defun display-pixel-width &optional display
  2284. This function returns the width of the screen in pixels.
  2285. On a character terminal, it gives the width in characters.
  2286. For graphical terminals, note that on ``multi-monitor'' setups this
  2287. refers to the pixel width for all physical monitors associated with
  2288. @var{display}. @xref{Multiple Terminals}.
  2289. @end defun
  2290. @defun display-mm-height &optional display
  2291. This function returns the height of the screen in millimeters,
  2292. or @code{nil} if Emacs cannot get that information.
  2293. For graphical terminals, note that on ``multi-monitor'' setups this
  2294. refers to the height for all physical monitors associated with
  2295. @var{display}. @xref{Multiple Terminals}.
  2296. @end defun
  2297. @defun display-mm-width &optional display
  2298. This function returns the width of the screen in millimeters,
  2299. or @code{nil} if Emacs cannot get that information.
  2300. For graphical terminals, note that on ``multi-monitor'' setups this
  2301. refers to the width for all physical monitors associated with
  2302. @var{display}. @xref{Multiple Terminals}.
  2303. @end defun
  2304. @defopt display-mm-dimensions-alist
  2305. This variable allows the user to specify the dimensions of graphical
  2306. displays returned by @code{display-mm-height} and
  2307. @code{display-mm-width} in case the system provides incorrect values.
  2308. @end defopt
  2309. @cindex backing store
  2310. @defun display-backing-store &optional display
  2311. This function returns the backing store capability of the display.
  2312. Backing store means recording the pixels of windows (and parts of
  2313. windows) that are not exposed, so that when exposed they can be
  2314. displayed very quickly.
  2315. Values can be the symbols @code{always}, @code{when-mapped}, or
  2316. @code{not-useful}. The function can also return @code{nil}
  2317. when the question is inapplicable to a certain kind of display.
  2318. @end defun
  2319. @cindex SaveUnder feature
  2320. @defun display-save-under &optional display
  2321. This function returns non-@code{nil} if the display supports the
  2322. SaveUnder feature. That feature is used by pop-up windows
  2323. to save the pixels they obscure, so that they can pop down
  2324. quickly.
  2325. @end defun
  2326. @defun display-planes &optional display
  2327. This function returns the number of planes the display supports.
  2328. This is typically the number of bits per pixel.
  2329. For a tty display, it is log to base two of the number of colors supported.
  2330. @end defun
  2331. @defun display-visual-class &optional display
  2332. This function returns the visual class for the screen. The value is
  2333. one of the symbols @code{static-gray} (a limited, unchangeable number
  2334. of grays), @code{gray-scale} (a full range of grays),
  2335. @code{static-color} (a limited, unchangeable number of colors),
  2336. @code{pseudo-color} (a limited number of colors), @code{true-color} (a
  2337. full range of colors), and @code{direct-color} (a full range of
  2338. colors).
  2339. @end defun
  2340. @defun display-color-cells &optional display
  2341. This function returns the number of color cells the screen supports.
  2342. @end defun
  2343. These functions obtain additional information about the window
  2344. system in use where Emacs shows the specified @var{display}. (Their
  2345. names begin with @code{x-} for historical reasons.)
  2346. @defun x-server-version &optional display
  2347. This function returns the list of version numbers of the GUI window
  2348. system running on @var{display}, such as the X server on GNU and Unix
  2349. systems. The value is a list of three integers: the major and minor
  2350. version numbers of the protocol, and the distributor-specific release
  2351. number of the window system software itself. On GNU and Unix systems,
  2352. these are normally the version of the X protocol and the
  2353. distributor-specific release number of the X server software. On
  2354. MS-Windows, this is the version of the Windows OS.
  2355. @end defun
  2356. @defun x-server-vendor &optional display
  2357. This function returns the ``vendor'' that provided the window system
  2358. software (as a string). On GNU and Unix systems this really means
  2359. whoever distributes the X server. On MS-Windows this is the vendor ID
  2360. string of the Windows OS (Microsoft).
  2361. When the developers of X labeled software distributors as
  2362. ``vendors'', they showed their false assumption that no system could
  2363. ever be developed and distributed noncommercially.
  2364. @end defun
  2365. @ignore
  2366. @defvar x-no-window-manager
  2367. This variable's value is @code{t} if no X window manager is in use.
  2368. @end defvar
  2369. @end ignore
  2370. @ignore
  2371. @item
  2372. The functions @code{x-pixel-width} and @code{x-pixel-height} return the
  2373. width and height of an X Window frame, measured in pixels.
  2374. @end ignore