[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] externals/caml 71d36c5 143/197: PR#4994: ocaml-mode doesn't wor
From: |
Stefan Monnier |
Subject: |
[nongnu] externals/caml 71d36c5 143/197: PR#4994: ocaml-mode doesn't work with xemacs21 |
Date: |
Sat, 21 Nov 2020 01:19:55 -0500 (EST) |
branch: externals/caml
commit 71d36c5789d0809f00de66a8c3c0be501b84fe9e
Author: Damien Doligez <damien.doligez-inria.fr>
Commit: Damien Doligez <damien.doligez-inria.fr>
PR#4994: ocaml-mode doesn't work with xemacs21
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12840
f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
---
Makefile | 2 +-
caml.el | 64 +++++++++++++++++++++++++++++++++++++++-------------------------
2 files changed, 40 insertions(+), 26 deletions(-)
diff --git a/Makefile b/Makefile
index 6475be9..957a9fa 100644
--- a/Makefile
+++ b/Makefile
@@ -80,4 +80,4 @@ compile-only:
$(EMACS) --batch --eval '$(COMPILECMD)'
clean:
- rm -f ocamltags *~ #*# *.elc
+ rm -f ocamltags *~ \#*# *.elc
diff --git a/caml.el b/caml.el
index d1127f7..9ec3966 100644
--- a/caml.el
+++ b/caml.el
@@ -407,26 +407,27 @@ have caml-electric-indent on, which see.")
"Syntax table in use in Caml mode buffers.")
(if caml-mode-syntax-table
()
- (setq caml-mode-syntax-table (make-syntax-table))
- ; backslash is an escape sequence
- (modify-syntax-entry ?\\ "\\" caml-mode-syntax-table)
- ; ( is first character of comment start
- (modify-syntax-entry ?\( "()1n" caml-mode-syntax-table)
- ; * is second character of comment start,
- ; and first character of comment end
- (modify-syntax-entry ?* ". 23n" caml-mode-syntax-table)
- ; ) is last character of comment end
- (modify-syntax-entry ?\) ")(4" caml-mode-syntax-table)
- ; backquote was a string-like delimiter (for character literals)
- ; (modify-syntax-entry ?` "\"" caml-mode-syntax-table)
- ; quote and underscore are part of words
- (modify-syntax-entry ?' "w" caml-mode-syntax-table)
- (modify-syntax-entry ?_ "w" caml-mode-syntax-table)
- ; ISO-latin accented letters and EUC kanjis are part of words
- (let ((i 160))
- (while (< i 256)
- (modify-syntax-entry i "w" caml-mode-syntax-table)
- (setq i (1+ i)))))
+ (let ((n (if (string-match "XEmacs" (emacs-version)) "" "n")))
+ (setq caml-mode-syntax-table (make-syntax-table))
+ ; backslash is an escape sequence
+ (modify-syntax-entry ?\\ "\\" caml-mode-syntax-table)
+ ; ( is first character of comment start
+ (modify-syntax-entry ?\( (concat "()1" n) caml-mode-syntax-table)
+ ; * is second character of comment start,
+ ; and first character of comment end
+ (modify-syntax-entry ?* (concat ". 23" n) caml-mode-syntax-table)
+ ; ) is last character of comment end
+ (modify-syntax-entry ?\) ")(4" caml-mode-syntax-table)
+ ; backquote was a string-like delimiter (for character literals)
+ ; (modify-syntax-entry ?` "\"" caml-mode-syntax-table)
+ ; quote and underscore are part of words
+ (modify-syntax-entry ?' "w" caml-mode-syntax-table)
+ (modify-syntax-entry ?_ "w" caml-mode-syntax-table)
+ ; ISO-latin accented letters and EUC kanjis are part of words
+ (let ((i 160))
+ (while (< i 256)
+ (modify-syntax-entry i "w" caml-mode-syntax-table)
+ (setq i (1+ i))))))
(defvar caml-mode-abbrev-table nil
"Abbrev table used for Caml mode buffers.")
@@ -794,12 +795,25 @@ variable caml-mode-indentation."
"^[ A-\377]+ \"\\([^\"\n]+\\)\", [A-\377]+ \\([0-9]+\\)[-,:]"
"Regular expression matching the error messages produced by camlc.")
+;; Newer emacs versions support line/char ranges
+;; We will adapt OCaml to output error messages in a compatible format.
+;; In the meantime we add the new format here in addition to the old one.
+(defconst caml-error-regexp-newstyle
+ "^File \"\\([^\"\n]+\\)\", line \\([0-9]+\\), char \\([0-9]+\\) to line
\\([0-9]+\\), char \\([0-9]+\\):"
+ "Regular expression matching the error messages produced by
ocamlc/ocamlopt.")
+
(if (boundp 'compilation-error-regexp-alist)
- (or (assoc caml-error-regexp
- compilation-error-regexp-alist)
- (setq compilation-error-regexp-alist
- (cons (list caml-error-regexp 1 2)
- compilation-error-regexp-alist))))
+ (progn
+ (or (assoc caml-error-regexp
+ compilation-error-regexp-alist)
+ (setq compilation-error-regexp-alist
+ (cons (list caml-error-regexp 1 2)
+ compilation-error-regexp-alist)))
+ (or (assoc caml-error-regexp-newstyle
+ compilation-error-regexp-alist)
+ (setq compilation-error-regexp-alist
+ (cons (list caml-error-regexp-newstyle 1 '(2 . 4) '(3 . 5))
+ compilation-error-regexp-alist)))))
;; A regexp to extract the range info
- [nongnu] externals/caml 5ac4447 133/197: correct syntax highlighting in emacs (continued), (continued)
- [nongnu] externals/caml 5ac4447 133/197: correct syntax highlighting in emacs (continued), Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 6084272 137/197: PR#5176: caml-types.el: large types trigger stack overflow in regexp matcher, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 0ca1e97 155/197: Merge branch 4.01 from branching point to 4.01.0+rc1, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml d7a872b 170/197: caml.el: update authors list, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml ae92bb1 173/197: Fix emacs mode (raise/failwith/invalid_arg regexp)., Stefan Monnier, 2020/11/21
- [nongnu] externals/caml d8a2f7d 165/197: caml-types.el: Fix missing format argument, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml f828046 172/197: caml.el: use conventional permission statement, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 5569e23 189/197: Handle identifiers in comments, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml b2b6657 135/197: fix whitespace, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 072b0e0 142/197: add some missing copyright headers, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 71d36c5 143/197: PR#4994: ocaml-mode doesn't work with xemacs21,
Stefan Monnier <=
- [nongnu] externals/caml 3190d71 145/197: PR#5070, continued: also parse backtrace locations, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml f6a12d8 149/197: merge patch by Stefan Monnier from PR#5884, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml f6cd0b9 078/197: petit nettoyage, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 474e6ee 102/197: only set type faces where needed, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml b1eaaab 115/197: merge changes 3.10.0 -> 3.10.1, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 43a83dc 118/197: bug string-to-number, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml c525bf8 121/197: clean up spaces and tabs, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 73599dd 129/197: uniform .ignore system, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml eec3351 144/197: do byte-compile file caml-font.el, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml b1139bc 146/197: merge version/4.00 at revision 12866, Stefan Monnier, 2020/11/21