unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Xah <xahlee@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: No copy when killing
Date: Sun, 15 Jun 2008 04:27:52 -0700 (PDT)	[thread overview]
Message-ID: <7815d58b-3f37-4320-af94-178611ff3950@z24g2000prf.googlegroups.com> (raw)
In-Reply-To: 0cd27ea8-87cb-4891-8cce-8887be2aa949@e39g2000hsf.googlegroups.com

i thought about the issue a bit. That is, about whether using kill
commands putting erased text into the kill-ring creates more efficient
work mode.

For this purpose, i wrote the equivalent non-kill versions and gonna
use it myself to experiment.

Here's the code, a bit more robust than in my previous post.

(defun my-delete-word (arg)
  "Delete characters forward until encountering the end of a word.
With argument, do this that many times.
This command does not push erased text to kill-ring."
  (interactive "p")
  (delete-region (point) (progn (forward-word arg) (point))))

(defun my-backward-delete-word (arg)
  "Delete characters backward until encountering the beginning of a
word.
With argument, do this that many times.
This command does not push erased text to kill-ring."
  (interactive "p")
  (my-delete-word (- arg)))

(defun my-delete-line ()
  "Delete text from current position to end of line char."
  (interactive)
  (delete-region
   (point)
   (save-excursion (move-end-of-line 1) (point)))
  (delete-char 1)
)

(defun my-delete-line-backward ()
  "Delete text between the beginning of the line to the cursor
position."
  (interactive)
  (let (x1 x2)
    (setq x1 (point))
    (move-beginning-of-line 1)
    (setq x2 (point))
    (delete-region x1 x2)))

; Here's the code to bind them with emacs's default shortcut keys:

(global-set-key (kbd "C-S-k") 'my-delete-line-backward)
(global-set-key (kbd "C-k") 'my-delete-line)
(global-set-key (kbd "M-d") 'my-delete-word)
(global-set-key (kbd "<M-backspace>") 'my-backward-delete-word)

----------------------------------
Some random comments and thoughts follows.

initial first day experience of using the above is that its annoying,
of course due to habit of 10 years with emacs ways.

Note that emacs commands that contains the word “kill” is meant to
push text into the kill-ring. So, instead of naming “my-kill-line”,
more proper naming in the context of emacs is “delete-line” or “my-
delete-line”, thus i've named them above.

Also included above is a my-delete-line-backward, which is like kill-
line but from cursor point to begining of line, as opposed to end of
line. I've been using this command together with my ergonomic keyboard
shortcut set for over a year now and find it convenient.

It seems logical that emacs does not provide a option for the kill
commands to not push to the kill-ring. To provide that option would be
breaking the original design's consistency, because text-erasing
commands with “kill” in their names are supposed to work with the
“kill-ring”.

But, suppose non-kill is something we absolutely need in emacs, then
it can be still done without breaking design, by providing the set of
new function without using the word “kill” in them as above. When user
opt to the non-kill version, then the keybinding for these kill
commands will switch to the non-kill set of commands that has “delete”
in their names.

Since about 2005 i thought about many emacs issues of its non-standard
or non-conventional user interface. That is why the “kill” issue is
interesting to me. For vast majority of professional programers,
perhaps 99.99%, the emacs ways of intermingling the kill-ring with
modern concept of “clipboard” is unfamilar, thus a setback.

I started to use emacs in 1998 and by 1999 i live in emacs daily. I
don't remember now, but undoubtly i was also surprised by emacs's mix
of “kill” and “clipboard” in the beginning, however, i quickly adopted
it and don't remember ever thought about it.

In the past few years, sometimes i also run into the problem where i
don't want killed text to offset whatever i have copied to the
“clipboard”. In such a occation, of course, you select the text then
hit the delete key, so that the “clipboard” is still intact.
Alternatively, i learned to use the emacs feature of “register” (which
is another form of “clipboard”).

In the end, the interesting question is whether emacs way of pushing
into kill-ring on deleting word/line/sentence is more operatively
efficient.  By “operatively efficient”, i meant of less keystrokes or
more intuitive, for general editing tasks. This can be tested at least
theoretically, by imagining 2 groups of emacs users of equal
experience, one group having used a emacs version such that kill-line,
kill-word, backward-kill-word don't push to the kill-ring. While the
other group uses the standard emacs. Then, suppose we record their
keystrokes and command calls for a few months, then we can mine or
analyse the keystroke log and see whether one way is better. This may
sound too complicated to carry out... but actually i think if any long
time emacs user actually tried the above for at least 2 months, he can
get a sense of which one is more operatively efficient. (this would be
like adopting dvorak keyboard, the first week will be extreme pain in
the ass. But only after full adoption, one can truly judge)

It's my guess that the operative efficiency of the two methods
actually doesn't differ that much. That is, one method might be more
convenient or save keystrokes sometimes, but not always. If this is
so, then emacs would be much better off, if it adopts the more widely
familiar interface by not having the delete word/line/sentence
shorcuts push into the kill-ring/clipboard.

  Xah
∑ http://xahlee.org/

  parent reply	other threads:[~2008-06-15 11:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-14  9:24 No copy when killing rock69
2008-06-14  9:54 ` Xah
2008-06-14 10:18   ` rock69
2008-06-14 14:01     ` Xah
2008-06-15 11:27     ` Xah [this message]
2008-06-17  6:44       ` Xah
2008-06-16 17:21 ` Steinar Bang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7815d58b-3f37-4320-af94-178611ff3950@z24g2000prf.googlegroups.com \
    --to=xahlee@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).