emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master a50acd0 1/4: captain: Change default predicate to a functi


From: Ian Dunn
Subject: [elpa] master a50acd0 1/4: captain: Change default predicate to a function, and call it unconditionally
Date: Sun, 8 Oct 2017 13:07:13 -0400 (EDT)

branch: master
commit a50acd083e7106fe3b701ccce77b289d9782c325
Author: Ian Dunn <address@hidden>
Commit: Ian Dunn <address@hidden>

    captain: Change default predicate to a function, and call it unconditionally
    
    * packages/captain/captain.el (captain--default-predicate): New defun.
      (captain-predicate): Use it by default.
---
 packages/captain/captain.el | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/packages/captain/captain.el b/packages/captain/captain.el
index 90cd9ad..7fba719 100644
--- a/packages/captain/captain.el
+++ b/packages/captain/captain.el
@@ -53,7 +53,13 @@
 (eval-when-compile (require 'subr-x))
 (require 'thingatpt)
 
-(defvar-local captain-predicate nil
+(defun captain--default-predicate ()
+  "The default predicate for determining whether the captain should work.
+
+He does nothing by default."
+  nil)
+
+(defvar-local captain-predicate #'captain--default-predicate
   "Predicate to check for whether auto-capitalization should be handled.
 
 Should be a function of no arguments, and return non-nil if
@@ -68,8 +74,7 @@ function of your choosing.")
 
 (defun captain-should-capitalize-p ()
   "Return non-nil if the captain should auto-capitalize your work."
-  (when captain-predicate
-    (funcall captain-predicate)))
+  (funcall captain-predicate))
 
 (defun captain--default-sentence-start ()
   "Default value of `captain-sentence-start-function'.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]