@@ -612,41 +612,32 @@ argument (lookup appropriate binary, setup logging, pass global settings)"
612
612
(kill-local-variable 'merlin-erroneous-buffer )))))
613
613
614
614
(defcustom merlin-stop-server-on-opam-switch t
615
- " If t, stop ocamlmerlin server before the opam switch changes.
616
- If `(opam-switch-mode)' is loaded and the user changes the opam
617
- switch using `opam-switch-set-switch' or an `\"OPSW\"' menu, this
618
- option asks to stop the merlin server process, so that the next
619
- merlin command starts a new server, typically with a different
620
- merlin version from a different opam switch.
621
-
622
- Based on the minor mode `opam-switch-mode' , see:
623
- https://github.com/ProofGeneral/opam-switch-mode
624
-
625
- Note: `(opam-switch-mode)' expects `merlin-command' to be `\"ocamlmerlin\"' ."
626
- :group 'merlin :type 'boolean )
627
-
628
- (defun merlin-stop-server-on-opam-switch ()
629
- " Stop ocamlmerlin before the opam switch changes.
615
+ " If t, stop the Merlin server before the opam switch changes.
616
+ If the user changes the opam switch using `opam-switch-set-switch'
617
+ or an `\"OPSW\"' menu from `opam-switch-mode' , this option asks to
618
+ stop the Merlin server process, so that the next Merlin command
619
+ starts a new server, typically with a different Merlin version
620
+ from a different opam switch.
621
+
622
+ See https://github.com/ProofGeneral/opam-switch-mode
623
+
624
+ Note: `opam-switch-mode' triggers automatic changes of `exec-path' ,
625
+ so to fully benefit from this feature, you should set `merlin-command'
626
+ to a basename, typically: `(setq merlin-command \" ocamlmerlin\" )'."
627
+ :type 'boolean )
628
+
629
+ (defun merlin--stop-server-on-opam-switch ()
630
+ " Stop the Merlin server before the opam switch changes.
630
631
This function is for the `opam-switch-mode' hook
631
632
`opam-switch-before-change-opam-switch-hook' , which runs just
632
- before the user changes the opam switch through
633
- `opam-switch-mode' .
634
-
635
- If `merlin-stop-server-on-opam-switch' is t, then the merlin
636
- server process is stopped, so that the next merlin command starts
637
- a new server, typically with a different merlin version from a
638
- different opam switch.
639
-
640
- Based on the minor mode `opam-switch-mode' , see:
641
- https://github.com/ProofGeneral/opam-switch-mode
642
-
643
- Note: `(opam-switch-mode)' expects `merlin-command' to be `\"ocamlmerlin\"' ."
633
+ before the user changes the opam switch through `opam-switch-mode' ."
644
634
(when (and merlin-mode merlin-stop-server-on-opam-switch)
645
- (condition-case sig
635
+ (condition-case _sig
646
636
(merlin-stop-server)
647
637
(t (message " Info: (merlin-stop-server) failed in the previous opam switch " )))))
648
638
649
- (add-hook 'opam-switch-before-change-opam-switch-hook #'merlin-stop-server-on-opam-switch t )
639
+ (add-hook 'opam-switch-before-change-opam-switch-hook
640
+ #'merlin--stop-server-on-opam-switch t )
650
641
651
642
; ;;;;;;;;;;;;;;;;;;;
652
643
; ; FILE SWITCHING ;;
0 commit comments