[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] externals/caml 1991236 046/197: improve indentation
From: |
Stefan Monnier |
Subject: |
[nongnu] externals/caml 1991236 046/197: improve indentation |
Date: |
Sat, 21 Nov 2020 01:19:35 -0500 (EST) |
branch: externals/caml
commit 19912364fa7214406e54fb83999014b1ff3ef335
Author: Jacques Garrigue <garrigue at math.nagoya-u.ac.jp>
Commit: Jacques Garrigue <garrigue at math.nagoya-u.ac.jp>
improve indentation
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4165
f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
---
caml.el | 58 +++++++++++++++++++++++++++++-----------------------------
1 file changed, 29 insertions(+), 29 deletions(-)
diff --git a/caml.el b/caml.el
index d97e625..632271e 100644
--- a/caml.el
+++ b/caml.el
@@ -1022,10 +1022,10 @@ 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 (> (point) 1) (= (preceding-char) ?\;) (= (following-char) ?\;))
(setq in-expr nil))
((looking-at caml-before-expr-prefix)
- (goto-char (match-end 0))
+ (if (not (looking-at "(\\*")) (goto-char (match-end 0)))
(skip-chars-forward " \t\n")
(while (looking-at "(\\*")
(forward-char)
@@ -1051,19 +1051,18 @@ keywords."
(let ((start-literal (concat "[\"" caml-quote-char "]"))
found kwop)
- (progn
- (while (and (not found)
- (re-search-backward kwop-regexp nil t))
- (setq kwop (caml-match-string 0))
- (cond
- ((looking-at "(\\*")
- (backward-char))
- ((caml-in-comment-p)
- (search-backward "(" nil 'move))
- ((looking-at start-literal))
- ((caml-in-literal-p)
- (re-search-backward start-literal)) ;ugly hack
- ((setq found t)))))
+ (while (and (> (point) 1) (not found)
+ (re-search-backward kwop-regexp nil 'move))
+ (setq kwop (caml-match-string 0))
+ (cond
+ ((looking-at "(\\*")
+ (if (> (point) 1) (backward-char)))
+ ((caml-in-comment-p)
+ (search-backward "(" nil 'move))
+ ((looking-at start-literal))
+ ((caml-in-literal-p)
+ (re-search-backward start-literal nil 'move)) ;ugly hack
+ ((setq found t))))
(if found
(if (not (string-match "\\`[^|[]|[^]|]?\\'" kwop)) ;arrrrgh!!
kwop
@@ -1342,8 +1341,9 @@ 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) ?\;))
- (goto-char 0)
+ ((or (string= kwop ";;")
+ (and (string= kwop ";") (= (preceding-char) ?\;)))
+ (forward-line 1)
(setq kwop ";;")
(setq done t))
((and (>= prio 2) (string= kwop "|")) (setq done t))
@@ -1461,7 +1461,7 @@ matching nodes to determine KEYWORD's final indentation.")
(save-excursion
(back-to-indentation)
(cond
- ((looking-at comment-start-skip) (current-column))
+ ((and (bolp) (looking-at comment-start-skip)) (current-column))
((caml-in-comment-p)
(let ((closing (looking-at "\\*)"))
(comment-mark (looking-at "\\*")))
@@ -1612,18 +1612,18 @@ by |, insert one."
0)
abbrev-correct)))))))
-; (defun caml-indent-phrase ()
-; (interactive "*")
-; (let ((bounds (caml-mark-phrase)))
-; (indent-region (car bounds) (cdr bounds) nil)))
+(defun caml-indent-phrase ()
+ (interactive "*")
+ (let ((bounds (caml-mark-phrase)))
+ (indent-region (car bounds) (cdr bounds) nil)))
-(defun caml-indent-phrase (arg)
- (interactive "p")
- (save-excursion
- (let ((beg (caml-find-phrase)))
- (while (progn (setq arg (- arg 1)) (> arg 0))
- (caml-find-region))
- (indent-region beg (point) nil))))
+; (defun caml-indent-phrase (arg)
+; (interactive "p")
+; (save-excursion
+; (let ((beg (caml-find-phrase)))
+; (while (progn (setq arg (- arg 1)) (> arg 0))
+; (caml-find-region))
+; (indent-region beg (point) nil))))
(defun caml-indent-buffer ()
(interactive)
- [nongnu] externals/caml 442bd24 059/197: prepare snapshot, (continued)
- [nongnu] externals/caml 442bd24 059/197: prepare snapshot, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml ac2a0b2 064/197: ajout option -stypes; depend, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml faa1c81 065/197: ajout choses a faire, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 76f4e2b 116/197: amelioration des annotations, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 64cecd3 128/197: merge changes from 3.12.0 to 3.12.1, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 64a3c02 166/197: Fixing some Emacs startup warnings., Stefan Monnier, 2020/11/21
- [nongnu] externals/caml bce861f 181/197: Emacs: Use built-in detection of comments, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml ac5d007 047/197: caml-indent-phrase, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 3d7f47c 066/197: amelioration .mly .mll, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 099dbf5 067/197: -stypes -> -dtypes; meilleur mode emacs, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 1991236 046/197: improve indentation,
Stefan Monnier <=
- [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