Prefer 'list (...)' to 'listn (N, ...)'

* src/androidfns.c (Fandroid_query_battery):
* src/buffer.c (make_lispy_itree_node):
* src/keyboard.c (init_while_no_input_ignore_events):
* src/window.c (Fset_window_configuration):
* src/xterm.c (x_dnd_send_unsupported_drop): Prefer 'list (...)' to
'listn (N, ...)'.
* admin/coccinelle/listn.cocci: New file.
This commit is contained in:
Stefan Kangas 2025-01-19 04:25:52 +01:00
parent d5f99f4431
commit 20c282ae33
6 changed files with 43 additions and 37 deletions

View file

@ -0,0 +1,7 @@
// Prefer 'list (...)' to 'listn (N, ...)'
@@
constant n;
@@
- listn (n,
+ list (
...)

View file

@ -3219,14 +3219,14 @@ for more details about these values. */)
if (android_query_battery (&state))
return Qnil;
return listn (8, make_int (state.capacity),
make_fixnum (state.charge_counter),
make_int (state.current_average),
make_int (state.current_now),
make_fixnum (state.status),
make_int (state.remaining),
make_fixnum (state.plugged),
make_fixnum (state.temperature));
return list (make_int (state.capacity),
make_fixnum (state.charge_counter),
make_int (state.current_average),
make_int (state.current_now),
make_fixnum (state.status),
make_int (state.remaining),
make_fixnum (state.plugged),
make_fixnum (state.temperature));
}

View file

@ -5024,19 +5024,18 @@ defvar_per_buffer (struct Lisp_Buffer_Objfwd *bo_fwd, const char *namestring,
static Lisp_Object
make_lispy_itree_node (const struct itree_node *node)
{
return listn (12,
intern (":begin"),
make_fixnum (node->begin),
intern (":end"),
make_fixnum (node->end),
intern (":limit"),
make_fixnum (node->limit),
intern (":offset"),
make_fixnum (node->offset),
intern (":rear-advance"),
node->rear_advance ? Qt : Qnil,
intern (":front-advance"),
node->front_advance ? Qt : Qnil);
return list (intern (":begin"),
make_fixnum (node->begin),
intern (":end"),
make_fixnum (node->end),
intern (":limit"),
make_fixnum (node->limit),
intern (":offset"),
make_fixnum (node->offset),
intern (":rear-advance"),
node->rear_advance ? Qt : Qnil,
intern (":front-advance"),
node->front_advance ? Qt : Qnil);
}
static Lisp_Object

View file

@ -12789,10 +12789,10 @@ static const struct event_head head_table[] = {
static Lisp_Object
init_while_no_input_ignore_events (void)
{
Lisp_Object events = listn (9, Qselect_window, Qhelp_echo, Qmove_frame,
Qiconify_frame, Qmake_frame_visible,
Qfocus_in, Qfocus_out, Qconfig_changed_event,
Qselection_request);
Lisp_Object events = list (Qselect_window, Qhelp_echo, Qmove_frame,
Qiconify_frame, Qmake_frame_visible,
Qfocus_in, Qfocus_out, Qconfig_changed_event,
Qselection_request);
#ifdef HAVE_DBUS
events = Fcons (Qdbus_event, events);

View file

@ -7664,10 +7664,10 @@ the return value is nil. Otherwise the value is t. */)
w->start_at_line_beg = true;
if (FUNCTIONP (window_restore_killed_buffer_windows)
&& !MINI_WINDOW_P (w))
kept_windows = Fcons (listn (6, window, p->buffer,
Fmarker_last_position (p->start),
Fmarker_last_position (p->pointm),
p->dedicated, Qt),
kept_windows = Fcons (list (window, p->buffer,
Fmarker_last_position (p->start),
Fmarker_last_position (p->pointm),
p->dedicated, Qt),
kept_windows);
}
else if (!NILP (w->start))
@ -7689,10 +7689,10 @@ the return value is nil. Otherwise the value is t. */)
{
if (FUNCTIONP (window_restore_killed_buffer_windows))
kept_windows
= Fcons (listn (6, window, p->buffer,
Fmarker_last_position (p->start),
Fmarker_last_position (p->pointm),
p->dedicated, Qnil),
= Fcons (list (window, p->buffer,
Fmarker_last_position (p->start),
Fmarker_last_position (p->pointm),
p->dedicated, Qnil),
kept_windows);
else if (EQ (window_restore_killed_buffer_windows, Qdelete)
|| (!NILP (p->dedicated)

View file

@ -4121,10 +4121,10 @@ x_dnd_send_unsupported_drop (struct x_display_info *dpyinfo, Window target_windo
x_dnd_unsupported_drop_time = before;
x_dnd_unsupported_drop_window = target_window;
x_dnd_unsupported_drop_data
= listn (5, assq_no_quit (QXdndSelection,
dpyinfo->terminal->Vselection_alist),
targets, arg, make_fixnum (root_x),
make_fixnum (root_y));
= list (assq_no_quit (QXdndSelection,
dpyinfo->terminal->Vselection_alist),
targets, arg, make_fixnum (root_x),
make_fixnum (root_y));
x_dnd_waiting_for_finish = true;
x_dnd_finish_display = dpyinfo->display;