Fork me on GitHub
#emacs
<
2019-10-31
>
macroz08:10:04

A question for the emacs gurus, why is it that forward-sexp is different in grep buffer vs. e.g. clojure-mode buffer? Former does not go over question mark in foobar?and latter does.

macroz08:10:35

it makes using wrgrep buffers and multiple cursors difficult in e.g. Clojure

macroz08:10:48

how would one go about and remedy this?

macroz08:10:30

emacs is telling me both keybinds point to the same forward-sexp function in lisp.el

macroz08:10:33

maybe different modes have different implementation of forward-sexp-function?

futuro19:11:21

Might be a different definition of word boundaries?

futuro19:11:36

Or sexp boundaries perhaps?

futuro19:11:05

Nvm, I see now that it was answered in channel

bozhidar09:10:06

Each major mode has its own notion of a sexp, that’s defined by its syntax table.

macroz10:10:41

I see that C-M-<right> is bound to forward-sexp in all the cases, I wonder how it ends up doing a different thing. I can see in clojure-mode.el the function that does a different thing but I can't see where forward-sexp-function is defined to be different

macroz10:10:00

clojure-mode.el is careful to use the original forward-sexp in its implementation and sets forward-sexp-function as nil. Is that only for safety and the real difference is actually in the syntax table?

macroz10:10:12

It's easy to jump to definition of forward-sexp but seems that e.g. xref-find-references doesn't find any. Google and GitHub search were most useful in this. I wonder if there is any "Emacs, please search every module you know for any reference of this"

macroz10:10:43

Thanks @bozhidar for the tip. Much appreciated! I made this small hack for myself

(add-hook 'grep-mode-hook (lambda () (set-syntax-table clojure-mode-syntax-table)))

bozhidar10:10:21

You’re welcome!