0

This is my usecase:

  1. Open file1
  2. store the text in register a using C-x r s a
  3. Go to another place, store the text in register a using C-x r s b
  4. Go to file, store the text in register a using C-x r s c
  5. Invoke helm-swoop
  6. Insert the content of the registers a, b, c with \| i.e. (text_in_rega\|text_in_regb\|text_in_regc\)
  7. M-i
  8. This will show me the grep like across files, I can use C-c C-e and edit multiple files at once and save them.
  9. This is a big time saver in verilog.
4
  • One possible solution is adding an action on helm-register to invoke helm-swoop.
    – xuchunyang
    Dec 2, 2017 at 14:44
  • What is the question?
    – Drew
    Dec 2, 2017 at 15:45
  • The question is - "How do I insert text saved in registers, within the helm-swoop minibuffer" ? Dec 2, 2017 at 17:09
  • Or - Is there a way, where I can write a small function to automate the steps - 5 & 6. I tried writing one like this... (defun test0 () (interactive) (let ((ctext (concat "(" (insert-register a 't) "\|" (insert-register b 't) "\|" (insert-register c 't))))) - but this is not working (message "Current Dir yank(ed). %s" ctext) ) Dec 2, 2017 at 17:11

1 Answer 1

1
;; STrip text properties - taken from https://stackoverflow.com/questions/8372722/print-only-text-discarding-text-properties

(defun strip-text-properties(txt)
  (set-text-properties 0 (length txt) nil txt)
      txt)

;;new function        
(defun swoop-test0 ()
    (interactive)
   (let ((ctext (concat "\\(\\_<" (strip-text-properties (get-register ?a)) "\\_>\\|\\_<"  (strip-text-properties (get-register ?b)) "\\_>\\)")))
    (helm-swoop :$query ctext )
   )
  )

I need to make it more clean by checking if the register is nil.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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