minad / consult

:mag: consult.el - Consulting completing-read
GNU General Public License v3.0
1.12k stars 98 forks source link

consult--each-line not unquoted `end` symbol #1006

Closed nagy closed 3 weeks ago

nagy commented 3 weeks ago

Currently, the consult--each-line macro reads like this:

(defmacro consult--each-line (beg end &rest body)
  (cl-with-gensyms (max)
    `(save-excursion
       (let ((,beg (point-min)) (,max (point-max)) end)
         ;; ...
         ))))

If my understanding of that macro is correct, it should rather read like this, with the comma before the end:

(defmacro consult--each-line (beg end &rest body)
  (cl-with-gensyms (max)
    `(save-excursion
       (let ((,beg (point-min)) (,max (point-max)) ,end)
         ;; ...
         ))))

Otherwise this:

(consult--each-line foo baz (progn))

expands to this:

(save-excursion
  (let
      ((foo
        (point-min))
       (max385
        (point-max))
       end)
    (while
        (< foo max385)
      (goto-char foo)
      (setq baz
            (pos-eol))
      (progn)
      (setq foo
            (1+ baz)))))

I don't think you want to see the end symbol in there in the let-form.

Thanks for the great package btw.