You should have received a copy of the GNU General Public License
along with GNU Emacs; see the file COPYING. If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA. */
#include <config.h>
selection type with a scrap flavor type via `mac-ostype'. */
static Lisp_Object Qmac_scrap_name, Qmac_ostype;
+#ifdef MAC_OSX
/* Selection name for communication via Services menu. */
static Lisp_Object Vmac_services_selection;
+#endif
\f
/* Get a reference to the scrap corresponding to the symbol SYM. The
reference is set to *SCRAP, and it becomes NULL if there's no
err = GetScrapFlavorCount (scrap, &count);
if (err == noErr)
flavor_info = xmalloc (sizeof (ScrapFlavorInfo) * count);
- if (err == noErr && flavor_info)
+ if (flavor_info)
{
err = GetScrapFlavorInfoList (scrap, &count, flavor_info);
if (err != noErr)
flavor_info = NULL;
}
}
+ if (flavor_info == NULL)
+ count = 0;
#endif
for (rest = Vselection_converter_alist; CONSP (rest); rest = XCDR (rest))
{
value = call3 (handler_fn, selection_name,
type, selection_value);
- if (CONSP (value)
- && EQ (XCAR (value), type)
- && STRINGP (XCDR (value)))
+ if (STRINGP (value))
+ err = put_scrap_string (scrap, type, value);
+ else if (CONSP (value)
+ && EQ (XCAR (value), type)
+ && STRINGP (XCDR (value)))
err = put_scrap_string (scrap, type, XCDR (value));
}
hooks = Vx_lost_selection_functions;
selection_symbol = Fcar (Fcar (Vselection_alist));
- if (!EQ (hooks, Qunbound))
+ if (!EQ (hooks, Qunbound)
+ && !NILP (Fx_selection_owner_p (selection_symbol)))
{
for (; CONSP (hooks); hooks = Fcdr (hooks))
call1 (Fcar (hooks), selection_symbol);
hooks = Vx_lost_selection_functions;
selection_symbol = Fcar (Fcar (XCDR (rest)));
- if (!EQ (hooks, Qunbound))
+ if (!EQ (hooks, Qunbound)
+ && !NILP (Fx_selection_owner_p (selection_symbol)))
{
for (; CONSP (hooks); hooks = Fcdr (hooks))
call1 (Fcar (hooks), selection_symbol);
{
check_mac ();
CHECK_SYMBOL (selection_name);
- if (NILP (selection_value)) error ("selection-value may not be nil");
+ if (NILP (selection_value)) error ("SELECTION-VALUE may not be nil");
x_own_selection (selection_name, selection_value);
return selection_value;
}
DEFUN ("x-get-selection-internal", Fx_get_selection_internal,
Sx_get_selection_internal, 2, 3, 0,
- doc: /* Return text selected from some Mac window.
+ doc: /* Return text selected from some Mac application.
SELECTION is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'.
TYPE is the type of data desired, typically `STRING'.
TIME_STAMP is ignored on Mac. */)
- (selection_symbol, target_type, time_stamp)
+ (selection_symbol, target_type, time_stamp)
Lisp_Object selection_symbol, target_type, time_stamp;
{
Lisp_Object val = Qnil;
DEFUN ("x-selection-owner-p", Fx_selection_owner_p, Sx_selection_owner_p,
0, 1, 0,
- doc: /* Whether the current Emacs process owns the given Selection.
+ doc: /* Whether the current Emacs process owns the given SELECTION.
The arg should be the name of the selection in question, typically one of
the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'.
For convenience, the symbol nil is the same as `PRIMARY',
DEFUN ("x-selection-exists-p", Fx_selection_exists_p, Sx_selection_exists_p,
0, 1, 0,
- doc: /* Whether there is an owner for the given Selection.
+ doc: /* Whether there is an owner for the given SELECTION.
The arg should be the name of the selection in question, typically one of
the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'.
For convenience, the symbol nil is the same as `PRIMARY',
and the local selection value (whatever was given to `x-own-selection').
The function should return the value to send to the Scrap Manager
-\(a string). A return value of nil
+\(must be a string). A return value of nil
means that the conversion could not be done.
A return value which is the symbol `NULL'
means that a side-effect was executed,
set to nil. */);
Vnext_selection_coding_system = Qnil;
+#ifdef MAC_OSX
DEFVAR_LISP ("mac-services-selection", &Vmac_services_selection,
doc: /* Selection name for communication via Services menu. */);
- Vmac_services_selection = intern ("CLIPBOARD");
+ Vmac_services_selection = intern ("PRIMARY");
+#endif
QPRIMARY = intern ("PRIMARY"); staticpro (&QPRIMARY);
QSECONDARY = intern ("SECONDARY"); staticpro (&QSECONDARY);
Qmac_ostype = intern ("mac-ostype");
staticpro (&Qmac_ostype);
}
+
+/* arch-tag: f3c91ad8-99e0-4bd6-9eef-251b2f848732
+ (do not change this comment) */