]> git.eshelyaron.com Git - emacs.git/commitdiff
Prefer 'list (...)' to 'listn (N, ...)'
authorStefan Kangas <stefankangas@gmail.com>
Sun, 19 Jan 2025 03:25:52 +0000 (04:25 +0100)
committerEshel Yaron <me@eshelyaron.com>
Mon, 20 Jan 2025 15:57:08 +0000 (16:57 +0100)
* 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.

(cherry picked from commit 20c282ae331a5b71d7bae258ccdaa1e54490c3ef)

admin/coccinelle/listn.cocci [new file with mode: 0644]
src/androidfns.c
src/buffer.c
src/keyboard.c
src/window.c
src/xterm.c

diff --git a/admin/coccinelle/listn.cocci b/admin/coccinelle/listn.cocci
new file mode 100644 (file)
index 0000000..df1d6da
--- /dev/null
@@ -0,0 +1,7 @@
+// Prefer 'list (...)' to 'listn (N, ...)'
+@@
+constant n;
+@@
+- listn (n,
++ list (
+  ...)
index 9eb313faaf6c8856cab7a51adf992ac9d7a3c5d5..ac0f4882f601a685ffc36099b75dec47cd3fe32d 100644 (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));
 }
 
 \f
index 224d56e33dd58368973c6ef9f6c7cf1aaaf9a185..158ebbe0c30ba955d6068e1c809b31ddd395a064 100644 (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
index ff82499300eb4a8890bfc23bbd0a99d1df10a6e7..97bdef56c9d5d73b56602571499e07000480963b 100644 (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);
index d7e6cd00c99c8494d6b66b04aeb399679b7cfb02..38f5307cb684186df97c54e20e5a264e134a2cb5 100644 (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)
index 0692abbbb0bfce2264d99211b287325f1b8774d8..43788af59d0b74ce4ab7cfdbc194f9d86b7e059f 100644 (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;