help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: copy-line


From: Samuel Wales
Subject: Re: copy-line
Date: Sat, 31 Jan 2009 19:06:06 -0700

(defun alpha-open-line-entire (&optional arg)
  "Open a line above.  If there is a prefix argument of just C-u,
then repeat the line.  If there are two, repeat and comment.  If
there is a natural numeric argument, repeat that many lines."
  (interactive "*P")
  (if arg
      (progn
        (repeat-line (if (consp arg) 1 (prefix-numeric-value arg)))
        ;;put a commented line in front of the line
        (when (= (car arg) 16)
          (comment-region (point-at-bol) (point-at-eol))
          ;;this misplaces point, but cannot be fixed without
          ;;knowing whether ;;; or ;; or #.
          (next-line)
          '(back-to-indentation)))
    (progn
      (beginning-of-line)
      ;;2004-01-30 open-line just went awol, acting like yank
      ;;(open-line 1)
      (newline 1)
      (forward-line -1)
      (unless (bobp)
        ;;(let ((indent-line-function 'alpha-indent-to-next-indentation))
        (indent-according-to-mode)))))


On Sat, Jan 31, 2009 at 11:26, Helmut Eller <address@hidden> wrote:
> Hello,
>
> is there a command (and standard key) to copy the current line?  The
> command should duplicate the text of the current line and move point to
> the copied line.  I think that vi has something like that, and
> occasionally it would be quite useful.
>
> I can write that myself but maybe Emacs has something already and I
> don't know it?  It's also a bit hard to find a free key :-)
>
> Helmut.
>



-- 
For personal and corporate gain, myalgic encephalomyelitis denialists
are knowingly causing massive suffering and 25-years-early death by
grossly corrupting science.
http://www.meactionuk.org.uk/What_Is_ME_What_Is_CFS.htm




reply via email to

[Prev in Thread] Current Thread [Next in Thread]