I would like to select the whole function by going to VISUAL mode and using $ to go to the last character and then going to the matching bracket with %. Doing this in NORMAL mode works fine, but when in VISUAL, it doesn’t. How can I fix this? Or, what should I check to fix this?

  • noooit@alien.topB
    link
    fedilink
    English
    arrow-up
    1
    ·
    11 months ago

    You can select in one go in GNU Emacs. You can bind this to some shortcut.

    (defun select-func-at-point ()
      (interactive)
      (let (bounds pos1 pos2 mything)
        (setf bounds (bounds-of-thing-at-point 'defun))
        (setf pos1 (car bounds))
        (setf pos2 (cdr bounds))
        (set-mark pos1)
        (goto-char pos2)))