unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* C-k and scolding
       [not found] ` <87znn8tdn5.fsf@pfaff.Stanford.EDU>
@ 2003-04-03 20:04   ` Dan Jacobson
  2003-04-04  0:18     ` Ben Pfaff
  2003-04-14 21:04     ` Bruce Kroeze
  0 siblings, 2 replies; 7+ messages in thread
From: Dan Jacobson @ 2003-04-03 20:04 UTC (permalink / raw)
  Cc: debian-emacsen

>> Hi all.  I ran into a slight difficulty.  In emacs, i realise you can
>> do C-w and C-SPC to cut tetxt from a buffer which can then be yanked
>> into a buffer with C-Y.  However, if you are reviewing a buffer that
>> is read only, you cannot grab the text out in this way.  

Ben> Actually, you can.  It will beep at you and the text will not be
Ben> removed from the buffer, but it will still go into the kill ring.

This brings up the interesting concept of here we are having emacs
scolding us for doing something improper while at the same time if we
were to do it the proper way, it would take more keystrokes.

Moms wonder why kids just don't listen these days, etc.  Youngsters
just don't seem to have respect for the law, etc. 

>> So is there a command in emacs which allows you to copy a block
>> rather than cut it.  Thanks.  Mat.

Ben> Use M-w instead of C-w.

Take the case of a single C-k.  To do this the proper way in a
read-only buffer etc. one needs to set a mark, go the end of line, and
hit M-w. Much more trouble than just a C-k while accepting the
sadomasochistic beep.

So there should be a way, just as easy as one or more C-k's, to do
what C-k does (as far as adding to the kill ring), without getting
beeped, nor without changing the file.

P.S. be sure to followup to bug-gnu-emacs@gnu.org not
debian-emacsen@lists.debian.org
-- 
http://jidanni.org/ Taiwan(04)25854780

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

* Re: C-k and scolding
  2003-04-03 20:04   ` C-k and scolding Dan Jacobson
@ 2003-04-04  0:18     ` Ben Pfaff
  2003-04-14 21:04     ` Bruce Kroeze
  1 sibling, 0 replies; 7+ messages in thread
From: Ben Pfaff @ 2003-04-04  0:18 UTC (permalink / raw)
  Cc: debian-emacsen

Dan Jacobson <jidanni@dman.ddts.net> writes:

> Take the case of a single C-k.  To do this the proper way in a
> read-only buffer etc. one needs to set a mark, go the end of line, and
> hit M-w. Much more trouble than just a C-k while accepting the
> sadomasochistic beep.

I just (setq visible-bell t).  Much easier to ignore than an
audible bell.

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

* Re: C-k and scolding
  2003-04-03 20:04   ` C-k and scolding Dan Jacobson
  2003-04-04  0:18     ` Ben Pfaff
@ 2003-04-14 21:04     ` Bruce Kroeze
  2003-04-17  1:14       ` decriminalize C-k in read-only buffers! Dan Jacobson
  1 sibling, 1 reply; 7+ messages in thread
From: Bruce Kroeze @ 2003-04-14 21:04 UTC (permalink / raw)
  Cc: bug-gnu-emacs

On Thursday 03 April 2003 12:04 pm, Dan Jacobson wrote:
> Take the case of a single C-k.  To do this the proper way in a
> read-only buffer etc. one needs to set a mark, go the end of line, and
> hit M-w. Much more trouble than just a C-k while accepting the
> sadomasochistic beep.
>
> So there should be a way, just as easy as one or more C-k's, to do
> what C-k does (as far as adding to the kill ring), without getting
> beeped, nor without changing the file.

Here you go, a couple small functions I wrote for this very purpose:

(defun copy-line (&optional where)
  "Copy the line containing point."
  (interactive "d")
  (save-excursion
    (beginning-of-line)
    (let ((beg (point)))
      (end-of-line)
      (copy-region-as-kill beg (point)))
    (end-of-line))
    (message "copied line"))

(defun copy-to-eol (&optional where)
  "Copy to the end of the line containing point."
  (interactive "d")
  (save-excursion
    (let ((beg (point)))
      (end-of-line)
      (copy-region-as-kill beg (point)))
    (end-of-line))
    (message "copied to eol"))

;; I bind 'em to "one-step" keys, your tastes are likely different.
(define-key global-map [(alt ?c)] 'copy-line)
(define-key global-map [(alt ?k)] 'copy-to-eol)

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

* decriminalize C-k in read-only buffers!
  2003-04-14 21:04     ` Bruce Kroeze
@ 2003-04-17  1:14       ` Dan Jacobson
  0 siblings, 0 replies; 7+ messages in thread
From: Dan Jacobson @ 2003-04-17  1:14 UTC (permalink / raw)


"C-k runs the command kill-line ... If the buffer is read-only, Emacs
will beep and refrain from deleting the line, but put the line in the
kill ring anyway.  This means that you can use this command to copy
text from a read-only buffer."

OK, but what if we're bored with S/M and want to turn the little
tingle off?  (You see, mother has wired the bell to electrodes on my
head to teach me proper computing and not wake her up.)

Bruce suggests:
B> (defun copy-to-eol (&optional where)
B>   "Copy to the end of the line containing point."
B>   (interactive "d")
B>   (save-excursion
B>     (let ((beg (point)))
B>       (end-of-line)
B>       (copy-region-as-kill beg (point)))
B>     (end-of-line))
B>     (message "copied to eol"))

OK, but wait, original kill-line with the flashes/beeps moves the
cursor down upon repetition, nifty. Yours just stays there...

Maybe we should just push for a variable to decriminalize [no
flashing] C-k when the buffer is readonly. With maybe a  message, in
the minibuffer, if the user prefers.

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

* Re: decriminalize C-k in read-only buffers!
       [not found] <mailman.4771.1050547363.21513.bug-gnu-emacs@gnu.org>
@ 2003-04-17  2:59 ` David Kastrup
  2003-04-18 22:09   ` Dan Jacobson
       [not found]   ` <mailman.4920.1050711088.21513.bug-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 7+ messages in thread
