summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2009-04-01 11:54:01 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2009-04-01 11:54:01 +0200
commitc53bdcf0574384c12b18ee27158d9d6ae8238e4f (patch)
tree4e061bd024c8fe03ed9450dca875bf8ea7545d46
parent65f268c860571158fff9aca4b0b8d083e2443e14 (diff)
downloadgeiser-chez-c53bdcf0574384c12b18ee27158d9d6ae8238e4f.tar.gz
geiser-chez-c53bdcf0574384c12b18ee27158d9d6ae8238e4f.tar.bz2
Better xref display.
-rw-r--r--elisp/geiser-xref.el25
-rw-r--r--scheme/guile/geiser/xref.scm2
2 files changed, 20 insertions, 7 deletions
diff --git a/elisp/geiser-xref.el b/elisp/geiser-xref.el
index 3be2a74..a9b7a1f 100644
--- a/elisp/geiser-xref.el
+++ b/elisp/geiser-xref.el
@@ -31,6 +31,7 @@
(require 'geiser-base)
(require 'button)
+(require 'lisp-mode)
;;; Customization:
@@ -66,7 +67,8 @@
(let* ((location (cdr (assoc 'location xref)))
(file (geiser-edit--location-file location))
(signature (cdr (assoc 'signature xref)))
- (module (cdr (assoc 'module xref))))
+ (module (cdr (assoc 'module xref)))
+ (p (point)))
(when signature
(insert "\t")
(if (stringp file)
@@ -76,17 +78,28 @@
'name (car signature)
'help-echo (format "%s in %s" (car signature) file))
(insert (format "%s" signature)))
- (when (and (not (null module)) (not (eq '\#f module)))
- (insert (format " in module %s" module)))
+ (fill-region p (point))
+ (save-excursion (goto-char p) (indent-sexp))
(newline))))
+(defun geiser-xref--module< (xr1 xr2)
+ (let ((m1 (cdr (assoc 'module xr1)))
+ (m2 (cdr (assoc 'module xr2))))
+ (cond ((equal m1 m2)
+ (string< (format "%s" (cdr (assoc 'signature xr1)))
+ (format "%s" (cdr (assoc 'signature xr2)))))
+ ((null m1) (not m2))
+ ((null m2))
+ (t (string< (format "%s" m1) (format "%s" m2))))))
+
(defun geiser-xref--display-xrefs (header xrefs)
(geiser-xref--with-buffer
(erase-buffer)
(geiser--insert-with-face header 'geiser-font-lock-xref-header)
(newline 2)
- (mapc 'geiser-xref--insert-button xrefs))
- (geiser-xref--pop-to-buffer))
+ (mapc 'geiser-xref--insert-button (sort xrefs 'geiser-xref--module<)))
+ (geiser-xref--pop-to-buffer)
+ (goto-char (point-min)))
(defun geiser-xref--read-name (ask prompt)
(let ((name (or (and (not prompt) (symbol-at-point))
@@ -101,7 +114,7 @@
(if (or (not res) (not (listp res)))
(message "No %ss found for '%s'" rkind name)
(message "")
- (geiser-xref--display-xrefs (format "%ss for %s" (capitalize rkind) name) res))))
+ (geiser-xref--display-xrefs (format "%ss for '%s'" (capitalize rkind) name) res))))
;;; Buffer and mode:
diff --git a/scheme/guile/geiser/xref.scm b/scheme/guile/geiser/xref.scm
index 33821b7..059fbb0 100644
--- a/scheme/guile/geiser/xref.scm
+++ b/scheme/guile/geiser/xref.scm
@@ -52,7 +52,7 @@
(and proc
`((location . ,(or (program-location proc) (symbol-location name)))
(signature . ,(object-signature name proc))
- (module . ,module))))
+ (module . ,(or module '())))))
(define (program-location p)
(cond ((not (program? p)) #f)