Is there a way to tweak
thing-at-point symbol regexp, so that it ignore dots as separators? Right now
foo.bar in my Emacs is recognized as two different symbols, where I wish it was one.
To supplement what @phils said -
. have symbol-constituent syntax in the current syntax table, or in a copy of it.
Either define your own replacement function for
(defun my-thg-at-pt (thing &optional no-properties) "..." (let ((stab (copy-syntax-table))) (with-syntax-table stab (modify-syntax-entry ?. "_") (thing-at-point thing no-properties))))
or wrap whatever code calls
thing-at-point similarly. For instance, if you call some function
foo that you cannot modify, which calls
thing-at-point, then wrap your call to
(let ((stab (copy-syntax-table))) (with-syntax-table stab (modify-syntax-entry ?. "_") ... (foo)))
Of course, if
foo does other stuff, and some of that depends on
. NOT having symbol syntax, then wrapping all of
foo this way is too unfocused.
That's dependent on the syntax table for the buffer in question. In elisp, for instance,
foo.bar is treated as a single symbol.
You can specify that
. is symbol-constituent in the current buffer's syntax table with:
(modify-syntax-entry ?. "_")
Unless this is for a custom mode of your own devising, I would suggest that you try to establish if there is a sensible reason why
. was not already symbol-constituent.