[MLton] emacs def-use mode
Jake Donham
jdonham at cs.cmu.edu
Sun Feb 18 13:39:08 PST 2007
Hi,
The emacs def-use mode is nice! Appended is a little patch to give it a
stack of where you've been, like you get with tags mode. It is based on
etags.el.
Jake
--- def-use-mode.el (revision 5255)
+++ def-use-mode.el (working copy)
@@ -67,10 +67,19 @@
:type 'integer
:group 'def-use)
+(defcustom def-use-marker-ring-length 16
+ "*Length of marker ring `def-use-marker-ring'."
+ :group 'def-use
+ :type 'integer)
+
+(defvar def-use-marker-ring (make-ring def-use-marker-ring-length)
+ "Ring of markers which are locations from which \\[def-use-goto-ref] was invoked.")
+
(defcustom def-use-key-bindings
'(("[(control c) (control d)]" . def-use-jump-to-def)
("[(control c) (control n)]" . def-use-jump-to-next)
("[(control c) (control p)]" . def-use-jump-to-prev)
+ ("[(control c) (control m)]" . def-use-pop-ref-mark)
("[(control c) (control s)]" . def-use-show-dus)
("[(control c) (control l)]" . def-use-list-all-refs)
("[(control c) (control v)]" . def-use-show-info))
@@ -202,6 +211,7 @@
(defun def-use-goto-ref (ref &optional other-window)
"Finds the referenced source and moves point to the referenced
position."
+ (ring-insert def-use-marker-ring (point-marker))
(cond
((not (file-readable-p (def-use-ref-src ref)))
(compat-error "Referenced file %s can not be read" (def-use-ref-src ref)))
@@ -222,6 +232,17 @@
(copy-list (def-use-sym-to-uses sym)))
(function def-use-ref<)))
+(defun def-use-pop-ref-mark ()
+ "Pop back to where \\[def-use-goto-ref] was last invoked."
+ (interactive)
+ (if (ring-empty-p def-use-marker-ring)
+ (error "No previous locations for def-use-goto-ref invocation"))
+ (let ((marker (ring-remove def-use-marker-ring 0)))
+ (switch-to-buffer (or (marker-buffer marker)
+ (error "The marked buffer has been deleted")))
+ (goto-char (marker-position marker))
+ (set-marker marker nil nil)))
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; List mode
More information about the MLton
mailing list