nschum/full-ack

Context cannot be set to 0

Mzyxptlk opened this issue · 0 comments

When ack gets the option --context, it correctly identifies that no argument was given, and defaults to 2. However, when it gets the option --context=0, it cannot see that it was not given, because Perl considers the value 0 to be falseish.

The same problem occurs in full-ack.el. I've fixed it in my local copy, but I'm useless at git, so I have my .emacs checked into svn. Hopefully this diff is helpful, nonetheless:

--- full-ack.el       (revision 1084)
+++ full-ack.el       (working copy)
@@ -364,7 +364,8 @@
       (push "-i" arguments))
     (unless regexp
       (push "--literal" arguments))
-    (push (format "--context=%d" ack-context) arguments)
+    (when (not (eq ack-context 0))
+      (push (format "--context=%d" ack-context) arguments))
     arguments))

 (defun ack-run (directory regexp &rest arguments)