|
99 | 99 | (advice-add #'org-edit-special :around #'org-edit-latex--wrap-maybe)
|
100 | 100 | (advice-add #'org-edit-src-exit :around #'org-edit-latex--unwrap-maybe)
|
101 | 101 | (when org-edit-latex-show-hint
|
102 |
| - (add-hook 'post-command-hook #'org-edit-latex-smart-hint t t)) |
| 102 | + (setq-local eldoc-documentation-function 'org-edit-latex-hinter)) |
103 | 103 | (org-edit-latex-create-master-maybe)
|
104 | 104 | (add-hook 'org-src-mode-hook #'org-edit-latex--set-TeX-master))
|
105 | 105 | (advice-remove #'org-edit-special #'org-edit-latex--wrap-maybe)
|
106 | 106 | (advice-remove #'org-edit-src-exit #'org-edit-latex--unwrap-maybe)
|
107 |
| - (remove-hook 'post-command-hook #'org-edit-latex-smart-hint t) |
| 107 | + (setq-local eldoc-documentation-function 'org-eldoc-documentation-function) |
108 | 108 | (remove-hook 'org-src-mode-hook #'org-edit-latex--set-TeX-master)))
|
109 | 109 |
|
110 | 110 |
|
@@ -309,14 +309,19 @@ latex-environment."
|
309 | 309 | (apply oldfun args)))
|
310 | 310 | (apply oldfun args)))
|
311 | 311 |
|
312 |
| -;;;###autoload |
313 |
| -(defun org-edit-latex-smart-hint () |
314 |
| - "Show a hint message in echo-area when user is in LaTeX environment." |
315 |
| - (if (and (equal major-mode 'org-mode) |
316 |
| - (member (car (org-element-context)) |
317 |
| - '(latex-fragment latex-environment))) |
318 |
| - (message (substitute-command-keys |
319 |
| - "Enter edit buffer with `\\[org-edit-special]'.")))) |
| 312 | +(defun org-edit-latex-hinter () |
| 313 | + "An Eldoc documentation function used as a replacement of the |
| 314 | +default one in Org mode." |
| 315 | + (or (org-eldoc-documentation-function) |
| 316 | + (org-edit-latex-eldoc-function))) |
| 317 | + |
| 318 | +(defun org-edit-latex-eldoc-function () |
| 319 | + "Eldoc function used to generate a hint when cursor on latex." |
| 320 | + (let ((ele-type (org-element-type (org-element-context)))) |
| 321 | + (when (or (eq ele-type 'latex-fragment) |
| 322 | + (eq ele-type 'latex-environment)) |
| 323 | + (substitute-command-keys |
| 324 | + "Enter edit buffer with `\\[org-edit-special]'.")))) |
320 | 325 |
|
321 | 326 |
|
322 | 327 | (provide 'org-edit-latex)
|
|
0 commit comments