0

With a region selected I can call this function "accdeb" (below) that gives me the right results in a list. How can I feed this list to helm ?

With the code below I get: wrong-number-of-arguments.

What am I doing wrong ?

(setq some-helm-source
      '((name . "stacktrace from region")
        (candidates . accdeb)
        (action . (lambda (candidate)
                    (message "%s" candidate)))))

(defun my-first-helm-command ()
  (interactive)
  (helm :sources '(some-helm-source)
        :buffer "*helm backtrace*"))

(defun accdeb (beg end)
  (interactive "r")
  (mapcar (lambda (arg)
            (shell-command-to-string
              (concat "/home/demetra/scripts/eaddrs2line.sh /my/workspace" 
                      " "
                      arg)))
          (split-string (buffer-substring-no-properties beg end) "\n")))
0

You need to remove the arguments from accdeb:

(defun accdeb ()
  (with-helm-current-buffer
    (let ((beg (region-beginning))
          (end (region-end)))
      (mapcar (lambda (arg)
                (shell-command-to-string
                 (concat "/home/demetra/scripts/eaddrs2line.sh /my/workspace" 
                         " "
                         arg)))
              (split-string (buffer-substring-no-properties beg end) "\n")))))
  • Does this say how to use an interactive function in this context? – Drew Aug 11 at 2:45
  • I thought I would get one function that I can call interactively and also call that interactive function from helm-source. Maybe that isn't possible. This one works too. Thanks. – maindoor Aug 11 at 6:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.