From e2ebb711aa3a47945c2c7ee2a0f0504669bc20f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Didier=20R=C3=A9my?= Date: Fri, 28 Nov 2003 20:14:15 +0000 Subject: - Mouse navigation in a caml-help window does not open another window git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5983 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02 --- emacs/caml-help.el | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'emacs') diff --git a/emacs/caml-help.el b/emacs/caml-help.el index 75efff332e..ea082bf242 100644 --- a/emacs/caml-help.el +++ b/emacs/caml-help.el @@ -560,7 +560,7 @@ command. An entry may be an info module or a complete file name." ;; Help function. -(defun ocaml-goto-help (&optional module entry) +(defun ocaml-goto-help (&optional module entry same-window) "Searches info manual for MODULE and ENTRY in MODULE. If unspecified, MODULE and ENTRY are inferred from the position in the current buffer using \\[ocaml-qualified-identifier]." @@ -578,9 +578,14 @@ current buffer using \\[ocaml-qualified-identifier]." (location (cdr (cadr module-info)))) (cond (location - (view-file-other-window - (concat location (ocaml-uncapitalize module) ".mli")) - (bury-buffer (current-buffer))) + (let ((file (concat location (ocaml-uncapitalize module) ".mli"))) + (if (window-live-p same-window) + (progn (select-window same-window) + (view-mode-exit view-return-to-alist view-exit-action)) + ;; (view-buffer (find-file-noselect file) 'view)) + ) + (view-file-other-window file) + (bury-buffer (current-buffer)))) (info-section (error "Aborted")) (t (error "No help for module %s" module)))) ) @@ -721,17 +726,19 @@ buffer positions." (defun ocaml-link-goto (click) (interactive "e") (let* ((pos (caml-event-point-start click)) - (buf (window-buffer (caml-event-window click))) + (win (caml-event-window click)) + (buf (window-buffer win)) (window (selected-window)) (link)) (setq link (with-current-buffer buf - (buffer-substring (previous-property-change - pos buf (- pos 100)) - (next-property-change - pos buf (+ pos 100))))) + (buffer-substring + (previous-single-property-change (+ pos 1) 'local-map + buf (- pos 100)) + (next-single-property-change pos 'local-map + buf (+ pos 100))))) (if (string-match (concat "^" ocaml-longident-regexp "$") link) - (ocaml-goto-help (match-string 1 link) (match-string 2 link)) + (ocaml-goto-help (match-string 1 link) (match-string 2 link) win) (if (not (equal (window-buffer window) buf)) (switch-to-buffer-other-window buf)) (if (setq link (assoc link (cdr ocaml-links))) -- cgit v1.2.1