Browse Source

New function `org-mark-list' bound to `C-c C-@'.

* org-list.el (org-mark-list): New function.

* org.el (org-mode-map): Add a keybinding for the new function.
Bastien Guerry 7 years ago
parent
commit
aee6f9008a
2 changed files with 13 additions and 0 deletions
  1. 12 0
      lisp/org-list.el
  2. 1 0
      lisp/org.el

+ 12 - 0
lisp/org-list.el

@@ -2177,6 +2177,18 @@ item is invisible."
 	  (goto-char (match-end 0))
 	  t)))))
 
+(defun org-mark-list ()
+  "Mark the current list.
+If this is a sublist, only mark the sublist."
+  (interactive)
+  (let* ((item (org-list-get-item-begin))
+	 (struct (org-list-struct))
+	 (prevs (org-list-prevs-alist struct))
+	 (lbeg (org-list-get-list-begin item struct prevs))
+	 (lend (org-list-get-list-end item struct prevs)))
+    (push-mark lend nil t)
+    (goto-char lbeg)))
+
 (defun org-list-repair ()
   "Fix indentation, bullets and checkboxes is the list at point."
   (interactive)

+ 1 - 0
lisp/org.el

@@ -17366,6 +17366,7 @@ BEG and END default to the buffer boundaries."
 (org-defkey org-mode-map "\C-c\C-x\C-mg"    'org-mobile-pull)
 (org-defkey org-mode-map "\C-c\C-x\C-mp"    'org-mobile-push)
 (org-defkey org-mode-map "\C-c@" 'org-mark-subtree)
+(org-defkey org-mode-map "\C-c\C-@" 'org-mark-list)
 (org-defkey org-mode-map [?\C-c (control ?*)] 'org-list-make-subtree)
 ;;(org-defkey org-mode-map [?\C-c (control ?-)] 'org-list-make-list-from-subtree)