forked from Silex/docker.el
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tabulated-list-ext.el
42 lines (35 loc) · 1.19 KB
/
tabulated-list-ext.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
(require 'dash)
(defun tabulated-list-mark (&optional how-many)
"Mark move to the next line."
(interactive "p")
(--dotimes how-many (tabulated-list-put-tag "*" t)))
(defun tabulated-list-unmark (&optional how-many)
"Unmark and move to the next line."
(interactive "p")
(--dotimes how-many (tabulated-list-put-tag "" t)))
(defun tabulated-list-toggle-marks ()
"Toggle marks."
(interactive)
(save-excursion
(goto-char (point-min))
(while (not (eobp))
(setq cmd (char-after))
(tabulated-list-put-tag (if (eq cmd ?*) "" "*") t))))
(defun tabulated-list-unmark-all ()
"Unmark all."
(interactive)
(save-excursion
(goto-char (point-min))
(while (not (eobp))
(tabulated-list-put-tag "" t))))
(defvar tabulated-list-ext-mode-map
(let ((map (make-sparse-keymap)))
(define-key map "m" 'tabulated-list-mark)
(define-key map "u" 'tabulated-list-unmark)
(define-key map "t" 'tabulated-list-toggle-marks)
(define-key map "U" 'tabulated-list-unmark-all)
map)
"Keymap for `tabulated-list-ext-mode'.")
(define-derived-mode tabulated-list-ext-mode tabulated-list-mode "Extended Tabulated List"
"Extended Tabulated List")
(provide 'tabulated-list-ext)