[MLton-commit] r5087
Vesa Karvonen
vesak at mlton.org
Tue Jan 30 06:33:07 PST 2007
Sort refs in jump-to-{next,prev}.
----------------------------------------------------------------------
U mlton/trunk/ide/emacs/def-use-data.el
U mlton/trunk/ide/emacs/def-use-mode.el
----------------------------------------------------------------------
Modified: mlton/trunk/ide/emacs/def-use-data.el
===================================================================
--- mlton/trunk/ide/emacs/def-use-data.el 2007-01-30 14:04:00 UTC (rev 5086)
+++ mlton/trunk/ide/emacs/def-use-data.el 2007-01-30 14:33:06 UTC (rev 5087)
@@ -24,12 +24,20 @@
(defalias 'def-use-pos (function cons))
(defalias 'def-use-pos-line (function car))
(defalias 'def-use-pos-col (function cdr))
+(defun def-use-pos< (lhs rhs)
+ (or (< (def-use-pos-line lhs) (def-use-pos-line rhs))
+ (and (equal (def-use-pos-line lhs) (def-use-pos-line rhs))
+ (< (def-use-pos-col lhs) (def-use-pos-col rhs)))))
(defun def-use-ref (src pos)
"Reference constructor."
(cons (def-use-intern src) pos))
(defalias 'def-use-ref-src (function car))
(defalias 'def-use-ref-pos (function cdr))
+(defun def-use-ref< (lhs rhs)
+ (or (string< (def-use-ref-src lhs) (def-use-ref-src rhs))
+ (and (equal (def-use-ref-src lhs) (def-use-ref-src rhs))
+ (def-use-pos< (def-use-ref-pos lhs) (def-use-ref-pos rhs)))))
(defun def-use-sym (kind name ref)
"Symbol constructor."
@@ -64,7 +72,6 @@
(let* ((ref (def-use-sym-ref sym))
(src (def-use-ref-src ref))
(info (def-use-src-to-info src)))
- (puthash ref ref (def-use-sym-to-use-set sym))
(puthash src src (def-use-duf-to-src-set duf))
(puthash sym sym (def-use-info-sym-set info))
(puthash (def-use-ref-pos ref) sym (def-use-info-pos-to-sym info))))
Modified: mlton/trunk/ide/emacs/def-use-mode.el
===================================================================
--- mlton/trunk/ide/emacs/def-use-mode.el 2007-01-30 14:04:00 UTC (rev 5086)
+++ mlton/trunk/ide/emacs/def-use-mode.el 2007-01-30 14:33:06 UTC (rev 5087)
@@ -122,11 +122,13 @@
(sym (def-use-sym-at-ref ref)))
(if (not sym)
(message "Sorry, no information on the symbol at point!")
- (let* ((uses (def-use-sym-to-uses sym))
- (uses (if reverse (reverse uses) uses))
- (uses (append uses uses)))
- (while (not (equal (pop uses) ref)))
- (def-use-goto-ref (car uses) other-window)))))
+ (let* ((refs (sort (cons (def-use-sym-ref sym)
+ (def-use-sym-to-uses sym))
+ (function def-use-ref<)))
+ (refs (if reverse (reverse refs) refs))
+ (refs (append refs refs)))
+ (while (not (equal (pop refs) ref)))
+ (def-use-goto-ref (car refs) other-window)))))
(defun def-use-jump-to-prev (&optional other-window)
"Jumps to the prev use (or def) of the symbol under the cursor."
@@ -199,10 +201,10 @@
(setq def-use-highlighted-sym sym)
(setq def-use-highlighted-buffer (current-buffer))
(def-use-highlight-ref sym (def-use-sym-ref sym) 'def-use-def-face)
- (maphash (function
- (lambda (ref _)
- (def-use-highlight-ref sym ref 'def-use-use-face)))
- (def-use-sym-to-use-set sym)))))
+ (mapc (function
+ (lambda (ref)
+ (def-use-highlight-ref sym ref 'def-use-use-face)))
+ (def-use-sym-to-uses sym)))))
(defun def-use-highlight-current ()
"Highlights the symbol at the point."
More information about the MLton-commit
mailing list