home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / me34exe.zip / mutt / contrib / dupline.mut < prev    next >
Lisp/Scheme  |  1995-01-14  |  852b  |  29 lines

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;; duplicate-line: Duplicate current line without using the cut      ;
  3. ;;            buffer. Stay on the same column on the duplicated line.;
  4. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  5. ;; Nadav Horesh Public Domain  2/93
  6.  
  7. (include me.mh)
  8.  
  9. (defun duplicate-line {
  10.   (int mark1 column bag)
  11.  
  12.   (mark1 (create-mark))
  13.   (bag (create-bag))
  14.  
  15.   (column (current-column))
  16.   (beginning-of-line)                ;; mark beginning of line
  17.   (set-mark mark1)
  18.   (forward-line 1)
  19.   (append-to-bag bag APPEND-REGION mark1 0)   ;; copy the line to bag
  20.   ;; (newline)                              ;; open new line
  21.   (insert-bag bag)                     ;; duplicate buffer to new line
  22.   (forward-line -1)
  23.   (current-column column)              ;; restore column
  24.  
  25.   (free-mark mark1)
  26.   (free-bag bag)
  27.  }
  28. )
  29.