Skip to content

Context cannot be set to 0 #12

Closed
Mzyxptlk opened this Issue Nov 29, 2011 · 0 comments

2 participants

@Mzyxptlk

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)
@nschum nschum added a commit that closed this issue Dec 16, 2011
@nschum Fixed #12 on github. e3b63fd
@nschum nschum closed this in e3b63fd Dec 16, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.