[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master efbe022 4/5: Add loc-changes:alist-describe to show what m
From: |
Rocky Bernstein |
Subject: |
[elpa] master efbe022 4/5: Add loc-changes:alist-describe to show what marks have been set. |
Date: |
Fri, 27 Feb 2015 23:29:33 +0000 |
branch: master
commit efbe022eaeef0ccc54ffe219216974a786c3301c
Author: rocky <address@hidden>
Commit: rocky <address@hidden>
Add loc-changes:alist-describe to show what marks have been set.
---
loc-changes.el | 36 ++++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/loc-changes.el b/loc-changes.el
index bcc7ed1..169e20e 100644
--- a/loc-changes.el
+++ b/loc-changes.el
@@ -42,6 +42,42 @@ their corresponding markers in the buffer. The 'key' is the
line number; the val
the marker"
)
+(defun loc-changes:follow-mark(event)
+ (interactive "e")
+ (let* ((pos (posn-point (event-end event)))
+ (mark (get-text-property pos 'mark)))
+ (switch-to-buffer-other-window (marker-buffer mark))
+ (goto-char (marker-position mark))
+ ))
+
+
+(defun loc-changes:alist-describe (&optional opt-buffer)
+ "Display buffer-local variable loc-changes-alist. If BUFFER is
+not given, the current buffer is used. Information is put in an
+internal buffer called *Describe*."
+ (interactive "")
+ (let ((buffer (or opt-buffer (current-buffer)))
+ (alist))
+ (with-current-buffer buffer
+ (setq alist loc-changes-alist)
+ (unless (listp alist) (error "expecting loc-changes-alist to be a
list"))
+ )
+ (switch-to-buffer (get-buffer-create "*Describe*"))
+ (setq buffer-read-only 'nil)
+ (delete-region (point-min) (point-max))
+ (dolist (assoc alist)
+ (put-text-property
+ (insert-text-button
+ (format "line %d: %s\n" (car assoc) (cdr assoc))
+ 'action 'loc-changes:follow-mark
+ 'help-echo "mouse-2: go to this location")
+ (point)
+ 'mark (cdr assoc)
+ )
+ )
+ (setq buffer-read-only 't)
+ ))
+
;;;###autoload
(defun loc-changes-goto-line (line-number &optional column-number)
"Position `point' at LINE-NUMBER of the current buffer. If