Function: internal-copy-lisp-face

internal-copy-lisp-face is a function defined in xfaces.c.

Signature

(internal-copy-lisp-face FROM TO FRAME NEW-FRAME)

Documentation

Copy face FROM to TO.

If FRAME is t, copy the global face definition of FROM. Otherwise, copy the frame-local definition of FROM on FRAME. If NEW-FRAME is a frame, copy that data into the frame-local definition of TO on NEW-FRAME. If NEW-FRAME is nil, FRAME controls where the data is copied to.

The value is TO.

Source Code

// Defined in /usr/src/emacs/src/xfaces.c
{
  Lisp_Object lface, copy;
  struct frame *f;

  CHECK_SYMBOL (from);
  CHECK_SYMBOL (to);

  if (EQ (frame, Qt))
    {
      /* Copy global definition of FROM.  We don't make copies of
	 strings etc. because 20.2 didn't do it either.  */
      lface = lface_from_face_name (NULL, from, true);
      copy = Finternal_make_lisp_face (to, Qnil);
      f = NULL;
    }
  else
    {
      /* Copy frame-local definition of FROM.  */
      if (NILP (new_frame))
	new_frame = frame;
      CHECK_LIVE_FRAME (frame);
      CHECK_LIVE_FRAME (new_frame);
      lface = lface_from_face_name (XFRAME (frame), from, true);
      copy = Finternal_make_lisp_face (to, new_frame);
      f = XFRAME (new_frame);
    }

  vcopy (copy, 0, xvector_contents (lface), LFACE_VECTOR_SIZE);

  /* Changing a named face means that all realized faces depending on
     that face are invalid.  Since we cannot tell which realized faces
     depend on the face, make sure they are all removed.  This is done
     by setting face_change.  The next call to init_iterator will then
     free realized faces.  */
  if (NILP (Fget (to, Qface_no_inherit)))
    {
      if (f)
	{
	  f->face_change = true;
	  fset_redisplay (f);
	}
      else
	{
	  face_change = true;
	  windows_or_buffers_changed = 55;
	}
    }

  return to;
}