aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPo Lu2023-10-24 05:37:24 +0000
committerPo Lu2023-10-24 05:37:24 +0000
commitbcdfd7b091cc71dd75b6e91a55c2813f895fb4ef (patch)
tree324d0c2f8ca12e30efac703350f0a7ebe6740b5a
parenteea7214113b14f5b34ed7cfae0365c7509e5d5ac (diff)
downloademacs-bcdfd7b091cc71dd75b6e91a55c2813f895fb4ef.tar.gz
emacs-bcdfd7b091cc71dd75b6e91a55c2813f895fb4ef.zip
Rewrite all sections of the drag-and-drop documentation
* doc/lispref/frames.texi (Other Selections): Correct punctuation in one paragraph. (Drag and Drop): Rewrite last two sections for clarity.
-rw-r--r--doc/lispref/frames.texi174
1 files changed, 87 insertions, 87 deletions
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index 5e2fdf1231c..99493b59d71 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -4589,7 +4589,7 @@ non-@code{nil}, its return value must be a list of the form
4589@w{@code{(@var{key} @var{type} @var{value})}}. In this list, 4589@w{@code{(@var{key} @var{type} @var{value})}}. In this list,
4590@var{key} must be the name of the data being transferred, generally 4590@var{key} must be the name of the data being transferred, generally
4591that of a MIME type, for example @samp{"text/plain"}, and @var{type} 4591that of a MIME type, for example @samp{"text/plain"}, and @var{type}
4592is a symbol or a number designating the type of the data, thus also 4592is a symbol or a number designating the type of the data; thus also
4593governing the interpretation of @var{value}; following is a list of 4593governing the interpretation of @var{value}; following is a list of
4594valid data types and how each of them will cause @var{value} to be 4594valid data types and how each of them will cause @var{value} to be
4595interpreted. 4595interpreted.
@@ -4809,16 +4809,17 @@ selection name such as @code{UTF8_STRING}.
4809@cindex XDS 4809@cindex XDS
4810@cindex direct save protocol 4810@cindex direct save protocol
4811@vindex x-dnd-direct-save-function 4811@vindex x-dnd-direct-save-function
4812 When Emacs runs on the X window system, it supports the X Direct 4812 The X Direct Save (@acronym{XDS}) protocol enables programs to
4813Save (@acronym{XDS}) protocol, which allows users to save a file by 4813devolve responsibility for naming a dropped file file upon the
4814dragging and dropping it onto an Emacs window, such as a Dired window. 4814recipient. When such a drop transpires, DND handlers and the forgoing
4815To comply with the unique requirements of @acronym{XDS}, these 4815X-specific interface are largely circumvented, tasking a different
4816drag-and-drop requests are processed specially: instead of being 4816function with responding to the drop.
4817handled according to @code{x-dnd-types-alist}, they are handled by the 4817
4818@dfn{direct-save function} that is the value of the variable 4818@defvar x-dnd-direct-save-function
4819@code{x-dnd-direct-save-function}. The value should be a function of 4819This variable should be set to a function that registers and names
4820two arguments, @var{need-name} and @var{filename}. The @acronym{XDS} 4820files dropped using the @acronym{XDS} protocol in a two-step
4821protocol uses a two-step procedure for dragging files: 4821procedure. It is provided two arguments, @var{need-name} and
4822@var{filename}.
4822 4823
4823@enumerate 1 4824@enumerate 1
4824@item 4825@item
@@ -4846,8 +4847,9 @@ Dired should update the directory on display by showing the new file
4846there. 4847there.
4847@end enumerate 4848@end enumerate
4848 4849
4849The default value of @code{x-dnd-direct-save-function} is 4850Its default @code{x-dnd-direct-save-function} is
4850@code{x-dnd-save-direct}. 4851@code{x-dnd-save-direct}.
4852@end defvar
4851 4853
4852@defun x-dnd-save-direct need-name filename 4854@defun x-dnd-save-direct need-name filename
4853When called with the @var{need-name} argument non-@code{nil}, this 4855When called with the @var{need-name} argument non-@code{nil}, this
@@ -4873,48 +4875,47 @@ default directory.)
4873@end defun 4875@end defun
4874 4876
4875@cindex initiating drag-and-drop 4877@cindex initiating drag-and-drop
4876 On capable window systems, Emacs also supports dragging contents 4878 It is also possible to drag content from Emacs to other programs
4877from its frames to windows of other applications. 4879whenever this is supported for the current window-system. The
4880functions which provide for this are as follows:
4878 4881
4879@cindex drop target, in drag-and-drop operations 4882@cindex drop target, in drag-and-drop operations
4880@defun dnd-begin-text-drag text &optional frame action allow-same-frame 4883@defun dnd-begin-text-drag text &optional frame action allow-same-frame
4881This function begins dragging text from @var{frame} to another program 4884This function commences a drag-and-drop operation from @var{frame} to
4882(known as the @dfn{drop target}), and returns the result of 4885another program (dubbed the @dfn{drop target}), and returns when
4883drag-and-drop operation when the text is dropped or the drag-and-drop 4886@var{text} is dropped or the operation is canceled.
4884operation is canceled. @var{text} is the text that will be inserted
4885by the drop target.
4886 4887
4887@var{action} must be one of the symbols @code{copy} or @code{move}, 4888@var{action} must be one of the symbols @code{copy} or @code{move},
4888where @code{copy} means that @var{text} should be inserted by the drop 4889where @code{copy} means that @var{text} should be inserted by the drop
4889target, and @code{move} means the same as @code{copy}, but in addition 4890target, and @code{move} means the same as @code{copy}, but furthermore
4890the caller may have to delete @var{text} from its source as explained 4891enjoins the caller to delete @var{text} from its source as explained
4891below. 4892in the list below.
4892 4893
4893@var{frame} is the frame where the mouse is currently held down, or 4894@var{frame} is the frame where the mouse is currently held down, or
4894@code{nil}, which means to use the selected frame. This function may 4895@code{nil}, which means to use the selected frame. Since this
4895return immediately if no mouse buttons are held down, so it should be 4896function is liable to return promptly if no mouse buttons are held
4896only called immediately after a @code{down-mouse-1} or similar event 4897down, it should be only called in response to a @code{down-mouse-1} or
4897(@pxref{Mouse Events}), with @var{frame} set to the frame where that 4898analogous event (@pxref{Mouse Events}), with @var{frame} set to the
4898event was generated (@pxref{Click Events}). 4899frame where that event was generated (@pxref{Click Events}).
4899 4900
4900@var{allow-same-frame} specifies whether or not drops on top of 4901If @var{allow-same-frame} is @code{nil}, drops on top of @var{frame}
4901@var{frame} itself are to be ignored. 4902will be disregarded.
4902 4903
4903The return value specifies the action that the drop target actually 4904The return value reflects the action that the drop target actually
4904performed, and optionally what the caller should do. It can be one of 4905performed, and thus also what action, if any, the caller should in
4905the following symbols: 4906turn take. It is one of the following symbols:
4906 4907
4907@table @code 4908@table @code
4908@item copy 4909@item copy
4909The drop target inserted the dropped text. 4910The drop target inserted the dropped text.
4910 4911
4911@item move 4912@item move
4912The drop target inserted the dropped text, but in addition the caller 4913The drop target inserted the dropped text, and the caller should
4913should delete @var{text} from wherever it originated, such as its 4914delete @var{text} from the buffer where it was extracted from, if
4914buffer. 4915applicable.
4915 4916
4916@item private 4917@item private
4917The drop target performed some other unspecified action. 4918The drop target took some other unspecified action.
4918 4919
4919@item nil 4920@item nil
4920The drag-and-drop operation was canceled. 4921The drag-and-drop operation was canceled.
@@ -4923,11 +4924,12 @@ The drag-and-drop operation was canceled.
4923@end defun 4924@end defun
4924 4925
4925@defun dnd-begin-file-drag file &optional frame action allow-same-frame 4926@defun dnd-begin-file-drag file &optional frame action allow-same-frame
4926This function begins dragging @var{file} from @var{frame} to another 4927This function commences a drag-and-drop operation from @var{frame} to
4927program, and returns the result of the drag-and-drop operation when 4928another program (dubbed the @dfn{drop target}), and returns when
4928the file is dropped or the drag-and-drop operation is canceled. 4929@var{file} is dropped or the operation is canceled.
4929 4930
4930If @var{file} is a remote file, then a temporary copy will be made. 4931If @var{file} is a remote file, then a temporary local copy will be
4932made.
4931 4933
4932@var{action} must be one of the symbols @code{copy}, @code{move} or 4934@var{action} must be one of the symbols @code{copy}, @code{move} or
4933@code{link}, where @code{copy} means that @var{file} should be opened 4935@code{link}, where @code{copy} means that @var{file} should be opened
@@ -4936,11 +4938,11 @@ move the file to another location, and @code{link} means the drop
4936target should create a symbolic link to @var{file}. It is an error to 4938target should create a symbolic link to @var{file}. It is an error to
4937specify @code{link} as the action if @var{file} is a remote file. 4939specify @code{link} as the action if @var{file} is a remote file.
4938 4940
4939@var{frame} and @var{allow-same-frame} have the same meaning as in 4941@var{frame} and @var{allow-same-frame} mean the same as they do in
4940@code{dnd-begin-text-drag}. 4942calls to @code{dnd-begin-text-drag}.
4941 4943
4942The return value is the action that the drop target actually 4944The return value is the action that the drop target actually
4943performed, which can be one of the following symbols: 4945performed, which is one of the following symbols:
4944 4946
4945@table @code 4947@table @code
4946@item copy 4948@item copy
@@ -4969,19 +4971,18 @@ dropping multiple files, then the first file will be used instead.
4969@end defun 4971@end defun
4970 4972
4971@defun dnd-direct-save file name &optional frame allow-same-frame 4973@defun dnd-direct-save file name &optional frame allow-same-frame
4972This function is similar to @code{dnd-begin-file-drag} (with the 4974The behavior of this function is akin to that of
4973default action of copy), but instead of specifying the action you 4975@code{dnd-begin-file-drag} (when the default action @code{copy} is
4974specify the name of the copy created by the target program in 4976used), except that it accepts a name under which the copy is meant to
4975@code{name}. 4977be filed.
4976@end defun 4978@end defun
4977 4979
4978@cindex initiating drag-and-drop, low-level 4980@cindex initiating drag-and-drop, low-level
4979 The high-level interfaces described above are implemented on top of 4981 The high-level interfaces described above are implemented on top of
4980a lower-level primitive. If you need to drag content other than files 4982a lower-level primitive. The low-level interface @code{x-begin-drag}
4981or text, use the low-level interface @code{x-begin-drag} 4983is also available for dragging content besides text and files. It
4982instead. However, using it will require detailed knowledge of the 4984demands detailed knowledge of the data types and actions understood by
4983data types and actions used by the programs to transfer content via 4985programs on each platform its callers wish to support.
4984drag-and-drop on each platform you want to support.
4985 4986
4986@defun x-begin-drag targets &optional action frame return-frame allow-current-frame follow-tooltip 4987@defun x-begin-drag targets &optional action frame return-frame allow-current-frame follow-tooltip
4987This function begins a drag from @var{frame}, and returns when the 4988This function begins a drag from @var{frame}, and returns when the
@@ -4993,60 +4994,59 @@ non-@code{nil}. If no mouse buttons are held down when the
4993drag-and-drop operation begins, this function may immediately return 4994drag-and-drop operation begins, this function may immediately return
4994@code{nil}. 4995@code{nil}.
4995 4996
4996@var{targets} is a list of strings describing selection targets, much 4997@var{targets} is a list of strings representing selection targets,
4997like the @var{data-type} argument to @code{gui-get-selection}, that 4998much like the @var{data-type} argument to @code{gui-get-selection},
4998the drop target can request from Emacs (@pxref{Window System 4999that the drop target can request from Emacs (@pxref{Window System
4999Selections}). 5000Selections}).
5000 5001
5001@var{action} is a symbol describing the action recommended to the 5002@var{action} is a symbol designating the action recommended to the
5002target. It can either be @code{XdndActionCopy}, which 5003target. It can either be @code{XdndActionCopy} or
5003means to copy the contents of the selection @code{XdndSelection} to 5004@code{XdndActionMove}; both imply copying the contents of the
5004the drop target; or @code{XdndActionMove}, which means copy as with 5005selection @code{XdndSelection} to the drop target, but the latter
5005@code{XdndActionCopy}, and in addition the caller should delete 5006moreover conveys a promise to delete the contents of the selection
5006whatever was stored in that selection after copying it. 5007after the copying.
5007 5008
5008@var{action} may also be an alist which associates between symbols 5009@var{action} may also be an alist which associates between symbols
5009describing the available actions, and strings that the drop target is 5010representing available actions, and strings that the drop target
5010expected to present to the user to choose between the available 5011presents to the user for him to select between those actions.
5011actions.
5012 5012
5013If @var{return-frame} is non-@code{nil} and the mouse moves over an 5013If @var{return-frame} is non-@code{nil} and the mouse moves over an
5014Emacs frame after first moving out of @var{frame}, then the frame to 5014Emacs frame after first moving out of @var{frame}, then the frame to
5015which the mouse moves will be returned immediately. If 5015which the mouse moves will be returned immediately. If
5016@var{return-frame} is the symbol @code{now}, then any frame underneath 5016@var{return-frame} is the symbol @code{now}, then any frame beneath
5017the mouse pointer will be returned without waiting for the mouse to 5017the mouse pointer will be returned without waiting for the mouse to
5018first move out of @var{frame}. @var{return-frame} is useful when you 5018first move out of @var{frame}. @var{return-frame} is useful when you
5019want to treat dragging content from one frame to another specially, 5019want to treat dragging content from one frame to another specially,
5020while also being able to drag content to other programs, but it is not 5020while also dragging content to other programs, but it is not
5021guaranteed to work on all systems and with all window managers. 5021guaranteed to function on all systems and with all window managers.
5022 5022
5023If @var{follow-tooltip} is non-@code{nil}, the position of any tooltip 5023If @var{follow-tooltip} is non-@code{nil}, the position of any tooltip
5024(such as one shown by @code{tooltip-show}) will follow the location of 5024(such as one displayed by @code{tooltip-show}) will follow the
5025the mouse pointer whenever it moves during the drag-and-drop 5025location of the mouse pointer as it moves during the drag-and-drop
5026operation. The tooltip will be hidden once all mouse buttons are 5026operation. The tooltip will be hidden once all mouse buttons are
5027released. 5027released.
5028 5028
5029If the drop was rejected or no drop target was found, this function 5029If the drop was rejected or no drop target was found, this function
5030returns @code{nil}. Otherwise, it returns a symbol describing the 5030returns @code{nil}. Otherwise, it returns a symbol representing the
5031action the target chose to perform, which can differ from @var{action} 5031action the target opted to take, which can differ from @var{action} if
5032if that isn't supported by the drop target. @code{XdndActionPrivate} 5032that isn't supported by the drop target. @code{XdndActionPrivate} is
5033is also a valid return value in addition to @code{XdndActionCopy} and 5033also a valid return value in addition to @code{XdndActionCopy} and
5034@code{XdndActionMove}; it means that the drop target chose to perform 5034@code{XdndActionMove}; it suggests that the drop target opted for an
5035an unspecified action, and no further processing is required by the 5035indeterminate action, and no further action is required of the caller.
5036caller. 5036
5037 5037The caller must cooperate with the target to complete the action
5038The caller must cooperate with the target to fully perform the action 5038selected by the target. For example, callers should delete any buffer
5039chosen by the target. For example, callers should delete the buffer 5039text that was dragged if this function returns @code{XdndActionMove},
5040text that was dragged if this function returns @code{XdndActionMove}. 5040and likewise for other drag data where comparable criteria apply.
5041@end defun 5041@end defun
5042 5042
5043@cindex drag and drop protocols, X 5043@cindex drag and drop protocols, X
5044 5044
5045 On X Windows, several different drag-and-drop protocols are 5045 The function @code{x-begin-drag} leverages several drag-and-drop
5046supported by @code{x-begin-drag}. When dragging content that is known 5046protocols ``behind the scenes''. When dragging content that is known
5047to not be supported by a specific drag-and-drop protocol, it might be 5047to not be supported by a specific drag-and-drop protocol, that
5048desirable to turn that protocol off, by changing the values of the 5048protocol can be disabled by changing the values of the following
5049following variables: 5049variables:
5050 5050
5051@defvar x-dnd-disable-motif-protocol 5051@defvar x-dnd-disable-motif-protocol
5052When this is non-@code{nil}, the Motif drag and drop protocols are 5052When this is non-@code{nil}, the Motif drag and drop protocols are
@@ -5070,8 +5070,8 @@ events and the primary selection to insert the text if the drop target
5070doesn't support any drag-and-drop protocol at all. 5070doesn't support any drag-and-drop protocol at all.
5071 5071
5072A side effect is that Emacs will become the owner of the primary 5072A side effect is that Emacs will become the owner of the primary
5073selection upon such a drop. If that is not desired, then the drop 5073selection upon such a drop. Such emulation can be disabled by setting
5074emulation can be disabled by setting this variable to @code{nil}. 5074this variable to @code{nil}.
5075@end defvar 5075@end defvar
5076 5076
5077@node Color Names 5077@node Color Names