Skip to content

Commit 012cd6e

Browse files
author
Damien Doligez
committed
petit nettoyage
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5734 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1 parent 056a57e commit 012cd6e

File tree

1 file changed

+13
-42
lines changed

1 file changed

+13
-42
lines changed

emacs/caml-types.el

Lines changed: 13 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,18 @@ For the moment, the only possible keyword is \"type\"."
5454
caml-types-number-re " "
5555
caml-types-number-re " "
5656
caml-types-number-re)))
57-
(setq caml-types-location-re
58-
(concat "^" caml-types-position-re " " caml-types-position-re)
59-
))
57+
(setq caml-types-location-re
58+
(concat "^" caml-types-position-re " " caml-types-position-re)))
59+
6060
(defvar caml-types-expr-ovl (make-overlay 1 1))
61-
(overlay-put caml-types-expr-ovl 'face 'region)
62-
(defvar caml-types-type-ovl (make-overlay 1 1))
63-
(overlay-put caml-types-type-ovl 'face 'region)
61+
62+
(make-face 'caml-types-face)
63+
(set-face-doc-string 'caml-types-face
64+
"face for hilighting expressions and types")
65+
(if (not (face-differs-from-default-p 'caml-types-face))
66+
(set-face-background 'caml-types-face "#88FF44"))
67+
68+
(overlay-put caml-types-expr-ovl 'face 'caml-types-face)
6469

6570
(defun caml-types-show-type (arg)
6671
"Show the type of expression or pattern at point.
@@ -104,36 +109,21 @@ See `caml-types-location-re' for annotation file format.
104109
(if (null loc)
105110
(progn
106111
(delete-overlay caml-types-expr-ovl)
107-
(delete-overlay caml-types-type-ovl)
108112
(message
109113
"Point is not within a typechecked expression or pattern.")
110-
(narrow-to-region 1 1)
111-
)
114+
(narrow-to-region 1 1))
112115
(let ((left (caml-types-get-pos target-buf (nth 0 loc) (nth 1 loc)))
113116
(right (caml-types-get-pos target-buf
114117
(nth 2 loc) (nth 3 loc))))
115118
(move-overlay caml-types-expr-ovl left right target-buf))
116119
;; not strictly correct
117120
(re-search-forward
118121
"^type(\n \\(\\([^\n)]\\|.)\\|\n[^)]\\)*\\)\n)")
119-
;; (move-overlay caml-types-type-ovl
120-
;; (match-beginning 1) (match-end 1)
121-
;; type-buf)
122122
(message (format "type: %s" (match-string 1)))
123-
(narrow-to-region (match-beginning 0) (match-end 0))
124-
; (set-mark (match-beginning 1))
125-
)))
123+
(narrow-to-region (match-beginning 1) (match-end 1)))))
126124
(if (and (= arg 4)
127125
(not (window-live-p (get-buffer-window type-buf))))
128126
(display-buffer type-buf))
129-
; (let
130-
; ((window (get-buffer-window type-buf))
131-
; (this-window (selected-window)))
132-
; (if window
133-
; (progn
134-
; (select-window window)
135-
; (goto-char (mark))
136-
; (select-window this-window))))
137127
(unwind-protect
138128
(sit-for 60)
139129
(delete-overlay caml-types-expr-ovl)))))
@@ -320,23 +310,4 @@ and its type is displayed in the minibuffer, until the move is released."
320310
(delete-overlay caml-types-expr-ovl))
321311
))
322312

323-
324-
325-
;; bindings
326-
327-
;; now in caml.el
328-
; (and
329-
; (boundp 'caml-mode-map)
330-
; (keymapp caml-mode-map)
331-
; (progn
332-
; (define-key caml-mode-map [?\C-c?\C-t] 'caml-types-show-type)
333-
; (define-key caml-mode-map [down-mouse-2] 'caml-types-explore)
334-
; (let ((map (lookup-key caml-mode-map [menu-bar caml])))
335-
; (and
336-
; (keymapp map)
337-
; (progn
338-
; (define-key map [separator-types] '("---"))
339-
; (define-key map [show-type]
340-
; '("Show type at point" . caml-types-show-type )))))))
341-
342313
(provide 'caml-types)

0 commit comments

Comments
 (0)