emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/tuareg ccb9ee29ed 3/4: Merge commit '9f13e1fa673381abe81d0


From: ELPA Syncer
Subject: [nongnu] elpa/tuareg ccb9ee29ed 3/4: Merge commit '9f13e1fa673381abe81d0b4b60b03efb7036e586' into elpa/tuareg
Date: Wed, 13 Jul 2022 14:59:18 -0400 (EDT)

branch: elpa/tuareg
commit ccb9ee29edbf4fad1017b382b8e9d9d5fedec89c
Merge: 67ca0786aa 9f13e1fa67
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    Merge commit '9f13e1fa673381abe81d0b4b60b03efb7036e586' into elpa/tuareg
---
 tuareg.el | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/tuareg.el b/tuareg.el
index eac801a1ae..97fa0d921d 100644
--- a/tuareg.el
+++ b/tuareg.el
@@ -271,7 +271,6 @@ See `ff-other-file-alist'."
   :group 'tuareg
   :type 'boolean)
 
-
 (defcustom tuareg-interactive-scroll-to-bottom-on-output nil
   "Controls when to scroll to the bottom of the interactive buffer
 upon evaluating an expression.
@@ -3243,6 +3242,22 @@ file outside _build? "))
 
 (defvar compilation-error-screen-columns)
 
+(defun tuareg--other-file (filename)
+  "Given a FILENAME \"foo.ml\", return \"foo.mli\" if it exists.
+Return nil otherwise."
+  (when path
+    (let* ((ext (file-name-extension path))
+           (path-no-ext (file-name-sans-extension path))
+           (matching-exts
+            (cadr (assoc (format "\\.%s\\'" ext) tuareg-other-file-alist)))
+           (matching-paths
+            (mapcar (lambda (ext) (concat path-no-ext ext))
+                    matching-exts))
+           (paths (cl-remove-if-not #'file-exists-p matching-paths)))
+      (car paths))))
+
+
+
 ;;;###autoload
 (define-derived-mode tuareg-mode prog-mode "Tuareg"
   "Major mode for editing OCaml code.
@@ -3283,6 +3298,12 @@ Short cuts for the Tuareg mode:
 Short cuts for interactions with the REPL:
 \\{tuareg-interactive-mode-map}"
 
+  (setq mode-name
+        '(:eval
+          (let ((other-file (tuareg--other-file (buffer-file-name))))
+            (if other-file
+                (format "Tuareg[+%s]" (file-name-extension other-file))
+              "Tuareg"))))
   (unless (tuareg--switch-outside-build)
     ;; Initialize the Tuareg menu
     (tuareg-build-menu)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]