Skip to content

Commit aedb3be

Browse files
committed
Apply cargo fmt across textprop, editfns, navigation, misc_eval
Reformat lines touched by recent parity work (forward-word field constraint, beginning/end-of-line delegation, overlay hook replay, visible-portion check) so they match rustfmt output.
1 parent 649b900 commit aedb3be

4 files changed

Lines changed: 34 additions & 55 deletions

File tree

neovm-core/src/emacs_core/builtins/misc_eval.rs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,8 @@ pub(crate) fn builtin_next_char_property_change_in_buffers(
9494

9595
// GNU: temp = next-overlay-change(POS); if LIMIT < temp, temp = LIMIT;
9696
// return next-property-change(POS, nil, temp).
97-
let overlay_next = super::textprop::builtin_next_overlay_change_in_buffers(
98-
buffers,
99-
vec![args[0]],
100-
)?;
97+
let overlay_next =
98+
super::textprop::builtin_next_overlay_change_in_buffers(buffers, vec![args[0]])?;
10199
let mut temp = overlay_next;
102100
if let Some(limit) = args.get(1) {
103101
if !limit.is_nil() {
@@ -292,10 +290,8 @@ pub(crate) fn builtin_previous_char_property_change_in_buffers(
292290

293291
// GNU: temp = previous-overlay-change(POS); if LIMIT > temp, temp = LIMIT;
294292
// return previous-property-change(POS, nil, temp).
295-
let overlay_prev = super::textprop::builtin_previous_overlay_change_in_buffers(
296-
buffers,
297-
vec![args[0]],
298-
)?;
293+
let overlay_prev =
294+
super::textprop::builtin_previous_overlay_change_in_buffers(buffers, vec![args[0]])?;
299295
let mut temp = overlay_prev;
300296
if let Some(limit) = args.get(1) {
301297
if !limit.is_nil() {
@@ -307,10 +303,7 @@ pub(crate) fn builtin_previous_char_property_change_in_buffers(
307303
}
308304
}
309305
}
310-
builtin_previous_property_change_in_buffers(
311-
buffers,
312-
vec![args[0], Value::NIL, temp],
313-
)
306+
builtin_previous_property_change_in_buffers(buffers, vec![args[0], Value::NIL, temp])
314307
}
315308

316309
pub(crate) fn builtin_next_single_char_property_change(

neovm-core/src/emacs_core/editfns.rs

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -400,22 +400,18 @@ pub(crate) fn signal_after_change(
400400
/// `before-change-functions` is either nil or the well-known
401401
/// `(t syntax-ppss-flush-cache)` special case.
402402
fn combine_after_change_calls_active(ctx: &crate::emacs_core::eval::Context) -> bool {
403-
let combine_sym = crate::emacs_core::hook_runtime::hook_symbol_by_name(
404-
ctx,
405-
"combine-after-change-calls",
406-
);
407-
let combine_val = crate::emacs_core::hook_runtime::hook_value_by_id(ctx, combine_sym)
408-
.unwrap_or(Value::NIL);
403+
let combine_sym =
404+
crate::emacs_core::hook_runtime::hook_symbol_by_name(ctx, "combine-after-change-calls");
405+
let combine_val =
406+
crate::emacs_core::hook_runtime::hook_value_by_id(ctx, combine_sym).unwrap_or(Value::NIL);
409407
if combine_val.is_nil() {
410408
return false;
411409
}
412410

413-
let before_sym = crate::emacs_core::hook_runtime::hook_symbol_by_name(
414-
ctx,
415-
"before-change-functions",
416-
);
417-
let before_val = crate::emacs_core::hook_runtime::hook_value_by_id(ctx, before_sym)
418-
.unwrap_or(Value::NIL);
411+
let before_sym =
412+
crate::emacs_core::hook_runtime::hook_symbol_by_name(ctx, "before-change-functions");
413+
let before_val =
414+
crate::emacs_core::hook_runtime::hook_value_by_id(ctx, before_sym).unwrap_or(Value::NIL);
419415
if before_val.is_nil() {
420416
return true;
421417
}
@@ -515,12 +511,10 @@ pub(crate) fn execute_combined_after_change(
515511
ctx.combine_after_change_buffer = None;
516512

517513
// GNU temporarily clears `combine-after-change-calls` while replaying.
518-
let combine_sym = crate::emacs_core::hook_runtime::hook_symbol_by_name(
519-
ctx,
520-
"combine-after-change-calls",
521-
);
522-
let saved_combine = crate::emacs_core::hook_runtime::hook_value_by_id(ctx, combine_sym)
523-
.unwrap_or(Value::NIL);
514+
let combine_sym =
515+
crate::emacs_core::hook_runtime::hook_symbol_by_name(ctx, "combine-after-change-calls");
516+
let saved_combine =
517+
crate::emacs_core::hook_runtime::hook_value_by_id(ctx, combine_sym).unwrap_or(Value::NIL);
524518
let specpdl_count = ctx.specpdl.len();
525519
ctx.specbind(intern("combine-after-change-calls"), Value::NIL);
526520

neovm-core/src/emacs_core/navigation.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -425,10 +425,7 @@ pub(crate) fn builtin_eolp(ctx: &mut super::eval::Context, args: Vec<Value>) ->
425425
/// buffer's point after moving `n - 1` lines. Returns `(bol_charpos,
426426
/// orig_charpos, lines_moved)` mirroring GNU's static `bol` helper
427427
/// (editfns.c) plus the original PT used as anchor for field constraint.
428-
pub(crate) fn pos_bol_compute(
429-
ctx: &super::eval::Context,
430-
n: i64,
431-
) -> Result<(i64, i64, i64), Flow> {
428+
pub(crate) fn pos_bol_compute(ctx: &super::eval::Context, n: i64) -> Result<(i64, i64, i64), Flow> {
432429
let buf = current_buffer_in_manager(&ctx.buffers)?;
433430
let text = buffer_bytes(buf);
434431
let begv = buf.begv_byte;
@@ -452,10 +449,7 @@ pub(crate) fn pos_bol_compute(
452449
/// Compute the unconstrained end-of-line position for the current buffer's
453450
/// point after moving `n - 1` lines. Returns `(eol_charpos, orig_charpos)`,
454451
/// mirroring GNU's static `eol` helper (editfns.c).
455-
pub(crate) fn pos_eol_compute(
456-
ctx: &super::eval::Context,
457-
n: i64,
458-
) -> Result<(i64, i64), Flow> {
452+
pub(crate) fn pos_eol_compute(ctx: &super::eval::Context, n: i64) -> Result<(i64, i64), Flow> {
459453
let buf = current_buffer_in_manager(&ctx.buffers)?;
460454
let text = buffer_bytes(buf);
461455
let begv = buf.begv_byte;
@@ -624,8 +618,7 @@ pub(crate) fn builtin_beginning_of_line(
624618
// `SET_PT (XFIXNUM (Fline_beginning_position (n)))`. Delegate to our
625619
// line-beginning-position builtin so field constraints
626620
// (`Fconstrain_to_field`) apply uniformly.
627-
let constrained =
628-
builtin_line_beginning_position(eval, vec![Value::fixnum(n)])?;
621+
let constrained = builtin_line_beginning_position(eval, vec![Value::fixnum(n)])?;
629622
let target_char = match constrained.kind() {
630623
ValueKind::Fixnum(v) => v,
631624
_ => return Ok(Value::NIL),

neovm-core/src/emacs_core/textprop.rs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -522,12 +522,14 @@ fn verify_text_read_only_in_state(
522522
let Some(buf) = buffers.get(buf_id) else {
523523
return Ok(());
524524
};
525-
let inhibit = buf.get_buffer_local("inhibit-read-only").unwrap_or_else(|| {
526-
obarray
527-
.symbol_value("inhibit-read-only")
528-
.copied()
529-
.unwrap_or(Value::NIL)
530-
});
525+
let inhibit = buf
526+
.get_buffer_local("inhibit-read-only")
527+
.unwrap_or_else(|| {
528+
obarray
529+
.symbol_value("inhibit-read-only")
530+
.copied()
531+
.unwrap_or(Value::NIL)
532+
});
531533
// INTERVAL_GENERALLY_WRITABLE_P: when inhibit-read-only is non-nil
532534
// and not a list, every interval is writable regardless of its
533535
// read-only property. GNU intervals.h:210.
@@ -1048,8 +1050,7 @@ pub(crate) fn builtin_add_face_text_property_in_buffers(
10481050
seg_start = seg_end;
10491051
}
10501052
for (s, e, merged) in segments {
1051-
let _ =
1052-
buffers.put_buffer_text_property(buf_id, s, e, Value::symbol("face"), merged);
1053+
let _ = buffers.put_buffer_text_property(buf_id, s, e, Value::symbol("face"), merged);
10531054
}
10541055
Ok(Value::NIL)
10551056
}
@@ -2026,13 +2027,11 @@ pub(crate) fn builtin_overlays_at_in_buffers(
20262027
// whose `window` property is a window distinct from W are dropped.
20272028
if let Some(target_window_id) = sorted.as_window_id() {
20282029
let window_sym = Value::symbol("window");
2029-
ids.retain(|ov| {
2030-
match buf.overlays.overlay_get_named(*ov, window_sym) {
2031-
Some(prop) => prop
2032-
.as_window_id()
2033-
.is_none_or(|wid| wid == target_window_id),
2034-
None => true,
2035-
}
2030+
ids.retain(|ov| match buf.overlays.overlay_get_named(*ov, window_sym) {
2031+
Some(prop) => prop
2032+
.as_window_id()
2033+
.is_none_or(|wid| wid == target_window_id),
2034+
None => true,
20362035
});
20372036
}
20382037
buf.overlays.sort_overlay_ids_by_priority_desc(&mut ids);

0 commit comments

Comments
 (0)