unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* how to delete a line without putting them into yanking?
@ 2004-09-09  1:43 Rokia
  2004-09-09  1:55 ` maddog
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Rokia @ 2004-09-09  1:43 UTC (permalink / raw)



sometimes when I copy text from other application. and I want to yank
them into some file. so I press ^X^F to open the file, but emacs give
me a default path which I dont want, so I press ^A to goto the head of
this line, and press ^K to delete it, you know,then, when I press ^Y
,what I got is the path string ,not what I really want to paste.

so, how to delete a line without putting them into yanking?

thanks a lot.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: how to delete a line without putting them into yanking?
  2004-09-09  1:43 how to delete a line without putting them into yanking? Rokia
@ 2004-09-09  1:55 ` maddog
  2004-09-09  2:17 ` emacs Fan
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 16+ messages in thread
From: maddog @ 2004-09-09  1:55 UTC (permalink / raw)


Rokia <Rokia@mail.org> writes:

> sometimes when I copy text from other application. and I want to yank
> them into some file. so I press ^X^F to open the file, but emacs give
> me a default path which I dont want, so I press ^A to goto the head of
> this line, and press ^K to delete it, you know,then, when I press ^Y
> ,what I got is the path string ,not what I really want to paste.
>
> so, how to delete a line without putting them into yanking?
>
> thanks a lot.

why not do paste before your C-k?

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: how to delete a line without putting them into yanking?
  2004-09-09  1:43 how to delete a line without putting them into yanking? Rokia
  2004-09-09  1:55 ` maddog
@ 2004-09-09  2:17 ` emacs Fan
       [not found] ` <mailman.2061.1094696629.1998.help-gnu-emacs@gnu.org>
  2004-09-09  4:07 ` Eli Zaretskii
  3 siblings, 0 replies; 16+ messages in thread
From: emacs Fan @ 2004-09-09  2:17 UTC (permalink / raw)
  Cc: help-gnu-emacs

Rokia,

On Thu, 09 Sep 2004 09:43:44 +0800, Rokia <rokia@mail.org> wrote:
> 
> sometimes when I copy text from other application. and I want to yank
> them into some file. so I press ^X^F to open the file, but emacs give
> me a default path which I dont want, so I press ^A to goto the head of
> this line, and press ^K to delete it, you know,then, when I press ^Y
> ,what I got is the path string ,not what I really want to paste.

At that time which you paste a path string, then press M-y to excute a
pop up yank.

And I think you'd better to read the info before you ask so much
question, there are many useful information you need.

Emacs Fan.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: how to delete a line without putting them into yanking?
       [not found] ` <mailman.2061.1094696629.1998.help-gnu-emacs@gnu.org>
@ 2004-09-09  2:42   ` Rokia
  2004-09-09  3:03   ` Rokia
  1 sibling, 0 replies; 16+ messages in thread
From: Rokia @ 2004-09-09  2:42 UTC (permalink / raw)



hehe. thanks for your answer and advice.

I am reading info these days, but it is too much for my poor memory. I
often forget it when I need it even I have read it before.

