caml-types.el: Extract the feedback logic to a separate function.

This allows customization. The user just has to redefine the
caml-types-feedback.
master
nathan moreau 2016-04-17 03:49:36 +02:00 committed by Gabriel Scherer
parent 72c841b162
commit 5fa4e022c8
1 changed files with 9 additions and 12 deletions

View File

@ -21,6 +21,12 @@
(require 'caml-xemacs) (require 'caml-xemacs)
(require 'caml-emacs))) (require 'caml-emacs)))
(defun caml-types-feedback (info format)
"Displays INFO using the given FORMAT."
(message (format format info))
(with-current-buffer caml-types-buffer
(erase-buffer)
(insert info)))
(defvar caml-types-build-dirs '("_build" "_obuild") (defvar caml-types-build-dirs '("_build" "_obuild")
"List of possible compilation directories created by build systems. "List of possible compilation directories created by build systems.
@ -174,10 +180,7 @@ See `caml-types-location-re' for annotation file format."
(right (caml-types-get-pos target-buf (elt node 1))) (right (caml-types-get-pos target-buf (elt node 1)))
(type (cdr (assoc "type" (elt node 2))))) (type (cdr (assoc "type" (elt node 2)))))
(move-overlay caml-types-expr-ovl left right target-buf) (move-overlay caml-types-expr-ovl left right target-buf)
(with-current-buffer caml-types-buffer (caml-types-feedback type "type: %s")))))
(erase-buffer)
(insert type)
(message (format "type: %s" type)))))))
(if (and (= arg 4) (if (and (= arg 4)
(not (window-live-p (get-buffer-window caml-types-buffer)))) (not (window-live-p (get-buffer-window caml-types-buffer))))
(display-buffer caml-types-buffer)) (display-buffer caml-types-buffer))
@ -218,10 +221,7 @@ See `caml-types-location-re' for annotation file format."
(right (caml-types-get-pos target-buf (elt node 1))) (right (caml-types-get-pos target-buf (elt node 1)))
(kind (cdr (assoc "call" (elt node 2))))) (kind (cdr (assoc "call" (elt node 2)))))
(move-overlay caml-types-expr-ovl left right target-buf) (move-overlay caml-types-expr-ovl left right target-buf)
(with-current-buffer caml-types-buffer (caml-types-feedback kind)))))
(erase-buffer)
(insert kind)
(message (format "%s call" kind)))))))
(if (and (= arg 4) (if (and (= arg 4)
(not (window-live-p (get-buffer-window caml-types-buffer)))) (not (window-live-p (get-buffer-window caml-types-buffer))))
(display-buffer caml-types-buffer)) (display-buffer caml-types-buffer))
@ -316,10 +316,7 @@ See `caml-types-location-re' for annotation file format."
var-name l-line (- l-cnum l-bol)))))) var-name l-line (- l-cnum l-bol))))))
((string-match external-re kind) ((string-match external-re kind)
(let ((fullname (match-string 1 kind))) (let ((fullname (match-string 1 kind)))
(with-current-buffer caml-types-buffer (caml-types-feedback fullname "external ident: %s")))))))))
(erase-buffer)
(insert fullname)
(message (format "external ident: %s" fullname)))))))))))
(if (and (= arg 4) (if (and (= arg 4)
(not (window-live-p (get-buffer-window caml-types-buffer)))) (not (window-live-p (get-buffer-window caml-types-buffer))))
(display-buffer caml-types-buffer)) (display-buffer caml-types-buffer))