Attached is updated patch: done small formatting fixes and added
sorting mark characters.
Best,
Sanel
diff --git a/evil-commands.el b/evil-commands.el
index 9f631ab..82850ec 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -2692,6 +2692,50 @@ the previous shell command is executed instead."
(cdr reg))))
(newline)))))
+(evil-define-command evil-show-marks ()
+ "Shows all marks."
+ :repeat nil
+ ;; To get markers and positions, we can't rely on 'global-mark-ring' provided
+ ;; by Emacs (although it will be much simpler and faster), because 'global-mark-ring'
+ ;; does not store mark characters, but only buffer name and position. Instead,
+ ;; 'evil-markers-alist' is used; this is list maintained by Evil for each buffer.
+ (let (;; calculate row/col from given point applying on current buffer
+ (line-col #'(lambda (p)
+ (save-excursion
+ (goto-char p)
+ (cons
+ (1+ (count-lines 1 (point)))
+ (current-column)))))
+ ;; contains list of vectors in form [char-int row col filename]
+ (all-markers '()))
+ (save-current-buffer
+ (dolist (b (buffer-list))
+ (set-buffer b)
+ (let ((markers (evil-filter-list #'(lambda (x)
+ (not (markerp (cdr x))))
+ evil-markers-alist)))
+ (when markers
+ (dolist (m markers)
+ ;; calculate details as soon as possible as '(line-col)' depends
+ ;; on currently selected buffer
+ (let* ((marker (cdr m))
+ (pos (funcall line-col (marker-position marker)))
+ (row (car pos))
+ (col (cdr pos))
+ (char (car m))
+ (file (buffer-name (marker-buffer marker))))
+ (push (vector char row col file) all-markers)))))))
+ (evil-with-view-list "evil-marks"
+ (setq truncate-lines t)
+ (dolist (m (sort all-markers #'(lambda (a b)
+ (< (aref a 0)
+ (aref b 0)))))
+ (insert (format " %s %6d %6d %s\n"
+ (string (aref m 0))
+ (aref m 1)
+ (aref m 2)
+ (aref m 3)))))))
+
(eval-when-compile (require 'ffap))
(evil-define-command evil-find-file-at-point-with-line ()
"Opens the file at point and goes to line-number."
_______________________________________________
implementations-list mailing list
[email protected]
https://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list