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

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

[nongnu] elpa/tuareg d7c8618: Use lexical-binding everywhere. Remove XEm


From: ELPA Syncer
Subject: [nongnu] elpa/tuareg d7c8618: Use lexical-binding everywhere. Remove XEmacs support code
Date: Sat, 20 Mar 2021 12:57:11 -0400 (EDT)

branch: elpa/tuareg
commit d7c8618955bd461c5ffadbceecd6f4b5565a5f12
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    Use lexical-binding everywhere.  Remove XEmacs support code
    
    Also use #' to quote functions.
    New preliminary `tuareg-dune-mode`.
    
    * tuareg.el: Move the caml-mode `require`s to top-level.
    (tuareg-with-caml-mode-p): Test with `featurep` instead.
    (tuareg-mode-syntax-table): Drop XEmacs-only fallback code.
    (tuareg-mode-map): Move [?\C-c ?\C-\;] binding from top-level to the
    var's declaration.  Remove bindings to non-existing commands.
    (tuareg-interactive-mode, tuareg-build-menu):
    Remove XEmacs-only `easy-menu-add`.
    (tuareg-build-menu): Use `use-region-p`.
    
    * ocamldebug.el (ocamldebug-display-line): Don't bind the (presumed)
    XEmacs var `pre-display-buffer-function`.
    
    * tuareg-jbuild.el: Use lexical-binding.
    (verbose-tuareg-jbuild-smie-rules): Use `bound-and-true-p`.
    (tuareg-jbuild-build-menu): Remove XEmacs-only `easy-menu-add`.
    (tuareg-dune-mode): New major mode.
    (auto-mode-alist): Activate it for dune files.
    
    * tuareg-opam.el (tuareg-opam-error-face)
    (tuareg-opam-pkg-variable-name-face): Remove redundant `:group` args.
    (verbose-tuareg-opam-smie-rules): Use `bound-and-true-p`.
    (tuareg-opam-build-menu): Remove XEmacs-only `easy-menu-add`.
    (tuareg-opam-config-env): Remove spurious duplicate definition.
    
    * tuareg-site-file.el: Use lexical-binding.
---
 dot-emacs.el        |   7 +--
 ocamldebug.el       |  14 +++---
 tuareg-jbuild.el    |  43 ++++++++++-------
 tuareg-opam.el      |  27 +++--------
 tuareg-site-file.el |   6 +--
 tuareg.el           | 133 +++++++++++++++++++++++++---------------------------
 6 files changed, 107 insertions(+), 123 deletions(-)

