Function: lossage-size

lossage-size is an interactive function defined in keyboard.c.

Signature

(lossage-size &optional ARG)

Documentation

Return or set the maximum number of keystrokes to save.

If called with a non-nil ARG, set the limit to ARG and return it. Otherwise, return the current limit.

The saved keystrokes are shown by view-lossage.

View in manual

Probably introduced at or before Emacs version 28.1.

Key Bindings

Source Code

// Defined in /usr/src/emacs/src/keyboard.c
{
  if (NILP(arg))
    return make_fixnum (lossage_limit);

  if (!FIXNATP (arg))
    user_error ("Value must be a positive integer");
  ptrdiff_t osize = ASIZE (recent_keys);
  eassert (lossage_limit == osize);
  int min_size = MIN_NUM_RECENT_KEYS;
  EMACS_INT new_size = XFIXNAT (arg);

  if (new_size == osize)
    return make_fixnum (lossage_limit);

  if (new_size < min_size)
    {
      AUTO_STRING (fmt, "Value must be >= %d");
      Fsignal (Quser_error, list1 (CALLN (Fformat, fmt, make_fixnum (min_size))));
    }
  if (new_size > MAX_NUM_RECENT_KEYS)
    {
      AUTO_STRING (fmt, "Value must be <= %d");
      Fsignal (Quser_error, list1 (CALLN (Fformat, fmt,
					  make_fixnum (MAX_NUM_RECENT_KEYS))));
    }

  int kept_keys = new_size > osize ? total_keys : min (new_size, total_keys);
  update_recent_keys (new_size, kept_keys);

  return make_fixnum (lossage_limit);
}