title: Emacs Lisp: "if: No catch for tag: --cl-block-nil--, t" when returning nil
body: <p>I tried my hand at writing an elisp function today, all works well except for an error that keeps getting thrown when the function returns nil. Here's the function: (Please excuse the formatting, I'm not really sure how to indent this yet.)</p>
  
  <pre><code>(defun byte-is-readable (byte)
    "Determine whether BYTE is readable or not.
  Returns t or nil."
    (if (and (&lt;= byte 126) (&gt;= byte 32)) t nil))
  
  ;; Read the 100 bytes of a file
  ;; If 10 in a row are not 'readable', it is safe to assume the file is a binary
  (defun is-file-binary (file)
    "Determine whether FILE is a binary file.
  Returns t or nil."
    (let* ((i 1)
           (c 0)
           (size (nth 7 (file-attributes file)))
           (lim (if (&lt; size 100) size 100)))
      (while (&lt; i lim)
        (let ((char (with-temp-buffer
                      (insert-file-contents file)
                      (buffer-substring i (+ i 1)))))
          (if (not (byte-is-readable (aref char 0)))
              (setq c (+ c 1))
            (setq c 0))
          (if (= c 10) (return t)))
        (setq i (+ i 1))))
    nil)
  </code></pre>
  
  <p>Calling it like this: <code>(message "%s" (if (is-file-binary "/path/to/some/file") "true" "false")</code> works file when returning true, but throws "if: No catch for tag: --cl-block-nil--, t" when returning nil. I'm guessing this is because nil isn't evaluated correctly or something.</p>
  
  <p>How do I fix it?</p>