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

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

[nongnu] externals/caml 70cc99c 101/197: - Mouse navigation in a caml-he


From: Stefan Monnier
Subject: [nongnu] externals/caml 70cc99c 101/197: - Mouse navigation in a caml-help window does not open another window
Date: Sat, 21 Nov 2020 01:19:46 -0500 (EST)

branch: externals/caml
commit 70cc99c7cdf435d0c936107161d0c16fb4399b49
Author: Didier Rémy <Didier.Remy@inria.fr>
Commit: Didier Rémy <Didier.Remy@inria.fr>

     - 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
---
 caml-help.el | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/caml-help.el b/caml-help.el
index 75efff3..ea082bf 100644
--- a/caml-help.el
+++ b/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)))



reply via email to

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