Skip to content

Unexpected behaviour in boon-find-char-* functions #147

Open

Description

@goderich

First of all, thank you for boon, it's truly a fantastic package, very well thought out!

I've only recently started using boon, so I apologize if I'm missing something. The functions boon-find-char-backward and boon-find-char-forward confused me somewhat. Namely, they won't move if I'm already on the same char.

Now I'm coming from Evil, so maybe this is intended, in which case I apologize. It seems more useful to me to modify the functions slightly, like so:

;;;###autoload
(defun boon-find-char-backward (char)
  "Move the cursor backwards, until finding an occurence of the character CHAR."
  (interactive "cType the character to find")
  (backward-char 1)  ; <- here
  (search-backward (make-string 1 char))
  (forward-char 1))

;;;###autoload
(defun boon-find-char-forward (char)
  "Find the given character (as CHAR), forwards."
  (interactive "cType the character to find")
  (forward-char 1) ; <- here
  (search-forward (make-string 1 char))
  (backward-char 1))

After all, when I'm already on the same char, chances are I want to find the next occurrence.

Thank you!

Activity

  1. 1256-bits commented on Feb 4, 2025

    @1256-bits

    boon-find-char is generally not very consistent because of how emacs cursor works. If you useboon-take-region with it then forward would act like dtCHAR in vim and backward would act like dfCHAR. I find avy-goto-word-1 and avy-goto-char a lot more useful. It suffers from the same problem but at least I can set precise position more easily. No ; and , mashing needed.

  2. goderich commented on Feb 12, 2025

    @goderich
    Author

    @1256-bits that is simply Emacs cursor behaviour differing from vim/evil. Boon rolls with Emacs, but someone coming from evil might understandably be confused. I disagree about it being inconsistent though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions