* 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; 4+ 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] 4+ 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; 4+ 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] 4+ 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; 4+ 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] 4+ 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; 4+ 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] 4+ messages in thread
end of thread, other threads:[~2003-04-17 1:14 UTC | newest] Thread overview: 4+ 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
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).