Refactor gpolonkai/goto-next-char for a bit more performance

This commit is contained in:
Gergely Polonkai 2023-10-15 07:04:24 +02:00
parent 3011905d2b
commit e66540149d
No known key found for this signature in database
GPG Key ID: 2D2885533B869ED4
1 changed files with 2 additions and 4 deletions

View File

@ -608,10 +608,8 @@ line first. Then jump to the actual end of the line."
#+begin_src emacs-lisp
(defun gpolonkai/goto-next-char (chr)
(interactive "c")
(let ((substr (char-to-string chr))
(end (save-excursion (end-of-line) (point))))
(when (search-forward substr end t)
(backward-char))))
(when (search-forward (char-to-string chr) (pos-eol) t)
(backward-char)))
#+end_src
*** Move to the beginning of the next word