simplify electric
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4913 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
d13715755c
commit
956da4fa8c
|
@ -1565,17 +1565,7 @@ followed by |."
|
|||
(caml-in-indentation)
|
||||
(not (caml-in-comment-p)))))
|
||||
(self-insert-command 1)
|
||||
(if electric
|
||||
(let ((indent
|
||||
(save-excursion
|
||||
(backward-char 1)
|
||||
(caml-indent-command)
|
||||
(current-column))))
|
||||
(indent-to (- indent
|
||||
(symbol-value
|
||||
(nth 1 (assoc
|
||||
(char-to-string last-command-char)
|
||||
caml-leading-kwops-alist)))))))))
|
||||
(if electric (save-excursion (caml-indent-command)))))
|
||||
|
||||
(defun caml-electric-rb ()
|
||||
"If inserting a ] operator at beginning of line, reindent the line.
|
||||
|
@ -1585,38 +1575,26 @@ by |, insert one."
|
|||
|
||||
(interactive "*")
|
||||
(let* ((prec (preceding-char))
|
||||
(look-pipe (and caml-electric-close-vector
|
||||
(use-pipe (and caml-electric-close-vector
|
||||
(not (caml-in-comment-p))
|
||||
(not (caml-in-literal-p))
|
||||
(or (not (numberp prec))
|
||||
(not (char-equal ?| prec)))
|
||||
(set-marker (make-marker) (point))))
|
||||
(not (char-equal ?| prec)))))
|
||||
(electric (and caml-electric-indent
|
||||
(caml-in-indentation)
|
||||
(not (caml-in-comment-p)))))
|
||||
(self-insert-command 1)
|
||||
(if electric
|
||||
(let ((indent
|
||||
(if electric (save-excursion (caml-indent-command)))
|
||||
(if (and use-pipe
|
||||
(save-excursion
|
||||
(backward-char 1)
|
||||
(caml-indent-command)
|
||||
(current-column))))
|
||||
(indent-to (- indent
|
||||
(symbol-value
|
||||
(nth 1 (assoc
|
||||
(char-to-string last-command-char)
|
||||
caml-leading-kwops-alist)))))))
|
||||
(if look-pipe
|
||||
(save-excursion
|
||||
(let ((insert-pipe
|
||||
(condition-case nil
|
||||
(prog2
|
||||
(backward-list 1)
|
||||
(if (looking-at "\\[|") "|" ""))
|
||||
(looking-at "\\[|"))
|
||||
(error ""))))
|
||||
(goto-char look-pipe)
|
||||
(insert insert-pipe))
|
||||
(set-marker look-pipe nil)))))
|
||||
(save-excursion
|
||||
(backward-char 1)
|
||||
(insert "|")))))
|
||||
|
||||
(defun caml-abbrev-hook ()
|
||||
"If inserting a leading keyword at beginning of line, reindent the line."
|
||||
|
|
Loading…
Reference in New Issue