diff --git a/dot-emacs.el b/dot-emacs.el
index 2a16dba..809011e 100644
--- a/dot-emacs.el
+++ b/dot-emacs.el
@@ -1,3 +1,4 @@
+;; -*- lexical-binding: t; -*-
 (require 'tuareg)
 
 ;; See README
@@ -22,8 +23,8 @@
 
 
 ;; Easy keys to navigate errors after compilation:
-(define-key tuareg-mode-map [(f12)] 'next-error)
-(define-key tuareg-mode-map [(shift f12)] 'previous-error)
+(define-key tuareg-mode-map [(f12)] #'next-error)
+(define-key tuareg-mode-map [(shift f12)] #'previous-error)
 
 
 ;; Use Merlin if available
@@ -32,7 +33,7 @@
   (add-to-list 'auto-mode-alist '("/\\.merlin\\'" . conf-mode))
 
   (when (functionp 'merlin-document)
-    (define-key tuareg-mode-map (kbd "\C-c\C-h") 'merlin-document))
+    (define-key tuareg-mode-map (kbd "\C-c\C-h") #'merlin-document))
 
   ;; Run Merlin if a .merlin file in the parent dirs is detected
   (add-hook 'tuareg-mode-hook
diff --git a/ocamldebug.el b/ocamldebug.el
index c055519..712cd87 100644
--- a/ocamldebug.el
+++ b/ocamldebug.el
@@ -102,13 +102,13 @@
 (defvar ocamldebug-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map "\C-c" ocamldebug-prefix-map)
-    (define-key map "\C-l" 'ocamldebug-refresh)
+    (define-key map "\C-l" #'ocamldebug-refresh)
     ;; This is already the default anyway!
     ;;(define-key map "\t" 'comint-dynamic-complete)
     (define-key map "\M-?"
       ;; FIXME: This binding is wrong since comint-dynamic-list-completions
       ;; is a function, not a command.
-      'comint-dynamic-list-completions)
+      #'comint-dynamic-list-completions)
     map))
 
 (define-derived-mode ocamldebug-mode comint-mode "OCaml-Debugger"
@@ -184,7 +184,7 @@ representation is simply concatenated with the COMMAND."
                (interactive "P")
                (ocamldebug-call ,name ,args
                                 (ocamldebug-numeric-arg arg))))
-       (define-key ocamldebug-prefix-map ,key ',fun))))
+       (define-key ocamldebug-prefix-map ,key #',fun))))
 
 (def-ocamldebug "step" "\C-s"  "Step one source line with display.")
 (def-ocamldebug "run"  "\C-r"  "Run the program.")
@@ -474,7 +474,7 @@ around point."
         nil
       ocamldebug-complete-list)))
 
-(define-key tuareg-mode-map "\C-x " 'ocamldebug-break)
+(define-key tuareg-mode-map "\C-x " #'ocamldebug-break)
 
 (defvar ocamldebug-command-name "ocamldebug"
   "Pathname for executing the OCaml debugger.")
@@ -521,7 +521,7 @@ the ocamldebug commands `cd DIR' and `directory'."
   (ocamldebug-set-buffer)))
 
 ;;;###autoload
-(defalias 'camldebug 'ocamldebug)
+(defalias 'camldebug #'ocamldebug)
 
 (defun ocamldebug-set-buffer ()
   (if (eq major-mode 'ocamldebug-mode)
@@ -669,9 +669,7 @@ Obeying it means displaying in another window the specified 
file and line."
 ;; Put the mark on this character in that buffer.
 
 (defun ocamldebug-display-line (true-file schar echar kind)
-  ;; FIXME: What is this pre-display-buffer-function?
-  (let* ((pre-display-buffer-function nil) ; screw it, put it all in one screen
-        (pop-up-windows t)
+  (let* ((pop-up-windows t)
         (buffer (find-file-noselect true-file))
         (window (display-buffer buffer t))
          (spos) (epos) (pos))
diff --git a/tuareg-jbuild.el b/tuareg-jbuild.el
index 038f858..e1630cb 100644
--- a/tuareg-jbuild.el
+++ b/tuareg-jbuild.el
@@ -1,4 +1,4 @@
-;;; tuareg-jbuild.el --- Mode for editing jbuild files   -*- coding: utf-8 -*-
+;;; tuareg-jbuild.el --- Mode for editing jbuild files   -*- lexical-binding: 
t; -*-
 
 ;; Copyright (C) 2017- Christophe Troestler
 
@@ -206,7 +206,7 @@
      "%s '%s'; sibling-p:%s parent:%s hanging:%s = %s"
      kind token
      (ignore-errors (smie-rule-sibling-p))
-     (ignore-errors smie--parent)
+     (bound-and-true-p smie--parent)
      (ignore-errors (smie-rule-hanging-p))
      value)
     value))
@@ -470,19 +470,19 @@ characters \\([0-9]+\\)-\\([0-9]+\\): +\\([^\n]*\\)$"
 
 (defvar tuareg-jbuild-mode-map
   (let ((map (make-sparse-keymap)))
-    (define-key map "\C-c\C-c" 'compile)
-    (define-key map "\C-c.v" 'tuareg-jbuild-insert-version-form)
-    (define-key map "\C-c.l" 'tuareg-jbuild-insert-library-form)
-    (define-key map "\C-c.e" 'tuareg-jbuild-insert-executable-form)
-    (define-key map "\C-c.x" 'tuareg-jbuild-insert-executables-form)
-    (define-key map "\C-c.r" 'tuareg-jbuild-insert-rule-form)
-    (define-key map "\C-c.p" 'tuareg-jbuild-insert-ocamllex-form)
-    (define-key map "\C-c.y" 'tuareg-jbuild-insert-ocamlyacc-form)
-    (define-key map "\C-c.m" 'tuareg-jbuild-insert-menhir-form)
-    (define-key map "\C-c.a" 'tuareg-jbuild-insert-alias-form)
-    (define-key map "\C-c.i" 'tuareg-jbuild-insert-install-form)
-    (define-key map "\C-c.c" 'tuareg-jbuild-insert-copyfiles-form)
-    (define-key map "\C-c.d" 'tuareg-jbuild-insert-documentation-form)
+    (define-key map "\C-c\C-c" #'compile)
+    (define-key map "\C-c.v" #'tuareg-jbuild-insert-version-form)
+    (define-key map "\C-c.l" #'tuareg-jbuild-insert-library-form)
+    (define-key map "\C-c.e" #'tuareg-jbuild-insert-executable-form)
+    (define-key map "\C-c.x" #'tuareg-jbuild-insert-executables-form)
+    (define-key map "\C-c.r" #'tuareg-jbuild-insert-rule-form)
+    (define-key map "\C-c.p" #'tuareg-jbuild-insert-ocamllex-form)
+    (define-key map "\C-c.y" #'tuareg-jbuild-insert-ocamlyacc-form)
+    (define-key map "\C-c.m" #'tuareg-jbuild-insert-menhir-form)
+    (define-key map "\C-c.a" #'tuareg-jbuild-insert-alias-form)
+    (define-key map "\C-c.i" #'tuareg-jbuild-insert-install-form)
+    (define-key map "\C-c.c" #'tuareg-jbuild-insert-copyfiles-form)
+    (define-key map "\C-c.d" #'tuareg-jbuild-insert-documentation-form)
     map)
   "Keymap used in Tuareg-jbuild mode.")
 
@@ -503,8 +503,7 @@ characters \\([0-9]+\\)-\\([0-9]+\\): +\\([^\n]*\\)$"
        ["alias" tuareg-jbuild-insert-alias-form t]
        ["install" tuareg-jbuild-insert-install-form t]
        ["copy_files" tuareg-jbuild-insert-copyfiles-form t]
-       )))
-  (easy-menu-add tuareg-jbuild-mode-menu))
+       ))))
 
 
 ;;;###autoload
@@ -526,10 +525,18 @@ characters \\([0-9]+\\)-\\([0-9]+\\): +\\([^\n]*\\)$"
   (tuareg-jbuild-build-menu)
   (run-mode-hooks 'tuareg-jbuild-mode-hook))
 
-
 ;;;###autoload
 (add-to-list 'auto-mode-alist
              '("\\(?:\\`\\|/\\)jbuild\\(?:\\.inc\\)?\\'" . tuareg-jbuild-mode))
 
+(define-derived-mode tuareg-dune-mode tuareg-jbuild-mode "Tuareg-Dune"
+  "Major mode to edit Dune files."
+  ;; FIXME: Actually adapt the above code to the new Dune syntax!
+  )
+
+;;;###autoload
+(add-to-list 'auto-mode-alist
+             '("\\(?:\\`\\|/\\)dune\\(\\|-workspace\\|-project\\)\\'"
+               . tuareg-dune-mode))
 
 (provide 'tuareg-jbuild-mode)
diff --git a/tuareg-opam.el b/tuareg-opam.el
index a5022fc..f4a12f1 100644
--- a/tuareg-opam.el
+++ b/tuareg-opam.el
@@ -29,7 +29,7 @@
 
 (defvar tuareg-opam-mode-map
   (let ((map (make-keymap)))
-    (define-key map "\C-j" 'newline-and-indent)
+    (define-key map "\C-j" #'newline-and-indent)
     map)
   "Keymap for tuareg-opam mode")
 
@@ -59,16 +59,14 @@
 
 (defface tuareg-opam-error-face
   '((t (:inherit error)))
-  "Face for constructs considered as errors (e.g. deprecated constructs)."
-  :group 'tuareg-opam)
+  "Face for constructs considered as errors (e.g. deprecated constructs).")
 
 (defvar tuareg-opam-error-face 'tuareg-opam-error-face
   "Face for constructs considered as errors (e.g. deprecated constructs).")
 
 (defface tuareg-opam-pkg-variable-name-face
   '((t (:inherit font-lock-variable-name-face :slant italic)))
-  "Face for package specific variables."
-  :group 'tuareg-opam)
+  "Face for package specific variables.")
 
 (defvar tuareg-opam-pkg-variable-name-face 'tuareg-opam-pkg-variable-name-face
   "Face for package specific variables.")
@@ -214,7 +212,7 @@ See `prettify-symbols-alist' for more information.")
      "%s '%s'; sibling-p:%s parent:%s prev-is-[:%s hanging:%s = %s"
      kind token
      (ignore-errors (smie-rule-sibling-p))
-     (ignore-errors smie--parent)
+     (bound-and-true-p smie--parent)
      (ignore-errors (smie-rule-prev-p "["))
      (ignore-errors (smie-rule-hanging-p))
      value)
@@ -293,7 +291,7 @@ characters \\([0-9]+\\)-\\([0-9]+\\): +\\([^\n]*\\)$"
 
 (defvar tuareg-opam-mode-map
   (let ((map (make-sparse-keymap)))
-    (define-key map "\C-c.o" 'tuareg-opam-insert-opam-form)
+    (define-key map "\C-c.o" #'tuareg-opam-insert-opam-form)
     map)
   "Keymap used in Tuareg-opam mode.")
 
@@ -302,8 +300,7 @@ characters \\([0-9]+\\)-\\([0-9]+\\): +\\([^\n]*\\)$"
     tuareg-opam-mode-menu  (list tuareg-opam-mode-map)
     "Tuareg-opam mode menu."
     '("OPAM"
-      ["Skeleton" tuareg-opam-insert-opam-form t]))
-  (easy-menu-add tuareg-opam-mode-menu))
+      ["Skeleton" tuareg-opam-insert-opam-form t])))
 
 
 ;;;###autoload
@@ -365,18 +362,6 @@ error message as a string)."
                                   nil shell-command-switch command))))))
     (if (= return-value 0) return-string nil)))
 
-(defun tuareg-opam-config-env (&optional switch)
-  "Get the opam environment for the given switch (or the default
-switch if none is provied) and return a list of lists of the
-form (n v) where n is the name of the environment variable and v
-its value (both being strings).  If opam is not found or the
-switch is not installed, `nil' is returned."
-  (let* ((switch (if switch (concat " --switch " switch)))
-        (get-env (concat tuareg-opam " config env --sexp" switch))
-        (opam-env (tuareg--shell-command-to-string get-env)))
-    (if opam-env
-       (car (read-from-string opam-env)))))
-
 (defun tuareg-opam-installed-compilers ()
   (let* ((cmd1 (concat tuareg-opam " switch list -i -s"))
          (cmd2 (concat tuareg-opam " switch list -s")); opam2
diff --git a/tuareg-site-file.el b/tuareg-site-file.el
index 99eddb0..51c42e6 100644
--- a/tuareg-site-file.el
+++ b/tuareg-site-file.el
@@ -1,4 +1,4 @@
-;;; tuareg-site-file.el --- Automatically extracted autoloads.
+;;; tuareg-site-file.el --- Automatically extracted autoloads.  -*- 
lexical-binding: t; -*-
 ;;; Code:
 (add-to-list 'load-path
              (or (file-name-directory load-file-name) (car load-path)))
@@ -15,7 +15,7 @@ the ocamldebug commands `cd DIR' and `directory'.
 
 \(fn PGM-PATH)" t nil)
 
-(defalias 'camldebug 'ocamldebug)
+(defalias 'camldebug #'ocamldebug)
 
 ;;;***
 
@@ -74,7 +74,7 @@ Run an OCaml REPL process.  I/O via buffer `*OCaml*'.
 
 \(fn)" t nil)
 
-(defalias 'run-ocaml 'tuareg-run-ocaml)
+(defalias 'run-ocaml #'tuareg-run-ocaml)
 
 (add-to-list 'interpreter-mode-alist '("ocamlrun" . tuareg-mode))
 
diff --git a/tuareg.el b/tuareg.el
index d53dd3c..6917f8a 100644
--- a/tuareg.el
+++ b/tuareg.el
@@ -1,6 +1,7 @@
 ;;; tuareg.el --- OCaml mode for Emacs.  -*- coding: utf-8; lexical-binding:t 
-*-
 
 ;; Copyright (C) 1997-2006 Albert Cohen, all rights reserved.
+;; Copyright (C) 2011-2021 Free Software Foundation, Inc.
 ;; Copyright (C) 2009-2010 Jane Street Holding, LLC.
 ;; Licensed under the GNU General Public License.
 
@@ -74,6 +75,8 @@
 (eval-when-compile (require 'cl-lib))
 (require 'easymenu)
 (require 'find-file)
+(require 'caml-help nil t)
+(require 'caml-types nil t)
 
 (defconst tuareg-mode-revision
   (eval-when-compile
@@ -123,7 +126,7 @@
 ;;                    Import types and help features
 
 (defvar tuareg-with-caml-mode-p
-  (and (require 'caml-types nil t) (require 'caml-help nil t)))
+  (and (featurep 'caml-types) (featurep 'caml-help)))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;                       User customizable variables
@@ -629,13 +632,8 @@ Regexp match data 0 points to the chars."
     (modify-syntax-entry ?\" "\"" st) ; " is a string delimiter
     (modify-syntax-entry ?\\ "\\" st)
     (modify-syntax-entry ?*  ". 23" st)
-    (condition-case nil
-        (progn
-          (modify-syntax-entry ?\( "()1n" st)
-          (modify-syntax-entry ?\) ")(4n" st))
-      (error               ;XEmacs signals an error instead of ignoring `n'.
-       (modify-syntax-entry ?\( "()1" st)
-       (modify-syntax-entry ?\) ")(4" st)))
+    (modify-syntax-entry ?\( "()1n" st)
+    (modify-syntax-entry ?\) ")(4n" st))
     st)
   "Syntax table in use in Tuareg mode buffers.")
 
@@ -1270,7 +1268,7 @@ This based on the fontification and is faster than 
calling `syntax-ppss'."
                   (put-text-property (point) (1+ (point)) 'face nil))))))
       nil)))
 
-(defun tuareg--pattern-vars-matcher (limit)
+(defun tuareg--pattern-vars-matcher (_limit)
   "Match a variable name after the point.
 If it succeeds, it moves the point after the variable name and set
 `match-data'.  See e.g., `font-lock-keywords'."
@@ -1321,50 +1319,51 @@ Run only once."
 
 (defvar tuareg-mode-map
   (let ((map (make-sparse-keymap)))
-    (define-key map "\M-q" 'tuareg-indent-phrase)
-    (define-key map "\C-c\C-q" 'tuareg-indent-phrase)
+    (define-key map "\M-q" #'tuareg-indent-phrase)
+    (define-key map [?\C-c ?\C-\;] #'tuareg-comment-dwim)
+    (define-key map "\C-c\C-q" #'tuareg-indent-phrase)
     ;; Don't bother: it's the global default anyway.
-    ;;(define-key map "\M-\C-\\" 'indent-region)
-    (define-key map "\C-c\C-a" 'tuareg-find-alternate-file)
-    (define-key map "\C-c\C-c" 'compile)
-    (define-key map "\C-c\C-w" 'tuareg-opam-update-env)
-    (define-key map "\C-xnd" 'tuareg-narrow-to-phrase)
-    (define-key map "\M-\C-x" 'tuareg-eval-phrase)
-    (define-key map "\C-x\C-e" 'tuareg-eval-phrase)
-    (define-key map "\C-c\C-e" 'tuareg-eval-phrase)
-    (define-key map "\C-c\C-r" 'tuareg-eval-region)
-    (define-key map "\C-c\C-b" 'tuareg-eval-buffer)
-    (define-key map "\C-c\C-s" 'tuareg-run-ocaml)
-    (define-key map "\C-c\C-i" 'tuareg-interrupt-ocaml)
-    (define-key map "\C-c\C-k" 'tuareg-kill-ocaml)
-    (define-key map "\C-c\C-n" 'tuareg-next-phrase)
-    (define-key map "\C-c\C-p" 'tuareg-previous-phrase)
-    (define-key map [(control c) (home)]
-      'tuareg-move-inside-module-or-class-opening)
-    (define-key map "\C-c`" 'tuareg-interactive-next-error-source)
-    (define-key map "\C-c?" 'tuareg-interactive-next-error-source)
-    (define-key map "\C-c.c" 'tuareg-insert-class-form)
-    (define-key map "\C-c.b" 'tuareg-insert-begin-form)
-    (define-key map "\C-c.f" 'tuareg-insert-for-form)
-    (define-key map "\C-c.w" 'tuareg-insert-while-form)
-    (define-key map "\C-c.i" 'tuareg-insert-if-form)
-    (define-key map "\C-c.l" 'tuareg-insert-let-form)
-    (define-key map "\C-c.m" 'tuareg-insert-match-form)
-    (define-key map "\C-c.t" 'tuareg-insert-try-form)
+    ;;(define-key map "\M-\C-\\" #'indent-region)
+    (define-key map "\C-c\C-a" #'tuareg-find-alternate-file)
+    (define-key map "\C-c\C-c" #'compile)
+    (define-key map "\C-c\C-w" #'tuareg-opam-update-env)
+    (define-key map "\C-xnd" #'tuareg-narrow-to-phrase)
+    (define-key map "\M-\C-x" #'tuareg-eval-phrase)
+    (define-key map "\C-x\C-e" #'tuareg-eval-phrase)
+    (define-key map "\C-c\C-e" #'tuareg-eval-phrase)
+    (define-key map "\C-c\C-r" #'tuareg-eval-region)
+    (define-key map "\C-c\C-b" #'tuareg-eval-buffer)
+    (define-key map "\C-c\C-s" #'tuareg-run-ocaml)
+    (define-key map "\C-c\C-i" #'tuareg-interrupt-ocaml)
+    (define-key map "\C-c\C-k" #'tuareg-kill-ocaml)
+    ;; (define-key map "\C-c\C-n" #'tuareg-next-phrase)
+    ;; (define-key map "\C-c\C-p" #'tuareg-previous-phrase)
+    ;; (define-key map [(control c) (home)]
+    ;;   #'tuareg-move-inside-module-or-class-opening)
+    (define-key map "\C-c`" #'tuareg-interactive-next-error-source)
+    (define-key map "\C-c?" #'tuareg-interactive-next-error-source)
+    (define-key map "\C-c.c" #'tuareg-insert-class-form)
+    (define-key map "\C-c.b" #'tuareg-insert-begin-form)
+    (define-key map "\C-c.f" #'tuareg-insert-for-form)
+    (define-key map "\C-c.w" #'tuareg-insert-while-form)
+    (define-key map "\C-c.i" #'tuareg-insert-if-form)
+    (define-key map "\C-c.l" #'tuareg-insert-let-form)
+    (define-key map "\C-c.m" #'tuareg-insert-match-form)
+    (define-key map "\C-c.t" #'tuareg-insert-try-form)
     (when tuareg-with-caml-mode-p
       ;; Trigger caml-types
-      (define-key map [?\C-c ?\C-t] 'caml-types-show-type)  ; "type"
-      (define-key map [?\C-c ?\C-f] 'caml-types-show-call)  ; "function"
-      (define-key map [?\C-c ?\C-l] 'caml-types-show-ident) ; "let"
+      (define-key map [?\C-c ?\C-t] #'caml-types-show-type)  ; "type"
+      (define-key map [?\C-c ?\C-f] #'caml-types-show-call)  ; "function"
+      (define-key map [?\C-c ?\C-l] #'caml-types-show-ident) ; "let"
       ;; To prevent misbehavior in case of error during exploration.
-      (define-key map [?\C-c mouse-1] 'caml-types-mouse-ignore)
-      (define-key map [?\C-c down-mouse-1] 'caml-types-explore)
+      (define-key map [?\C-c mouse-1] #'caml-types-mouse-ignore)
+      (define-key map [?\C-c down-mouse-1] #'caml-types-explore)
       ;; Trigger caml-help
-      (define-key map [?\C-c ?\C-i] 'ocaml-add-path)
-      (define-key map [?\C-c ?\[] 'ocaml-open-module)
-      (define-key map [?\C-c ?\]] 'ocaml-close-module)
-      (define-key map [?\C-c ?\C-h] 'caml-help)
-      (define-key map [?\C-c ?\t] 'tuareg-complete))
+      (define-key map [?\C-c ?\C-i] #'ocaml-add-path)
+      (define-key map [?\C-c ?\[] #'ocaml-open-module)
+      (define-key map [?\C-c ?\]] #'ocaml-close-module)
+      (define-key map [?\C-c ?\C-h] #'caml-help)
+      (define-key map [?\C-c ?\t] #'tuareg-complete))
     map)
   "Keymap used in Tuareg mode.")
 
@@ -2481,7 +2480,7 @@ See variable `beginning-of-defun-function'."
       fullname)))
 
 (define-obsolete-function-alias 'tuareg--beginning-of-phrase
-  'tuareg-backward-beginning-of-defun
+  #'tuareg-backward-beginning-of-defun
   "Apr 10, 2019")
 
 (defun tuareg-region-of-defun (&optional pos)
@@ -2660,12 +2659,10 @@ or indent all lines in the current phrase."
             (tuareg-comment-or-uncomment-region (line-beginning-position)
                                                 (line-end-position) arg)))))))
 
-(define-key tuareg-mode-map [?\C-c ?\C-\;] 'tuareg-comment-dwim)
-
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;                              The major mode
 
-(defalias 'tuareg-find-alternate-file 'ff-get-other-file)
+(defalias 'tuareg-find-alternate-file #'ff-get-other-file)
 
 (defun tuareg--switch-outside-build ()
   "If the current buffer refers to a file under a _build
@@ -2776,8 +2773,7 @@ expansion at run-time, if the run-time version of Emacs 
does know this macro."
 (define-derived-mode tuareg-mode prog-mode "Tuareg"
   "Major mode for editing OCaml code.
 
-Dedicated to Emacs and XEmacs, version 21 and higher.  Provides
-automatic indentation and compilation interface.  Performs font/color
+Provides automatic indentation and compilation interface.  Performs font/color
 highlighting using Font-Lock.  It is designed for OCaml but handles
 Caml Light as well.
 
@@ -3018,16 +3014,16 @@ lines? \\([0-9]+\\)-?\\([0-9]+\\)?\
 
 (defvar tuareg-interactive-mode-map
   (let ((map (copy-keymap comint-mode-map)))
-    (define-key map "\C-c\C-i" 'tuareg-interrupt-ocaml)
-    (define-key map "\C-c\C-k" 'tuareg-kill-ocaml)
-    (define-key map "\C-c`" 'tuareg-interactive-next-error-repl)
-    (define-key map "\C-c?" 'tuareg-interactive-next-error-repl)
-    (define-key map "\C-m" 'tuareg-interactive-send-input)
+    (define-key map "\C-c\C-i" #'tuareg-interrupt-ocaml)
+    (define-key map "\C-c\C-k" #'tuareg-kill-ocaml)
+    (define-key map "\C-c`" #'tuareg-interactive-next-error-repl)
+    (define-key map "\C-c?" #'tuareg-interactive-next-error-repl)
+    (define-key map "\C-m" #'tuareg-interactive-send-input)
     (define-key map [(shift return)]
-      'tuareg-interactive-send-input-end-of-phrase)
+      #'tuareg-interactive-send-input-end-of-phrase)
     (define-key map [(ctrl return)]
-      'tuareg-interactive-send-input-end-of-phrase)
-    (define-key map [kp-enter] 'tuareg-interactive-send-input-end-of-phrase)
+      #'tuareg-interactive-send-input-end-of-phrase)
+    (define-key map [kp-enter] #'tuareg-interactive-send-input-end-of-phrase)
     map))
 
 (defconst tuareg-interactive-buffer-name "*OCaml*")
@@ -3139,7 +3135,6 @@ Short cuts for interactions with the REPL:
             tuareg-interactive-error-font-lock)
     (font-lock-mode 1))
 
-  (easy-menu-add tuareg-interactive-mode-menu)
   (tuareg-update-options-menu))
 
 ;;;###autoload
@@ -3150,7 +3145,7 @@ Short cuts for interactions with the REPL:
   (display-buffer tuareg-interactive-buffer-name))
 
 ;;;###autoload
-(defalias 'run-ocaml 'tuareg-run-ocaml)
+(defalias 'run-ocaml #'tuareg-run-ocaml)
 
 ;;;###autoload
 (add-to-list 'interpreter-mode-alist '("ocamlrun" . tuareg-mode))
@@ -3254,7 +3249,7 @@ It is assumed that the range START-END delimit valid 
OCaml phrases."
         (tuareg-interactive--send-region start end)
       (message "The expression after the point is not well braced."))))
 
-(define-obsolete-function-alias 'tuareg-narrow-to-phrase 'narrow-to-defun
+(define-obsolete-function-alias 'tuareg-narrow-to-phrase #'narrow-to-defun
   "Apr 10, 2019")
 
 (defun tuareg-eval-phrase ()
@@ -3377,8 +3372,7 @@ Short cuts for interaction within the REPL:
       ["Kill OCaml REPL" tuareg-kill-ocaml
        :active (comint-check-proc tuareg-interactive-buffer-name)]
       ["Evaluate Region" tuareg-eval-region
-       ;; Region-active-p for XEmacs and mark-active for Emacs
-       :active mark-active]
+       :active (use-region-p)]
       ["Evaluate Phrase" tuareg-eval-phrase t]
       ["Evaluate Buffer" tuareg-eval-buffer t])
      ("OCaml Forms"
@@ -3420,7 +3414,6 @@ Short cuts for interaction within the REPL:
      ["About" tuareg-about t]
      ["Short Cuts" tuareg-short-cuts]
      ["Help" tuareg-help t]))
-  (easy-menu-add tuareg-mode-menu)
   (tuareg-update-options-menu))
 
 (defun tuareg-toggle-option (symbol)
@@ -3471,8 +3464,8 @@ Short cuts for interaction within the REPL:
 (defvar tuareg-library-mode-map
   (let ((map (make-keymap)))
     (suppress-keymap map)
-    (define-key map [return] 'tuareg-library-find-file)
-    (define-key map [mouse-2] 'tuareg-library-mouse-find-file)
+    (define-key map [return] #'tuareg-library-find-file)
+    (define-key map [mouse-2] #'tuareg-library-mouse-find-file)
     map))
 
 (defun tuareg-browse-library ()



reply via email to

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