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

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

[nongnu] externals/caml 9d045e4 009/197: Corrections de Jacques sur sa v


From: Stefan Monnier
Subject: [nongnu] externals/caml 9d045e4 009/197: Corrections de Jacques sur sa version 1.05
Date: Sat, 21 Nov 2020 01:19:27 -0500 (EST)

branch: externals/caml
commit 9d045e44cbeb14e7a9d42911eb70fc7dd95db326
Author: Xavier Leroy <xavier.leroy@inria.fr>
Commit: Xavier Leroy <xavier.leroy@inria.fr>

    Corrections de Jacques sur sa version 1.05
    
    
    git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1648 
f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
---
 README  |  3 ++-
 caml.el | 92 ++++++++++++++++++++++++++++++++++++++++++++---------------------
 2 files changed, 65 insertions(+), 30 deletions(-)

diff --git a/README b/README
index 15c501e..b5f388a 100644
--- a/README
+++ b/README
@@ -59,7 +59,8 @@ Version 1.05:
   correctly even when you write them at the beginning of a line.
 
 * added a Caml menu, and Imenu support. Imenu menu can be disabled
-  by setting the variable caml-imenu-disable to t.
+  by setting the variable caml-imenu-disable to t. 
+  Xemacs support for the Menu, but no Imenu.
 
 * key bindings closer to lisp-mode.
 
diff --git a/caml.el b/caml.el
index 1e81a45..628ca97 100644
--- a/caml.el
+++ b/caml.el
@@ -246,6 +246,9 @@ have caml-electric-indent on, which see.")
 (defvar caml-shell-active nil
   "*Non nil when a subshell is running.")
 
+;; is it really ok ? Conform to Xemacs definition
+(if (not (boundp 'running-xemacs)) (setq running-xemacs nil))
+
 (defvar caml-mode-map nil
   "Keymap used in Caml mode.")
 (if caml-mode-map
@@ -280,29 +283,51 @@ have caml-electric-indent on, which see.")
   (define-key caml-mode-map "\M-\C-h" 'caml-mark-phrase)
   (define-key caml-mode-map "\M-\C-q" 'caml-indent-phrase)
   (define-key caml-mode-map "\M-\C-x" 'caml-eval-phrase)
-  (let ((map (make-sparse-keymap "Caml"))
-       (forms (make-sparse-keymap "Forms")))
-    (define-key caml-mode-map [menu-bar] (make-sparse-keymap))
-    (define-key caml-mode-map [menu-bar caml] (cons "Caml" map))
-    (define-key map [run-caml] '("Start subshell..." . run-caml))
-    (define-key map [compile] '("Compile..." . compile))
-    (define-key map [switch-view] '("Switch view" . caml-find-alternate-file))
-    (define-key map [separator-format] '("--"))
-    (define-key map [forms] (cons "Forms" forms))
-    (define-key map [show-subshell] '("Show subshell" . caml-show-subshell))
-    (put 'caml-show-subshell 'menu-enable 'caml-shell-active)
-    (define-key map [eval-phrase] '("Eval phrase" . caml-eval-phrase))
-    (put 'caml-eval-phrase 'menu-enable 'caml-shell-active)
-    (define-key map [indent-phrase] '("Indent phrase" . caml-indent-phrase))
-    (define-key forms [while]
-      '("while .. do .. done" . caml-insert-while-form))
-    (define-key forms [try] '("try .. with .." . caml-insert-try-form))
-    (define-key forms [match] '("match .. with .." . caml-insert-match-form))
-    (define-key forms [let] '("let .. in .." . caml-insert-let-form))
-    (define-key forms [if] '("if .. then .. else .." . caml-insert-if-form))
-    (define-key forms [begin] '("for .. do .. done" . caml-insert-for-form))
-    (define-key forms [begin] '("begin .. end" . caml-insert-begin-form))))
-
+  (if running-xemacs nil ; if not running xemacs
+    (let ((map (make-sparse-keymap "Caml"))
+         (forms (make-sparse-keymap "Forms")))
+      (define-key caml-mode-map [menu-bar] (make-sparse-keymap))
+      (define-key caml-mode-map [menu-bar caml] (cons "Caml" map))
+      (define-key map [run-caml] '("Start subshell..." . run-caml))
+      (define-key map [compile] '("Compile..." . compile))
+      (define-key map [switch-view]
+       '("Switch view" . caml-find-alternate-file))
+      (define-key map [separator-format] '("--"))
+      (define-key map [forms] (cons "Forms" forms))
+      (define-key map [show-subshell] '("Show subshell" . caml-show-subshell))
+      (put 'caml-show-subshell 'menu-enable 'caml-shell-active)
+      (define-key map [eval-phrase] '("Eval phrase" . caml-eval-phrase))
+      (put 'caml-eval-phrase 'menu-enable 'caml-shell-active)
+      (define-key map [indent-phrase] '("Indent phrase" . caml-indent-phrase))
+      (define-key forms [while]
+       '("while .. do .. done" . caml-insert-while-form))
+      (define-key forms [try] '("try .. with .." . caml-insert-try-form))
+      (define-key forms [match] '("match .. with .." . caml-insert-match-form))
+      (define-key forms [let] '("let .. in .." . caml-insert-let-form))
+      (define-key forms [if] '("if .. then .. else .." . caml-insert-if-form))
+      (define-key forms [begin] '("for .. do .. done" . caml-insert-for-form))
+      (define-key forms [begin] '("begin .. end" . caml-insert-begin-form)))))
+
+(defvar caml-mode-xemacs-menu
+  (if running-xemacs
+      '("Caml"
+       [ "Indent phrase" caml-indent-phrase :keys "C-M-q" ]
+       [ "Eval phrase" caml-eval-phrase
+         :active caml-shell-active :keys "C-M-x" ]
+       [ "Show subshell" caml-show-subshell caml-shell-active ]
+       ("Forms"
+        [ "while .. do .. done" caml-insert-while-form t]
+        [ "try .. with .." caml-insert-try-form t ]
+        [ "match .. with .." caml-insert-match-form t ]
+        [ "let .. in .." caml-insert-let-form t ]
+        [ "if .. then .. else .." caml-insert-if-form t ]
+        [ "for .. do .. done" caml-insert-for-form t ]
+        [ "begin .. end" caml-insert-begin-form t ])
+       "---"
+       [ "Switch view" caml-find-alternate t ]
+       [ "Compile..." compile t ]
+       [ "Start subshell..." run-caml t ]))
+  "Menu to add to the menubar when running Xemacs")
 
 (defvar caml-mode-syntax-table nil
   "Syntax table in use in Caml mode buffers.")
@@ -386,12 +411,21 @@ have caml-electric-indent on, which see.")
   (setq caml-last-comment-end (make-marker))
   ;garrigue 27-11-96
   (setq case-fold-search nil)
-  ;imenu support
-  (make-local-variable 'imenu-create-index-function)
-  (setq imenu-create-index-function 'caml-create-index-function)
-  (if caml-imenu-disable nil
-    (require 'imenu)
-    (imenu-add-to-menubar "Defs"))
+  ;garrigue july 97
+  (if running-xemacs ; from Xemacs lisp mode
+      (if (and (featurep 'menubar)
+              current-menubar)
+         (progn
+           ;; make a local copy of the menubar, so our modes don't
+           ;; change the global menubar
+           (set-buffer-menubar current-menubar)
+           (add-submenu nil caml-mode-xemacs-menu)))
+    ;imenu support (not for Xemacs)
+    (make-local-variable 'imenu-create-index-function)
+    (setq imenu-create-index-function 'caml-create-index-function)
+    (if caml-imenu-disable nil
+      (require 'imenu)
+      (imenu-add-to-menubar "Defs")))
   (run-hooks 'caml-mode-hook))
 
 ;;; Auxiliary function. Garrigue 96-11-01.



reply via email to

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