sorry. :(

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: how to delete a line without putting them into yanking?
       [not found] ` <mailman.2061.1094696629.1998.help-gnu-emacs@gnu.org>
  2004-09-09  2:42   ` Rokia
@ 2004-09-09  3:03   ` Rokia
  2004-09-09  3:34     ` emacs Fan
       [not found]     ` <mailman.2064.1094701218.1998.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 16+ messages in thread
From: Rokia @ 2004-09-09  3:03 UTC (permalink / raw)



sorry, I said that I copy the text from other application.

and in this situation, I cant yank it using M-Y  :(

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: how to delete a line without putting them into yanking?
  2004-09-09  3:03   ` Rokia
@ 2004-09-09  3:34     ` emacs Fan
       [not found]     ` <mailman.2064.1094701218.1998.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 16+ messages in thread
From: emacs Fan @ 2004-09-09  3:34 UTC (permalink / raw)


Rokia,

> sorry, I said that I copy the text from other application.
> and in this situation, I cant yank it using M-Y  :(

I think there many ways to solve your problem.
1. yank the text from other application, undo it, kill your path line,
pop up yank.

2. delete rectangle by C-x, r,d,  then the path will not be put into yank ring

3. write a lisp function to delete the path line, not kill it.

emacs fan

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: how to delete a line without putting them into yanking?
  2004-09-09  1:43 how to delete a line without putting them into yanking? Rokia
                   ` (2 preceding siblings ...)
       [not found] ` <mailman.2061.1094696629.1998.help-gnu-emacs@gnu.org>
@ 2004-09-09  4:07 ` Eli Zaretskii
  2004-09-09  4:30   ` emacs Fan
       [not found]   ` <mailman.2075.1094704580.1998.help-gnu-emacs@gnu.org>
  3 siblings, 2 replies; 16+ messages in thread
From: Eli Zaretskii @ 2004-09-09  4:07 UTC (permalink / raw)


> From: Rokia <Rokia@mail.org>
> Date: Thu, 09 Sep 2004 09:43:44 +0800
> 
> sometimes when I copy text from other application. and I want to yank
> them into some file. so I press ^X^F to open the file, but emacs give
> me a default path which I dont want, so I press ^A to goto the head of
> this line, and press ^K to delete it, you know,then, when I press ^Y
> ,what I got is the path string ,not what I really want to paste.
> 
> so, how to delete a line without putting them into yanking?

Either use DEL to delete the old path, or open the file first and copy
from the other application after the file is already open.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: how to delete a line without putting them into yanking?
  2004-09-09  4:07 ` Eli Zaretskii
@ 2004-09-09  4:30   ` emacs Fan
       [not found]   ` <mailman.2075.1094704580.1998.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 16+ messages in thread
From: emacs Fan @ 2004-09-09  4:30 UTC (permalink / raw)


> Either use DEL to delete the old path, or open the file first and copy
> from the other application after the file is already open.

Yes, there is even a more convenient  way, I think.
After presss C-x, C-f, just ignore the default path.
At the end of the default path, input your path(~/path or complete
path), it is also ok.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: how to delete a line without putting them into yanking?
       [not found]     ` <mailman.2064.1094701218.1998.help-gnu-emacs@gnu.org>
@ 2004-09-09  6:08       ` Rokia
  2004-09-09 20:28       ` Ole Laursen
  1 sibling, 0 replies; 16+ messages in thread
From: Rokia @ 2004-09-09  6:08 UTC (permalink / raw)


bingo!

the second one is what I really want!

thank you again and again. 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: how to delete a line without putting them into yanking?
       [not found]   ` <mailman.2075.1094704580.1998.help-gnu-emacs@gnu.org>
@ 2004-09-09  6:10     ` Rokia
  0 siblings, 0 replies; 16+ messages in thread
From: Rokia @ 2004-09-09  6:10 UTC (permalink / raw)


bravo!

it really works! thank you :D

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: how to delete a line without putting them into yanking?
       [not found]     ` <mailman.2064.1094701218.1998.help-gnu-emacs@gnu.org>
  2004-09-09  6:08       ` Rokia
@ 2004-09-09 20:28       ` Ole Laursen
  2004-09-10  8:54         ` Rokia
  2004-09-10 15:06         ` emacs Fan
  1 sibling, 2 replies; 16+ messages in thread
From: Ole Laursen @ 2004-09-09 20:28 UTC (permalink / raw)


emacs Fan <emacsNT@gmail.com> writes:

[...]

> 3. write a lisp function to delete the path line, not kill it.

Here's one. Just put in your Emacs file and bind it to some key with
something alongs:

  (global-set-key (kbd "C-c d") 'delete-line)



;; for some reason Emacs lacks delete-line, implementing it with the
;; source from kill-line is, however, trivial
(defun delete-line (&optional arg)
  "Delete the rest of the current line; if no nonblanks there, delete
thru newline. With prefix argument, delete that many lines from point.
Negative arguments delete lines backward.

When calling from a program, nil means \"no arg\", a number counts as
a prefix arg.

To delete a whole line, when point is not at the beginning, type \
\\[beginning-of-line] \\[delete-line] \\[delete-line].

If `kill-whole-line' is non-nil, then this command deletes the whole line
including its terminating newline, when used at the beginning of a line
with no argument.  As a consequence, you can always delete a whole line
by typing \\[beginning-of-line] \\[delete-line]."
  (interactive "P")
  (delete-region (point)
	       ;; It is better to move point to the other end of the
	       ;; delete before deleting. That way, in a read-only
	       ;; buffer, point moves across the text that is to be
	       ;; delete. The choice has no effect on undo now that
	       ;; undo records the value of point from before the
	       ;; command was run.
	       (progn
		 (if arg
		     (forward-visible-line (prefix-numeric-value arg))
		   (if (eobp)
		       (signal 'end-of-buffer nil))
		   (if (or (looking-at "[ \t]*$") (and kill-whole-line (bolp)))
		       (forward-visible-line 1)
		     (end-of-visible-line)))
		 (point))))


-- 
Ole Laursen
http://www.cs.aau.dk/~olau/

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: how to delete a line without putting them into yanking?
  2004-09-09 20:28       ` Ole Laursen
@ 2004-09-10  8:54         ` Rokia
  2004-09-10 13:04           ` J. David Boyd
                             ` (2 more replies)
  2004-09-10 15:06         ` emacs Fan
  1 sibling, 3 replies; 16+ messages in thread
From: Rokia @ 2004-09-10  8:54 UTC (permalink / raw)



:(

I add this:   (global-set-key (kbd "C-c d") 'delete-line)

when I press "C-c d" , I got this prompt:

Symbol's defination is void :delete-line

what's wrong. need I install some additional library?

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: how to delete a line without putting them into yanking?
  2004-09-10  8:54         ` Rokia
@ 2004-09-10 13:04           ` J. David Boyd
  2004-09-10 14:51           ` Mathias Dahl
  2004-09-10 15:14           ` Michael Slass
  2 siblings, 0 replies; 16+ messages in thread
From: J. David Boyd @ 2004-09-10 13:04 UTC (permalink / raw)


You need to cut and paste the defun for delete-line into your .emacs file.  

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: how to delete a line without putting them into yanking?
  2004-09-10  8:54         ` Rokia
  2004-09-10 13:04           ` J. David Boyd
@ 2004-09-10 14:51           ` Mathias Dahl
  2004-09-10 15:14           ` Michael Slass
  2 siblings, 0 replies; 16+ messages in thread
From: Mathias Dahl @ 2004-09-10 14:51 UTC (permalink / raw)


Rokia <Rokia@yahoo.com.cn.discuss> writes:


> I add this:   (global-set-key (kbd "C-c d") 'delete-line)
> 
> when I press "C-c d" , I got this prompt:
> 
> Symbol's defination is void :delete-line
> 
> what's wrong. need I install some additional library?

Yes, probably. delete-line is not in a standard Emacs
install. At least not in mine (21.3).

Try this:

1. Put cursor somewhere on a line
2. C-x (
3. C-a
4. C-k
5. C-x )

Now you have recorded a macro that you can give a name:

6. M-x name-last-kbd-macro RET my-kill-line RET

Insert the macro definition in your .emacs file by opening
.emacs and going to the end of the buffer:

7. insert-kbd-macro RET my-kill-line RET

Bind the new macro using the method you tried before.

/Mathias

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: how to delete a line without putting them into yanking?
  2004-09-09 20:28       ` Ole Laursen
  2004-09-10  8:54         ` Rokia
@ 2004-09-10 15:06         ` emacs Fan
  1 sibling, 0 replies; 16+ messages in thread
From: emacs Fan @ 2004-09-10 15:06 UTC (permalink / raw)
  Cc: help-gnu-emacs

On Thu, 09 Sep 2004 22:28:27 +0200, Ole Laursen <olau@hardworking.dk> wrote:
> > 3. write a lisp function to delete the path line, not kill it.
> 
> Here's one. Just put in your Emacs file and bind it to some key with
> something alongs:
> 
>  (global-set-key (kbd "C-c d") 'delete-line)
>.......
>  (interactive "P")
>  (delete-region (point)
>               (progn
>                 (if arg
>                     (forward-visible-line (prefix-numeric-value arg))
>                   (if (eobp)
>                       (signal 'end-of-buffer nil))
>                   (if (or (looking-at "[ \t]*$") (and kill-whole-line (bolp)))
>                       (forward-visible-line 1)
>                     (end-of-visible-line)))
>                 (point))))
> 
> --
> Ole Laursen
> http://www.cs.aau.dk/~olau/

It works.
Thanks, you really did it.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: how to delete a line without putting them into yanking?
  2004-09-10  8:54         ` Rokia
  2004-09-10 13:04           ` J. David Boyd
  2004-09-10 14:51           ` Mathias Dahl
@ 2004-09-10 15:14           ` Michael Slass
  2 siblings, 0 replies; 16+ messages in thread
From: Michael Slass @ 2004-09-10 15:14 UTC (permalink / raw)


Rokia <Rokia@yahoo.com.cn.discuss> writes:

>:(
>
>I add this:   (global-set-key (kbd "C-c d") 'delete-line)
>
>when I press "C-c d" , I got this prompt:
>
>Symbol's defination is void :delete-line
>
>what's wrong. need I install some additional library?

Perhaps you should read the rest of Ole's reply to your original
question, in which he has taken the time to implement the delete-line
function for you, and told you to paste it into your .emacs.

If you can't take the trouble to do anything yourself, you're going to
quickly burn through much of the goodwill available on this group.

-- 
Mike Slass

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2004-09-10 15:14 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-09  1:43 how to delete a line without putting them into yanking? Rokia
2004-09-09  1:55 ` maddog
2004-09-09  2:17 ` emacs Fan
     [not found] ` <mailman.2061.1094696629.1998.help-gnu-emacs@gnu.org>
2004-09-09  2:42   ` Rokia
2004-09-09  3:03   ` Rokia
2004-09-09  3:34     ` emacs Fan
     [not found]     ` <mailman.2064.1094701218.1998.help-gnu-emacs@gnu.org>
2004-09-09  6:08       ` Rokia
2004-09-09 20:28       ` Ole Laursen
2004-09-10  8:54         ` Rokia
2004-09-10 13:04           ` J. David Boyd
2004-09-10 14:51           ` Mathias Dahl
2004-09-10 15:14           ` Michael Slass
2004-09-10 15:06         ` emacs Fan
2004-09-09  4:07 ` Eli Zaretskii
2004-09-09  4:30   ` emacs Fan
     [not found]   ` <mailman.2075.1094704580.1998.help-gnu-emacs@gnu.org>
2004-09-09  6:10     ` Rokia

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).