Skip to content

Issue in lookup org-refile in org.el #1

@rickswe

Description

@rickswe

Hello, nice config. Thanks for making it public. I was trying to figure out a way to
to use consult--read with org-refile and preview the candidates and I came
across your code.

I noticed an issue in the org.el file in the :lookup key here with the arguments. I'm not sure if this is an issue on my end. I modified the code by changing the name and files to my/gtd-files.

(autoload 'consult-org--headings "consult-org")
(defun my-org-refile ()
  (interactive)
  (let* ((point (point-marker))
         (pointbuf (marker-buffer point))
         (headings
          (consult--with-increased-gc
           (cl-loop
            for f in my/gtd-files ;(list std::org::work-file std::org::private-file)
            nconc
            (with-current-buffer (find-file-noselect f :nowarn)
              (consult-org--headings nil "-ARCHIVE" nil))
            into hs
            finally return hs)))
         (rfmarker (consult--read
                    headings
                    :prompt "Refile to: "
                    :category 'consult-org-heading
                    :sort nil
                    :require-match t
                    :history '(:input consult-org--history)
                    :narrow (consult-org--narrow)
                    :lookup
                    (lambda (_ candidates cand)
                      (when-let (found (member cand candidates))
                        (car (get-text-property 0 'consult-org--heading (car found)))))))
         (rfbuffer (marker-buffer rfmarker))
         (rfheading (with-current-buffer rfbuffer
                      (org-with-point-at rfmarker
                        (org-get-heading :no-tags :no-todo :no-priority :no-comment))))
         (rffilename (buffer-file-name rfbuffer))
         (rfloc (list rfheading rffilename nil rfmarker)))
    (with-current-buffer pointbuf
      (org-with-point-at point
        (org-refile nil nil rfloc))
      (org-refile '(16) nil nil))))

The error is wrong-number-of-arguments to the lambda.

Debugger entered--Lisp error: (wrong-number-of-arguments (lambda (_ candidates cand) (when-let (found (member cand candidates)) (car (get-text-property 0 'consult-org--heading (car found))))) 4)
  (lambda (_ candidates cand) (when-let (found (member cand candidates)) (car (get-text-property 0 'consult-org--heading (car found)))))("Personal/Other/Perso...

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions