[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] externals/caml dbaedc7 086/197: added caml-emacs.el
From: |
Stefan Monnier |
Subject: |
[nongnu] externals/caml dbaedc7 086/197: added caml-emacs.el |
Date: |
Sat, 21 Nov 2020 01:19:43 -0500 (EST) |
branch: externals/caml
commit dbaedc7e5b80cee992140f5489aa97b6dd803481
Author: Didier Rémy <Didier.Remy@inria.fr>
Commit: Didier Rémy <Didier.Remy@inria.fr>
added caml-emacs.el
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5753
f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
---
caml-emacs.el | 15 +++++++++++++++
caml-help.el | 13 +++++++------
caml-types.el | 21 ++++++++++++---------
caml-xemacs.el | 17 ++++++++---------
4 files changed, 42 insertions(+), 24 deletions(-)
diff --git a/caml-emacs.el b/caml-emacs.el
new file mode 100644
index 0000000..aa35c7c
--- /dev/null
+++ b/caml-emacs.el
@@ -0,0 +1,15 @@
+;; for caml-help.el
+(defalias 'caml-info-other-window 'info-other-window)
+
+;; for caml-types.el
+
+(defalias 'caml-line-beginning-position 'line-beginning-position)
+
+(defun caml-event-window (e) (event-window (event-start e)))
+(defun caml-event-point-start (e) (posn-point (event-stact e)))
+(defun caml-event-point-end (e) (posn-point (event-end e)))
+(defmacro caml-track-mouse (el) (track-mouse el))
+(defalias 'caml-read-event 'read-event)
+(defun caml-mouse-movement-p mouse-mouvement)
+
+(provide 'caml-emacs)
diff --git a/caml-help.el b/caml-help.el
index f67ed1a..69e5b1c 100644
--- a/caml-help.el
+++ b/caml-help.el
@@ -27,8 +27,10 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(if (and (boundp 'running-xemacs) running-xemacs)
- (require 'caml-xemacs))
+(eval-and-compile
+ (if (and (boundp 'running-xemacs) running-xemacs)
+ (require 'caml-xemacs)
+ (require 'caml-emacs)))
;; Loading or building databases.
;;
@@ -566,7 +568,7 @@ current buffer using \\[ocaml-qualified-identifier]."
(let ((window (selected-window))
(info-section (assoc module (ocaml-info-alist))))
(if info-section
- (info-other-window (cdr info-section))
+ (caml-info-other-window (cdr info-section))
(ocaml-visible-modules)
(let* ((module-info
(or (assoc module (ocaml-module-alist))
@@ -717,9 +719,8 @@ buffer positions."
(defun ocaml-link-goto (click)
(interactive "e")
- (let* ((start (event-start click))
- (pos (posn-point start))
- (buf (window-buffer (posn-window start)))
+ (let* ((pos (caml-event-point-start click))
+ (buf (caml-event-window click))
(window (selected-window))
(link))
(setq link
diff --git a/caml-types.el b/caml-types.el
index 9cf3490..643125f 100644
--- a/caml-types.el
+++ b/caml-types.el
@@ -15,9 +15,11 @@
; An emacs-lisp complement to the "-dtypes" option of ocamlc and ocamlopt.
;; XEmacs compatibility
-(if (and (boundp 'running-xemacs) running-xemacs)
- (require 'caml-xemacs))
+(eval-and-compile
+ (if (and (boundp 'running-xemacs) running-xemacs)
+ (require 'caml-xemacs)
+ (require 'caml-emacs)))
(defvar caml-types-location-re nil "Regexp to parse *.annot files.
@@ -108,8 +110,9 @@ See `caml-types-location-re' for annotation file format.
(interactive "p")
(let* ((target-buf (current-buffer))
(target-file (file-name-nondirectory (buffer-file-name)))
- (target-line (1+ (count-lines (point-min) (line-beginning-position))))
- (target-bol (line-beginning-position))
+ (target-line (1+ (count-lines (point-min)
+ (caml-line-beginning-position))))
+ (target-bol (caml-line-beginning-position))
(target-cnum (point))
(type-file (concat (file-name-sans-extension (buffer-file-name))
".annot")))
@@ -362,7 +365,7 @@ See `caml-types-location-re' for annotation file format.
The expression under the mouse is highlighted
and its type is displayed in the minibuffer, until the move is released."
(interactive "e")
- (set-buffer (window-buffer (posn-window (event-start event))))
+ (set-buffer (window-buffer (caml-event-window event)))
(let* ((target-buf (current-buffer))
(target-file (file-name-nondirectory (buffer-file-name)))
(type-file (concat (file-name-sans-extension (buffer-file-name))
@@ -377,15 +380,15 @@ and its type is displayed in the minibuffer, until the
move is released."
(setq caml-types-buffer (get-buffer-create caml-types-buffer-name)))
; (message "Drag the mouse to explore types")
(unwind-protect
- (track-mouse
+ (caml-track-mouse
(while (and event
(integer-or-marker-p
- (setq cnum (posn-point (event-end event)))))
+ (setq cnum (caml-event-point-end event))))
(if (and limits (>= cnum (car limits)) (< cnum (cdr limits)))
(message mes)
(setq target-bol
(save-excursion (goto-char cnum)
- (line-beginning-position)))
+ (caml-line-beginning-position)))
(setq target-line
(1+ (count-lines (point-min) target-bol)))
(setq target-pos (vector target-file target-line target-bol
cnum))
@@ -411,7 +414,7 @@ and its type is displayed in the minibuffer, until the move
is released."
(message (format "type: %s" type))
(insert type)
))
- (setq event (read-event))
+ (setq event (caml-read-event))
(unless (mouse-movement-p event) (setq event nil))
)
)
diff --git a/caml-xemacs.el b/caml-xemacs.el
index 9c1aaa6..fae561c 100644
--- a/caml-xemacs.el
+++ b/caml-xemacs.el
@@ -1,20 +1,19 @@
(require 'overlay)
;; for caml-help.el
-(defun info-other-window (arg)
+(defun caml-info-other-window (arg)
(save-excursion (info arg))
(view-buffer-other-window "*info*"))
;; for caml-types.el
-(defun event-start (e) e)
-(defun event-end (e) e)
-(defun line-beginning-position ()
+(defun caml-line-beginning-position ()
(save-excursion (beginning-of-line) (point)))
-(defvar last-mouse-position t)
-(defun posn-point (e) (event-closest-point e))
-(defmacro track-mouse (el) (progn el))
-(defun read-event () (let ((e (next-event))) e))
+
+(defun caml-event-window (e) (event-window e))
+(defun caml-event-point-start (e) (event-closest-point e))
+(defun caml-event-point-end (e) (event-closest-point e))
+(defmacro caml-track-mouse (el) (progn el))
+(defalias 'caml-read-event 'next-event)
(defun mouse-movement-p (e) (equal (event-type e) 'motion))
-(defun posn-window (e) (event-window e))
(provide 'caml-xemacs)
- [nongnu] externals/caml 05d89fc 061/197: added menu entries for caml-help and caml-complete, (continued)
- [nongnu] externals/caml 05d89fc 061/197: added menu entries for caml-help and caml-complete, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml bf460c2 062/197: interactions bizarres de with, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml f45af82 063/197: - Fixed bugs + improved caml-help.el, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 5e6f8b6 071/197: value obsolete, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 9ece2ad 045/197: Remise au mode info HeVeA par default., Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 91865b8 055/197: simplify electric, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 5b4e4bc 068/197: verifier que le buffer est a jour, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 7c426ee 070/197: ajout -dtypes, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml bb1103a 075/197: Scrolling .annot, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml c834fac 085/197: caml-xemacs.el, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml dbaedc7 086/197: added caml-emacs.el,
Stefan Monnier <=
- [nongnu] externals/caml 2a6dc28 087/197: changed defmacro -> defalias, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml f751b4c 091/197: NOCOMPILE pour installer sans compiler (suggestion de Sven Luther), Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 0a4f815 093/197: Fix hilitghting of largest well-typed expr surrounding point., Stefan Monnier, 2020/11/21
- [nongnu] externals/caml b19dc86 092/197: pour que ca marche avec camlp4, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 6f9f060 096/197: caml-types:, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml bcd8c14 097/197: Retrait des messages de debugging..., Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 70cc99c 101/197: - Mouse navigation in a caml-help window does not open another window, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml ad3e9c2 105/197: Ajout de camldebug dans le menu Caml d'emacs., Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 92e4789 104/197: indentation of comments, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 111e6db 109/197: nettoyage, Stefan Monnier, 2020/11/21