summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2012-05-05 10:52:57 +0200
committerBastien Guerry <bzg@altern.org>2012-05-05 10:52:57 +0200
commitc465c7bdf033092beb3ee8cda1be370b5ccfbb3f (patch)
treeade3a2602652db11475d8be1bcd5e035408ae217
parent75e1c141f89c600112ca275b6b916faf12617ce8 (diff)
downloadorg-mode-c465c7bdf033092beb3ee8cda1be370b5ccfbb3f.tar.gz
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.
-rw-r--r--lisp/org-list.el16
1 files changed, 9 insertions, 7 deletions
diff --git a/lisp/org-list.el b/lisp/org-list.el
index 882ce3d..5f2494a 100644
--- a/lisp/org-list.el
+++ b/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."