From: David Kastrup @ 2003-04-17  2:59 UTC (permalink / raw)


Dan Jacobson <jidanni@dman.ddts.net> writes:

> "C-k runs the command kill-line ... If the buffer is read-only, Emacs
> will beep and refrain from deleting the line, but put the line in the
> kill ring anyway.  This means that you can use this command to copy
> text from a read-only buffer."
> 
> OK, but what if we're bored with S/M and want to turn the little
> tingle off?  (You see, mother has wired the bell to electrodes on my
> head to teach me proper computing and not wake her up.)

[...]

> Maybe we should just push for a variable to decriminalize [no
> flashing] C-k when the buffer is readonly. With maybe a  message, in
> the minibuffer, if the user prefers.

kill-read-only-ok's value is nil

*Non-nil means don't signal an error for killing read-only text.

You can customize this variable.

Defined in `simple'.

[back]

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: decriminalize C-k in read-only buffers!
  2003-04-17  2:59 ` David Kastrup
@ 2003-04-18 22:09   ` Dan Jacobson
       [not found]   ` <mailman.4920.1050711088.21513.bug-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 7+ messages in thread
From: Dan Jacobson @ 2003-04-18 22:09 UTC (permalink / raw)


>>>>> "D" == David Kastrup <dak@gnu.org> writes:

D> Dan Jacobson <jidanni@dman.ddts.net> writes:
>> "C-k runs the command kill-line ... If the buffer is read-only, Emacs
>> will beep and refrain from deleting the line, but put the line in the
>> kill ring anyway.  This means that you can use this command to copy
>> text from a read-only buffer."
>> 
>> OK, but what if we're bored with S/M and want to turn the little
>> tingle off?  (You see, mother has wired the bell to electrodes on my
>> head to teach me proper computing and not wake her up.)

D> [...]

>> Maybe we should just push for a variable to decriminalize [no
>> flashing] C-k when the buffer is readonly. With maybe a  message, in
>> the minibuffer, if the user prefers.

D> kill-read-only-ok's value is nil

D> *Non-nil means don't signal an error for killing read-only text.

Oh great. Why don't they document it when one does C-h k C-k?  That
way we wouldn't have wasted all this time and coding as you can see in
previous messages.  Looking in Info "Other Kill Commands"

     You can use kill commands in read-only buffers.  They don't actually
  change the buffer, and they beep to warn you of that, but they do copy
  the text you tried to kill into the kill ring, so you can yank it into
  other buffers.  Most of the kill commands move point across the text
  they copy in this way, so that successive kill commands build up a
  single kill ring entry as usual.

we of course see no mention of it either.  Oh look, it is mentioned in
"Deletion and Killing".

I just did C-h k C-w and see we are told to accept the beep and no
remedy is mentioned too...

Anyways, the emacs documenter was clearly sleeping on the job, talking
about beeps but not talking how to turn them off when there is a way
just for that purpose... causing me to appear clumsy and pompous yet again! 
-- 
http://jidanni.org/ Taiwan(04)25854780

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

* Re: decriminalize C-k in read-only buffers!
       [not found]   ` <mailman.4920.1050711088.21513.bug-gnu-emacs@gnu.org>
@ 2003-04-21 15:54     ` Kevin Rodgers
  0 siblings, 0 replies; 7+ messages in thread
From: Kevin Rodgers @ 2003-04-21 15:54 UTC (permalink / raw)


Dan Jacobson wrote:

>>>>>>"D" == David Kastrup <dak@gnu.org> writes:
> D> kill-read-only-ok's value is nil
> 
> D> *Non-nil means don't signal an error for killing read-only text.
...
> Anyways, the emacs documenter was clearly sleeping on the job, talking
> about beeps but not talking how to turn them off when there is a way
> just for that purpose... causing me to appear clumsy and pompous yet again! 

No, it is the tone of your message that causes you to appear pompous.  Why
don't you for once submit a patch instead of just complaining?

-- 
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>

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

end of thread, other threads:[~2003-04-21 15:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <73388857A695D31197EF00508B08F2980A00EEEC@ntmsg0131.corpmail.telstra.com.au>
     [not found] ` <87znn8tdn5.fsf@pfaff.Stanford.EDU>
2003-04-03 20:04   ` C-k and scolding Dan Jacobson
2003-04-04  0:18     ` Ben Pfaff
2003-04-14 21:04     ` Bruce Kroeze
2003-04-17  1:14       ` decriminalize C-k in read-only buffers! Dan Jacobson
     [not found] <mailman.4771.1050547363.21513.bug-gnu-emacs@gnu.org>
2003-04-17  2:59 ` David Kastrup
2003-04-18 22:09   ` Dan Jacobson
     [not found]   ` <mailman.4920.1050711088.21513.bug-gnu-emacs@gnu.org>
2003-04-21 15:54     ` Kevin Rodgers

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).