Skip to main content

So I'm looking to have helm swoophelm-swoop look at all files in a project, not just the current set of open buffers.

This is so I can use swoop to find all occurrences in a project, mark relevant ones, then edit them (in helm swoops edit mode).

I feel that there's probably a clean way to do this with Helm/Helm swoop but here's my attempt to think through a solution:

  1. gather filenames from projectile
  2. create a list of buffers from the filename list
  3. do the same routine as helm-multi-swoop-all besides using this new buffer list

(projectile-current-project-files), looks like it gives me the file list I'm looking for.

So helm-multi-swoop-all, looks like it'd be fairly easy to copy and then tweak.

(defun helm-multi-swoop-all (&optional $query)
  (interactive)
  "Apply all buffers to helm-multi-swoop"
  (cond ($query
         (setq helm-multi-swoop-query $query))
        (mark-active
         (let (($st (buffer-substring-no-properties
                     (region-beginning) (region-end))))
           (if (string-match "\n" $st)
               (message "Multi line region is not allowed")
             (setq helm-multi-swoop-query
                   (helm-swoop-pre-input-optimize $st)))))
        ((setq helm-multi-swoop-query
               (helm-swoop-pre-input-optimize
                (funcall helm-swoop-pre-input-function))))
        (t (setq helm-multi-swoop-query "")))
  (helm-multi-swoop--exec nil
                          :$query helm-multi-swoop-query
                          :$buflist (helm-multi-swoop--get-buffer-list)))

Just replace the call to helm-multi-swoop--get-buffer-list, to one that provided a list of buffers using projectiles list.

But now I'm a little stuck. I'm not sure how to create a list of buffers to feed into helm-swoop from a set of file names.

I also can't help but think there's a simpler way to achieve this, maybe without custom functions.

So I'm looking to have helm swoop look at all files in a project, not just the current set of open buffers.

This is so I can use swoop to find all occurrences in a project, mark relevant ones, then edit them (in helm swoops edit mode).

I feel that there's probably a clean way to do this with Helm/Helm swoop but here's my attempt to think through a solution:

  1. gather filenames from projectile
  2. create a list of buffers from the filename list
  3. do the same routine as helm-multi-swoop-all besides using this new buffer list

(projectile-current-project-files), looks like it gives me the file list I'm looking for.

So helm-multi-swoop-all, looks like it'd be fairly easy to copy and then tweak.

(defun helm-multi-swoop-all (&optional $query)
  (interactive)
  "Apply all buffers to helm-multi-swoop"
  (cond ($query
         (setq helm-multi-swoop-query $query))
        (mark-active
         (let (($st (buffer-substring-no-properties
                     (region-beginning) (region-end))))
           (if (string-match "\n" $st)
               (message "Multi line region is not allowed")
             (setq helm-multi-swoop-query
                   (helm-swoop-pre-input-optimize $st)))))
        ((setq helm-multi-swoop-query
               (helm-swoop-pre-input-optimize
                (funcall helm-swoop-pre-input-function))))
        (t (setq helm-multi-swoop-query "")))
  (helm-multi-swoop--exec nil
                          :$query helm-multi-swoop-query
                          :$buflist (helm-multi-swoop--get-buffer-list)))

Just replace the call to helm-multi-swoop--get-buffer-list, to one that provided a list of buffers using projectiles list.

But now I'm a little stuck. I'm not sure how to create a list of buffers to feed into helm-swoop from a set of file names.

I also can't help but think there's a simpler way to achieve this, maybe without custom functions.

So I'm looking to have helm-swoop look at all files in a project, not just the current set of open buffers.

This is so I can use swoop to find all occurrences in a project, mark relevant ones, then edit them (in helm swoops edit mode).

I feel that there's probably a clean way to do this with Helm/Helm swoop but here's my attempt to think through a solution:

  1. gather filenames from projectile
  2. create a list of buffers from the filename list
  3. do the same routine as helm-multi-swoop-all besides using this new buffer list

(projectile-current-project-files), looks like it gives me the file list I'm looking for.

So helm-multi-swoop-all, looks like it'd be fairly easy to copy and then tweak.

(defun helm-multi-swoop-all (&optional $query)
  (interactive)
  "Apply all buffers to helm-multi-swoop"
  (cond ($query
         (setq helm-multi-swoop-query $query))
        (mark-active
         (let (($st (buffer-substring-no-properties
                     (region-beginning) (region-end))))
           (if (string-match "\n" $st)
               (message "Multi line region is not allowed")
             (setq helm-multi-swoop-query
                   (helm-swoop-pre-input-optimize $st)))))
        ((setq helm-multi-swoop-query
               (helm-swoop-pre-input-optimize
                (funcall helm-swoop-pre-input-function))))
        (t (setq helm-multi-swoop-query "")))
  (helm-multi-swoop--exec nil
                          :$query helm-multi-swoop-query
                          :$buflist (helm-multi-swoop--get-buffer-list)))

Just replace the call to helm-multi-swoop--get-buffer-list, to one that provided a list of buffers using projectiles list.

But now I'm a little stuck. I'm not sure how to create a list of buffers to feed into helm-swoop from a set of file names.

I also can't help but think there's a simpler way to achieve this, maybe without custom functions.

Source Link

Helm swoop on all project files (not just current buffers)

So I'm looking to have helm swoop look at all files in a project, not just the current set of open buffers.

This is so I can use swoop to find all occurrences in a project, mark relevant ones, then edit them (in helm swoops edit mode).

I feel that there's probably a clean way to do this with Helm/Helm swoop but here's my attempt to think through a solution:

  1. gather filenames from projectile
  2. create a list of buffers from the filename list
  3. do the same routine as helm-multi-swoop-all besides using this new buffer list

(projectile-current-project-files), looks like it gives me the file list I'm looking for.

So helm-multi-swoop-all, looks like it'd be fairly easy to copy and then tweak.

(defun helm-multi-swoop-all (&optional $query)
  (interactive)
  "Apply all buffers to helm-multi-swoop"
  (cond ($query
         (setq helm-multi-swoop-query $query))
        (mark-active
         (let (($st (buffer-substring-no-properties
                     (region-beginning) (region-end))))
           (if (string-match "\n" $st)
               (message "Multi line region is not allowed")
             (setq helm-multi-swoop-query
                   (helm-swoop-pre-input-optimize $st)))))
        ((setq helm-multi-swoop-query
               (helm-swoop-pre-input-optimize
                (funcall helm-swoop-pre-input-function))))
        (t (setq helm-multi-swoop-query "")))
  (helm-multi-swoop--exec nil
                          :$query helm-multi-swoop-query
                          :$buflist (helm-multi-swoop--get-buffer-list)))

Just replace the call to helm-multi-swoop--get-buffer-list, to one that provided a list of buffers using projectiles list.

But now I'm a little stuck. I'm not sure how to create a list of buffers to feed into helm-swoop from a set of file names.

I also can't help but think there's a simpler way to achieve this, maybe without custom functions.