On 17 Feb 2008, at 03:51, [EMAIL PROTECTED] wrote:

In particular, I'm looking for a clean way to propagate an error up to
the emacs user from within the C function; does anyone know of a way
to do this?  Just showing a string in the minibuffer that describes
the nature of the error, or raising an elisp exception (again, from C)
of some kind would be acceptable, I think.

That's easy:

 OSStatus status;

  BLOCK_INPUT;
#ifdef MAC_OSX
  status = FSPathMakeRef(SDATA(ENCODE_FILE(filename)), &fref, NULL);
#endif

...
    UNBLOCK_INPUT;
  if (status != noErr) {
    error ("Error while setting creator information.");
  }

In some cases you may really just want to return nil. For example if you take an optional argument specifying whether to switch to full screen or switch out of it (unconditionally, e.g. do-not-toggle):

  cCode = mac_get_code_from_arg(code, MAC_EMACS_CREATOR_CODE);

if (NILP(Ffile_exists_p(filename)) || ! NILP(Ffile_directory_p(filename))) {
    return Qnil;
  }
  return Qt;


Do not show a string  in the minibuffer - raise an error.

If you post your patch somewhere, people can give more feedback and try it out.


Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to