Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/sml-mode/sml-mode.el
ViewVC logotype

Diff of /sml/trunk/sml-mode/sml-mode.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 338, Thu Jun 17 14:13:58 1999 UTC revision 339, Thu Jun 17 16:14:01 1999 UTC
# Line 520  Line 520 
520  (defun sml-indent-relative (sym data)  (defun sml-indent-relative (sym data)
521    (save-excursion    (save-excursion
522      (sml-forward-sym) (sml-backward-sexp nil)      (sml-forward-sym) (sml-backward-sexp nil)
523      (unless (cdr data) (sml-backward-spaces) (sml-backward-sym))      (unless (second data) (sml-backward-spaces) (sml-backward-sym))
524      (+ (or (cdr (assoc sym sml-symbol-indent)) 0)      (+ (or (cdr (assoc sym sml-symbol-indent)) 0)
525         (sml-delegated-indent))))         (sml-delegated-indent))))
526    
# Line 591  Line 591 
591    (save-excursion    (save-excursion
592      (let ((delegate (assoc sym sml-close-paren))      (let ((delegate (assoc sym sml-close-paren))
593            (head-sym sym))            (head-sym sym))
594        (when delegate        (when (and delegate (not (eval (third delegate))))
595          ;;(sml-find-match-backward sym delegate)          ;;(sml-find-match-backward sym delegate)
596          (sml-forward-sym) (sml-backward-sexp nil)          (sml-forward-sym) (sml-backward-sexp nil)
597          (setq head-sym          (setq head-sym
598                (if (cdr delegate)                (if (second delegate)
599                    (save-excursion (sml-forward-sym))                    (save-excursion (sml-forward-sym))
600                  (sml-backward-spaces) (sml-backward-sym))))                  (sml-backward-spaces) (sml-backward-sym))))
601    
# Line 619  Line 619 
619    
620  (defun sml-indent-default (&optional noindent)  (defun sml-indent-default (&optional noindent)
621    (let* ((sym-after (save-excursion (sml-forward-sym)))    (let* ((sym-after (save-excursion (sml-forward-sym)))
          (prec-after (sml-op-prec sym-after 'back))  
          (indent-after (or (cdr (assoc sym-after sml-symbol-indent)) 0))  
622           (_ (sml-backward-spaces))           (_ (sml-backward-spaces))
623           (sym-before (sml-backward-sym))           (sym-before (sml-backward-sym))
          (prec (or (sml-op-prec sym-before 'back) prec-after 100))  
624           (sym-indent (and sym-before (sml-get-sym-indent sym-before))))           (sym-indent (and sym-before (sml-get-sym-indent sym-before))))
625      (if sym-indent      (if sym-indent
626          (if noindent (current-column) (+ sym-indent indent-after))          ;; the previous sym is an indentation introducer: follow the rule
627        ;;(sml-forward-sym)          (let ((indent-after (or (cdr (assoc sym-after sml-symbol-indent)) 0)))
628              (if noindent (current-column) (+ sym-indent indent-after)))
629          ;; default-default
630          (let* ((prec-after (sml-op-prec sym-after 'back))
631                 (prec (or (sml-op-prec sym-before 'back) prec-after 100)))
632            ;; go back until you hit a symbol that has a lower prec than the
633            ;; "current one", or until you backed over a sym that has the same prec
634            ;; but is at the beginning of a line.
635        (while (and (not (sml-bolp))        (while (and (not (sml-bolp))
636                    (sml-move-if (sml-backward-sexp (1- prec)))                    (sml-move-if (sml-backward-sexp (1- prec)))
637                    (not (sml-bolp)))                    (not (sml-bolp)))
638          (while (sml-move-if (sml-backward-sexp prec))))          (while (sml-move-if (sml-backward-sexp prec))))
639  ;;       (or (and (not (sml-bolp))          ;; the `noindent' case does back over an introductory symbol
640  ;;             ;; If we backed over an equal char which was not the          ;; such as `fun', ...
 ;;             ;; polymorphic equality, then we did what amounts to  
 ;;             ;; delegate indent from `=' to the corresponding head, so we  
 ;;             ;; need to look at the preceding symbol and follow its  
 ;;             ;; intentation instructions.  
 ;;             (string-equal "d=" sym-before)  
 ;;             (let ((point (point)))  
 ;;               (sml-backward-spaces)  
 ;;               (let* ((sym (sml-backward-sym))  
 ;;                      (sym-indent (cdr (assoc-default sym sml-indent-rule))))  
 ;;                 (when sym-indent  
 ;;                   (if noindent (current-column)  
 ;;                     (let ((sym-indent (sml-get-sym-indent sym 1)))  
 ;;                       (if sym-indent (+ indent-after sym-indent)  
 ;;                         (goto-char point)  
 ;;                         (+ indent-after (current-column)))))))))  
   
641        (when noindent        (when noindent
642          (sml-move-if (sml-backward-spaces)            (sml-move-if
643               (sml-backward-spaces)
644                       (string-match sml-starters-re (or (sml-backward-sym) ""))))                       (string-match sml-starters-re (or (sml-backward-sym) ""))))
645        (current-column))))          (current-column)))))
646    
647    
648  (defun sml-bolp ()  (defun sml-bolp ()

Legend:
Removed from v.338  
changed lines
  Added in v.339

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0