浏览代码

org-list.el: Return an error when there is no list at point.

* org-list.el (org-mark-list): Return an error when there is
no list at point.
Bastien Guerry 13 年之前
父节点
当前提交
c465c7bdf0
共有 1 个文件被更改,包括 9 次插入7 次删除
  1. 9 7
      lisp/org-list.el

+ 9 - 7
lisp/org-list.el

@@ -2182,13 +2182,15 @@ item is invisible."
   "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)))
+  (if (not (org-at-item-p))
+      (error "Not on a list")
+    (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."