ocaml / tuareg

Emacs OCaml mode
GNU General Public License v3.0
362 stars 79 forks source link

tuareg-current-fun-name returns inaccurate results, breaking which-function-mode #306

Open catern opened 1 year ago

catern commented 1 year ago

tuareg-current-fun-name is buggy:

let f = 1

gives me f.f.f

let f = 1

let g = 1

gives me f.f.g

There are various other bugs.

Since add-log-current-defun-function is set to tuareg-current-fun-name, which-function-mode displays ugly, wrong results.

As a result, I'm using the following configuration to disable the use of tuareg-current-fun-name:

(setq-local add-log-current-defun-function nil)
(setq-local add-log-current-defun-header-regexp (rx unmatchable))

which causes which-function-mode to fall back to using imenu, which for me is populated by merlin, and is much more accurate and nice.