dotfiles icon indicating copy to clipboard operation
dotfiles copied to clipboard

`args-out-of-range` error

Open benthamite opened this issue 7 months ago • 0 comments

Aidermacs sometimes throws an args-out-of-range error:

Debugger entered--Lisp error: (args-out-of-range #<buffer *aidermacs:/Users/pablostafforini/.config/emacs-profiles/7.1.5/elpaca/repos/aidermacs/*> 4429 4428)
  buffer-substring-no-properties(4429 4428)
  aidermacs--fontify-block()
  aidermacs-fontify-blocks(#("\15        █░ Generating commit message with gemini/gemini-2.5-flash-preview-04-17\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10" 0 151 (field output)))
  comint-output-filter(#<process aidermacs<1>> #("\15        █░ Generating commit message with gemini/gemini-2.5-flash-preview-04-17\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10\10" 0 151 (field output)))

I'm not sure what's causing it, but in case it’s useful, Gemini suggests this fix:

-    (let ((new-content (buffer-substring-no-properties
-                        last-output-start
-                        aidermacs--syntax-block-end-pos))
-          (pos aidermacs--syntax-block-start-pos)
-          (font-pos 0)
-          fontified)
+    (let* ((start-pt last-output-start)
+           (end-pt aidermacs--syntax-block-end-pos)
+           (new-content (if (> start-pt end-pt)
+                            "" ; Prevent error if start is after end
+                          (buffer-substring-no-properties start-pt end-pt)))
+           (pos aidermacs--syntax-block-start-pos)
+           (font-pos 0)

benthamite avatar May 24 '25 22:05 benthamite