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

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

[nongnu] externals/caml d75a12b 038/197: process ;; correctly


From: Stefan Monnier
Subject: [nongnu] externals/caml d75a12b 038/197: process ;; correctly
Date: Sat, 21 Nov 2020 01:19:33 -0500 (EST)

branch: externals/caml
commit d75a12b70477b7918bd73e8747b4f617f3fc4f24
Author: Jacques Garrigue <garrigue at math.nagoya-u.ac.jp>
Commit: Jacques Garrigue <garrigue at math.nagoya-u.ac.jp>

    process ;; correctly
    
    
    git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@3968 
f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
---
 README  |  4 ++++
 caml.el | 18 ++++++++++++------
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/README b/README
index e7203f8..409dbe4 100644
--- a/README
+++ b/README
@@ -63,6 +63,10 @@ For other bindings, see C-h b.
 Changes log:
 -----------
 
+Version 3.03:
+-------------
+* process ;; properly
+
 Version 3.00:
 -------------
 * adapt to new label syntax
diff --git a/caml.el b/caml.el
index 4759546..a24c1b6 100644
--- a/caml.el
+++ b/caml.el
@@ -988,7 +988,8 @@ Used to distinguish it from toplevel let construct.")
              (aref caml-kwop-regexps caml-max-indent-priority)))
     (cond
      ; special case for ;;
-     ((and (= (preceding-char) ?\;) (= (following-char) ?\;)))
+     ((and (= (preceding-char) ?\;) (= (following-char) ?\;))
+      (setq in-expr nil))
      ((looking-at caml-before-expr-prefix)
       (goto-char (match-end 0))
       (skip-chars-forward " \t\n")
@@ -1083,7 +1084,8 @@ keywords."
     ("\["               t       8       caml-lb-indent)
     ("{"                t       8       caml-lc-indent)
     ("\("               t       8       caml-lp-indent)
-    ("|"                nil     2       caml-no-indent))
+    ("|"                nil     2       caml-no-indent)
+    (";;"               nil     0       caml-no-indent))
 ; if-else and let-in are not keywords but idioms
 ; "|" is not in the regexps
 ; all these 3 values correspond to hard-coded names
@@ -1106,7 +1108,7 @@ the line where the governing keyword occurs.")
 (aset caml-kwop-regexps 0
       (concat
        "\\<\\(begin\\|object\\|for\\|s\\(ig\\|truct\\)\\|while\\)\\>"
-       "\\|:begin\\>\\|[[({]"))
+       "\\|:begin\\>\\|[[({]\\|;;"))
 (aset caml-kwop-regexps 1
       (concat (aref caml-kwop-regexps 0) "\\|\\<\\(class\\|module\\)\\>"))
 (aset caml-kwop-regexps 2
@@ -1306,6 +1308,10 @@ the line where the governing keyword occurs.")
        ((not kwop) (setq done t))
        ((caml-at-sexp-close-p)
         (caml-find-paren-match (following-char)))
+       ((and (string= kwop ";") (= (preceding-char) ?\;))
+        (backward-char)
+        (setq kwop ";;")
+        (setq done t))
        ((and (>= prio 2) (string= kwop "|")) (setq done t))
        ((string= kwop "end") (caml-find-end-match))
        ((string= kwop "done") (caml-find-done-match))
@@ -1384,7 +1390,7 @@ Does not preserve point."
               (- (symbol-value (nth 3 kwop-info))
                  (if (looking-at "|") caml-|-extra-indent 0))))))
          (extra (if in-expr caml-apply-extra-indent 0)))
-         (+ indent-diff extra (current-column))))
+         (+ indent-diff extra (if (string= kwop ";;") 0 (current-column)))))
 
 (defconst caml-leading-kwops-regexp
   (concat
@@ -1419,8 +1425,8 @@ matching nodes to determine KEYWORD's final indentation.")
   (save-excursion
     (back-to-indentation)
     (cond
-     ((looking-at comment-start-skip)
-      (current-column))
+     ((looking-at ";;") 0)
+     ((looking-at comment-start-skip) (current-column))
      ((caml-in-comment-p)
       (let ((closing (looking-at "\\*)"))
             (comment-mark (looking-at "\\*")))



reply via email to

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