all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: 18100@debbugs.gnu.org
Subject: bug#18100: 24.4.50; Restore simplicity of (put 'self-insert-command 'delete-selection 'kill)
Date: Thu, 24 Jul 2014 10:22:23 -0700 (PDT)	[thread overview]
Message-ID: <4aea5d8d-c60c-4213-ad3d-1f701b50792a@default> (raw)

This is a followup to bug #13312, whose status is "Fixed in version
24.4".

The #13312 bug thread included this exchange between me and Juri Linkov:

From me:
--------

  > But when you want put `kill' as the `delete-selection' property
  > then it's better to use this code:
  > (put 'self-insert-command 'delete-selection
  >      (lambda ()
  >        (and (not (run-hook-with-args-until-success
  > 		  'self-insert-uses-region-functions))
  > 	    'kill)))

  Maybe so, but that is not at all what the `delete-selection-mode' doc
  & comments tell users.  If this is a new requirement/guideline, then
  it needs to be documented.

  But I wonder why this must now be so.  In the past, a user could just
  put `kill' as the property.  The code does not seem so clean now.

  One of the benefits of the `delsel.el' design (and yes, along with
  those benefits come also some disadvantages) is its simplicity for
  users.

  This seems to go against that.  Is it really necessary?  Isn't there
  another way to accomplish the same thing (whatever that is), so we can
  keep the simple and clean design for users?

  What was the reason for introducing
  `self-insert-uses-region-functions'?  It seems it was only for
  `electric-pair-mode'.  IIRC, I wasn't too happy with that hack when it
  was done.  Now it seems to be dirtying (complicating) `delsel.el'.
  Isn't there a better way?

  But again, we should probably be discussing this elsewhere, since it
  does not seem to be only about this bug.

  ...

  Users should be able to `put' a single, understandable symbol as the
  `delete-selection' property value.  They should not need to fiddle
  with obscure lambda forms (or symbols whose names are not simple to
  understand).  Symbol `kill' is simple - it says that you want the
  region to be killed.

  This simplicity was the case before (`delsel.el' is old and simple).
  Someone introduced `electric-pair-mode', and then someone else
  complained about its interaction with `delete-selection-mode'.  The
  fix for that should not have involved screwing
  `delete-selection-mode', as seems to be the case so far.

Juri's reply:
-------------

  I think (run-hook-with-args-until-success
  'self-insert-uses-region-functions) could be moved to the body of
  `delete-selection-helper'.  Then the users again will enjoy the
  simplicity of (put 'self-insert-command 'delete-selection t)
  and (put 'self-insert-command 'delete-selection 'kill)

To which I replied: "That sounds good.  Thank you, Juri."

This new bug is about getting that fixed, IOW, restoring the ability to
use a simple `put' to configure `delete-selection-mode' behavior for a
given command, rather than having to jump through hoops with
incomprehensible lambda forms in the `put' value.  IOW not make users do
things like this:

> (put 'self-insert-command 'delete-selection
>      (lambda ()
>        (and (not (run-hook-with-args-until-success
> 		  'self-insert-uses-region-functions))
> 	    'kill)))


In GNU Emacs 24.4.50.1 (i686-pc-mingw32)
 of 2014-06-28 on ODIEONE
Bzr revision: 117431 rgm@gnu.org-20140628015517-eku6hj8mpgcvfnso
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --prefix=/c/Devel/emacs/snapshot/trunk
 --enable-checking=yes,glyphs 'CFLAGS=-O0 -g3'
 LDFLAGS=-Lc:/Devel/emacs/lib 'CPPFLAGS=-DGC_MCHECK=1
 -Ic:/Devel/emacs/include''





             reply	other threads:[~2014-07-24 17:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-24 17:22 Drew Adams [this message]
2022-05-11 15:02 ` bug#18100: 24.4.50; Restore simplicity of (put 'self-insert-command 'delete-selection 'kill) Lars Ingebrigtsen
2022-05-11 20:09   ` Drew Adams
2022-05-12 16:56     ` Juri Linkov
2022-05-12 17:30       ` Drew Adams

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

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

  git send-email \
    --in-reply-to=4aea5d8d-c60c-4213-ad3d-1f701b50792a@default \
    --to=drew.adams@oracle.com \
    --cc=18100@debbugs.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.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.