[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/orgalist cadff59 4/4: Short-circuit filters when Orgali
From: |
Nicolas Goaziou |
Subject: |
[elpa] externals/orgalist cadff59 4/4: Short-circuit filters when Orgalist minor mode is not active |
Date: |
Sat, 5 May 2018 08:15:53 -0400 (EDT) |
branch: externals/orgalist
commit cadff59be4d949f5f3fefef4968adb2fe4476c24
Author: Nicolas Goaziou <address@hidden>
Commit: Nicolas Goaziou <address@hidden>
Short-circuit filters when Orgalist minor mode is not active
* orgalist.el (orgalist--when-at-item):
(orgalist--when-at-empty-item):
(orgalist--when-in-item): Check `orgalist-mode'.
The check is already done by `orgalist--at-item-p', but checking it
earlier can avoid two funcalls.
---
orgalist.el | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/orgalist.el b/orgalist.el
index 6c4d53d..1823fab 100644
--- a/orgalist.el
+++ b/orgalist.el
@@ -600,11 +600,12 @@ The function assumes point is at an empty item."
(defun orgalist--when-at-item (cmd)
"Return CMD when point is at a list item."
- (when (orgalist--at-item-p) cmd))
+ (when (and orgalist-mode (orgalist--at-item-p)) cmd))
(defun orgalist--when-at-empty-item (cmd)
"Return CMD when point is at an empty list item."
- (when (and (orgalist--at-item-p)
+ (when (and orgalist-mode
+ (orgalist--at-item-p)
(org-match-line orgalist--item-re)
(let ((start (line-beginning-position))
(reference-ind (current-indentation))
@@ -619,7 +620,7 @@ The function assumes point is at an empty item."
(defun orgalist--when-in-item (cmd)
"Return CMD when point is in a list item."
- (when (orgalist--in-item-p) cmd))
+ (when (and orgalist-mode (orgalist--in-item-p)) cmd))
;;; Bindings and menu