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!