emacs - Mark region and insert prefix -


I have recently switched from vi to emacs, and now I am porting my most important macros to emacs I am Ability to prefix the first area of ​​the text marked with a string including headers and footers what I need most:

Original:

  line 1 line 2 line After marking row 3 and 4, I want Emacs to ask me a number, say 002, and do the following, remember my choice:  
  line1 * # 002 # Start: * $ line 2 * $ line 3 * # 002 # finite So far, I have been able to insert the start and end tag with the following code:  
  (inline comment-field) "4"   

("* # Xxx # end. \ N") (goto-four start) (enter "* # xxx # start \") However, I can not seem to know that in this area, *

Any ideas? "Post-text" itempro P = "text">

I have solved this kind of problems dynamically generate a snippet recently.

Here is the code:

  ('yasnippet is required') (defun cobol-comment-region (comment) "Comment on an area as COBOL (Rows 2,3 have been commented) Line 1 * # 002 # Start: * $ line 2 * $ line 3 * # 002 # end row 4 "(interactive" * R ") (setic arms (ball-at -bol 1) (point-at-bol 1) end (preggen (goto-char end) (if (bolt) (point) (forward-line 1) (if (bolp) (point) (insert "n") ( PoE Nt)))) () () ((str (re-regexp-in-string "^" "* $" (buffer-sub-property-property-property) Sequence (1- end))) (template (concat "* # $ {1: 002} # start: \ n" str "\ n * # $ 1 # end. \ N")) (as-indent -line 'fixed)) (start-delete field) (as-snippet template)))   

contains video, what << / h1>

is in action here:

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

jsp - Google line chart x-axis shrinks on transition -

java - Reaching JTextField in a DocumentListener -