utop.el: Fix utop-tuareg-next-phrase for newer tuareg.el

tuareg--after-double-colon no longer exists in the latest rev of
Tuareg, which has received 110 additional commits since the last
release version on OPAM, so inline the old definition, which was
removed in commit 91ba1d6143558092a3920e9b5c49755c0c86caed of Tuareg.

tuareg--skip-double-colon was renamed to
tuareg--skip-double-semicolon, and also received a slight change.
Inline that as well since it's a private function.
This commit is contained in:
Brian Leung 2021-03-03 17:59:03 -08:00 committed by Perry E. Metzger
parent ac9c21cfcf
commit e5059d2e2f
1 changed files with 10 additions and 3 deletions

View File

@ -5,7 +5,7 @@
;; URL: https://github.com/diml/utop ;; URL: https://github.com/diml/utop
;; Licence: BSD3 ;; Licence: BSD3
;; Version: 1.11 ;; Version: 1.11
;; Package-Requires: ((emacs "24")) ;; Package-Requires: ((emacs "24") (tuareg "2.2.0"))
;; Keywords: ocaml languages ;; Keywords: ocaml languages
;; This file is a part of utop. ;; This file is a part of utop.
@ -20,6 +20,7 @@
(require 'easymenu) (require 'easymenu)
(require 'pcase) (require 'pcase)
(require 'tabulated-list) (require 'tabulated-list)
(require 'tuareg)
;; +-----------------------------------------------------------------+ ;; +-----------------------------------------------------------------+
;; | License | ;; | License |
@ -269,12 +270,18 @@ modes you need to set these variables:
(defun utop-tuareg-next-phrase () (defun utop-tuareg-next-phrase ()
"Move to the next phrase after point." "Move to the next phrase after point."
(let* ((pos (tuareg--after-double-colon)) (let* ((pos (save-excursion
(when (looking-at-p "[;[:blank:]]*$")
(skip-chars-backward ";[:blank:]")
(when (> (point) 1)
(- (point) 1)))))
(pos (if pos pos (point))) (pos (if pos pos (point)))
(phrase (tuareg-discover-phrase pos))) (phrase (tuareg-discover-phrase pos)))
(when phrase (when phrase
(goto-char (caddr phrase)) (goto-char (caddr phrase))
(tuareg--skip-double-colon) (tuareg-skip-blank-and-comments)
(when (looking-at ";;[ \t\n]*")
(goto-char (match-end 0)))
(tuareg-skip-blank-and-comments)))) (tuareg-skip-blank-and-comments))))
(defun utop-compat-next-phrase-beginning () (defun utop-compat-next-phrase-beginning ()