emacs-mips-mode
emacs-mips-mode copied to clipboard
indent infinite loop in 1.2.0
What did you expect to happen?
I attempted to indent some copy & pasted MIPS code (e.g this). I expected lines to be indented according to the current mips-mode
column settings.
What actually happened?
I think a variable is never incremented and a space keeps getting added to the head of the line and I have to Ctrl+G out.
Describe your attempts to resolve the issue
mips-pad-rxg
internals from before the refactor in https://github.com/hlissner/emacs-mips-mode/commit/f35e0396a75cf7f80988fd827a45e56842c2c8bb seem to work.
I took that and modified it to contain an untabify call and also removed the progn from the else clause, but otherwise, it's the same thing.
(defun mips--pad-rxg (column group)
"Match a MIPS assembly statement using `mips-line-re'.
Will trim, pad, or backward-delete string segment in matching group GROUP until
COLUMN."
(string-match mips-line-re (mips-line))
(untabify (line-beginning-position) (line-end-position))
(when (wholenump (match-beginning group))
(move-to-column (match-beginning group))
(when (< (current-column) (match-end group))
(while (/= (current-column) column)
(if (< (current-column) column)
(insert mips-indent-character)
(if (member (preceding-char) mips-wp-char)
(delete-backward-char 1)
(message "Bumped into a wall at column %s!" (current-column))
(insert mips-indent-character) ;; pad one whitespace
(move-to-column column t) ;; and bail out forward.
(while (member (char-after) mips-wp-char)
(delete-forward-char 1))))))))
Steps to reproduce
- Copy & paste some MIPS code in a
mips-mode
buffer. - Select a region
- Press Tab to indent
Package commit
98795cdc81979821ac35d9f94ce354cd99780c67
System Information
No response
retabify after enabling the mips-mode is making my CPU go bonkers