[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] externals/caml 2c4bb06 100/197: - Fixes in caml-help:
From: |
Stefan Monnier |
Subject: |
[nongnu] externals/caml 2c4bb06 100/197: - Fixes in caml-help: |
Date: |
Sat, 21 Nov 2020 01:19:46 -0500 (EST) |
branch: externals/caml
commit 2c4bb065bd240fb616f112f5d2c6658e23eaed3e
Author: Didier Rémy <Didier.Remy@inria.fr>
Commit: Didier Rémy <Didier.Remy@inria.fr>
- Fixes in caml-help:
* a bug in ocaml-link-info
* keep buffer-modified-p unchanged by links activation.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5982
f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
---
caml-help.el | 82 ++++++++++++++++++++++++++++++++----------------------------
1 file changed, 44 insertions(+), 38 deletions(-)
diff --git a/caml-help.el b/caml-help.el
index d2a448b..75efff3 100644
--- a/caml-help.el
+++ b/caml-help.el
@@ -589,7 +589,7 @@ current buffer using \\[ocaml-qualified-identifier]."
(case-fold-search nil))
(goto-char (point-min))
(if (or (re-search-forward
- (concat "\\(val\\|exception\\|external\\|[|{;]\\) +"
+ (concat "\\(val\\|exception\\|type\\|external\\|[|{;]\\) +"
(regexp-quote entry))
(point-max) t)
(re-search-forward
@@ -597,7 +597,7 @@ current buffer using \\[ocaml-qualified-identifier]."
(point-max) t)
(progn
(if (window-live-p window) (select-window window))
- (error "Entry %S not found in module %S"
+ (error "Entry %s not found in module %s"
entry module))
;; (search-forward entry (point-max) t)
)
@@ -698,21 +698,22 @@ buffer positions."
(make-variable-buffer-local 'ocaml-links)
(defun ocaml-info-links (section)
- (if (and ocaml-links section (equal (car ocaml-links) section))
- (cdr ocaml-links)
- (save-excursion
- (goto-char (point-min))
- (let ((regexp (concat (if (equal major-mode 'Info-mode) "^ - " "^")
- ocaml-link-regexp))
- (all))
- (while (re-search-forward regexp (point-max) t)
- (setq all
- (cons (cons (match-string 4)
- (cons (match-beginning 4)
- (match-end 4)))
- all)))
- (setq ocaml-links (cons section all))
- ))))
+ (cdr
+ (if (and ocaml-links section (equal (car ocaml-links) section))
+ ocaml-links
+ (save-excursion
+ (goto-char (point-min))
+ (let ((regexp (concat (if (equal major-mode 'Info-mode) "^ - " "^")
+ ocaml-link-regexp))
+ (all))
+ (while (re-search-forward regexp (point-max) t)
+ (setq all
+ (cons (cons (match-string 4)
+ (cons (match-beginning 4)
+ (match-end 4)))
+ all)))
+ (setq ocaml-links (cons section all))
+ )))))
(defvar ocaml-link-map (make-sparse-keymap))
(define-key ocaml-link-map [mouse-2] 'ocaml-link-goto)
@@ -748,28 +749,33 @@ buffer positions."
(defun ocaml-link-activate (section)
- (if (cdr (ocaml-info-links section))
- (let ((regexp (concat "[^A-Za-z0-9'_]\\("
- ocaml-longident-regexp "\\|"
- (mapconcat 'car (cdr ocaml-links) "\\|")
- "\\)[^A-Za-z0-9'_]"))
- (case-fold-search nil))
- (goto-char (point-min))
- (unwind-protect
- (save-excursion
- (setq buffer-read-only nil)
- (goto-char (point-min))
- (while (re-search-forward regexp (point-max) t)
- (put-text-property (match-beginning 1) (match-end 1)
- 'mouse-face 'highlight)
- (put-text-property (match-beginning 1) (match-end 1)
- 'local-map ocaml-link-map)
- (if (x-display-color-p)
+ (let ((links (ocaml-info-links section)))
+ (if links
+ (let ((regexp (concat "[^A-Za-z0-9'_]\\("
+ ocaml-longident-regexp "\\|"
+ (mapconcat 'car links "\\|")
+ "\\)[^A-Za-z0-9'_]"))
+ (case-fold-search nil))
+ (goto-char (point-min))
+ (let ((buffer-read-only nil)
+ ;; use of dynamic scoping, need not be restored!
+ (modified-p (buffer-modified-p)))
+ (unwind-protect
+ (save-excursion
+ (goto-char (point-min))
+ (while (re-search-forward regexp (point-max) t)
+ (put-text-property (match-beginning 1) (match-end 1)
+ 'mouse-face 'highlight)
(put-text-property (match-beginning 1) (match-end 1)
- 'face 'ocaml-link-face)))
- )
- (setq buffer-read-only t))
- )))
+ 'local-map ocaml-link-map)
+ (if (x-display-color-p)
+ (put-text-property (match-beginning 1) (match-end 1)
+ 'face 'ocaml-link-face)))
+ )
+ ;; need to restore flag if buffer was unmodified.
+ (unless modified-p (set-buffer-modified-p nil))
+ ))
+ ))))
- [nongnu] externals/caml 02303ea 147/197: PR#5727: emacs caml-mode indents shebang line in toplevel scripts, (continued)
- [nongnu] externals/caml 02303ea 147/197: PR#5727: emacs caml-mode indents shebang line in toplevel scripts, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 2c3dbdb 157/197: merge branch 4.02 from 4.02.1 (rev 15540) to a few fixes after 4.02.2 (rev 16205), Stefan Monnier, 2020/11/21
- [nongnu] externals/caml ed94de1 159/197: simplify .gitignore; remove .ignore files and tools/setignore; adjust tools/check-typo, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 66c8274 050/197: run caml directly, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 6b7bd5d 073/197: changement .types -> .annot + format, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml eb43a39 074/197: - compile-command in caml.le, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 5732aaa 077/197: Changes to caml-types.el:, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml e913a93 090/197: compatibilite emacs 20 + fichiers read-only, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml d17e3c1 094/197: caml-types: mouse track + little things, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml eb696b8 098/197: commentaires, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 2c4bb06 100/197: - Fixes in caml-help:,
Stefan Monnier <=
- [nongnu] externals/caml 1527d9f 112/197: petit problem de doc, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 0e62e65 123/197: fixes bug 0005016--missing quote, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 70a5593 127/197: Undoing last commit by error., Stefan Monnier, 2020/11/21
- [nongnu] externals/caml d045fae 132/197: correct fontification for strings and comments, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml d9f8b96 136/197: PR#5403: give better error message when emacs is not found in PATH, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 49b5c47 138/197: More renaming to OCaml, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml d75ad35 139/197: Change "Ocaml" to "OCaml" everywhere, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml a7770e1 141/197: clean up TABs and whitespace, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 16dba2b 150/197: Merge short-paths into a fresh branch of trunk., Stefan Monnier, 2020/11/21
- [nongnu] externals/caml f5ba233 152/197: PR#5954 fix 'defface' use in emacs/caml-help.el (patched by 'zakkak'), Stefan Monnier, 2020/11/21