GNU bug report logs - #18100
24.4.50; Restore simplicity of (put 'self-insert-command 'delete-selection 'kill)

Previous Next

Package: emacs;

Reported by: Drew Adams <drew.adams <at> oracle.com>

Date: Thu, 24 Jul 2014 17:24:01 UTC

Severity: wishlist

Found in version 24.4.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18100 in the body.
You can then email your comments to 18100 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#18100; Package emacs. (Thu, 24 Jul 2014 17:24:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Drew Adams <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 24 Jul 2014 17:24:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: bug-gnu-emacs <at> gnu.org
Cc: Juri Linkov <juri <at> jurta.org>
Subject: 24.4.50; Restore simplicity of (put 'self-insert-command
 'delete-selection 'kill)
Date: Thu, 24 Jul 2014 10:22:23 -0700 (PDT)
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 <at> 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''




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18100; Package emacs. (Wed, 11 May 2022 15:03:03 GMT) Full text and rfc822 format available.

Message #8 received at 18100 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: Juri Linkov <juri <at> jurta.org>, 18100 <at> debbugs.gnu.org
Subject: Re: bug#18100: 24.4.50; Restore simplicity of (put
 'self-insert-command 'delete-selection 'kill)
Date: Wed, 11 May 2022 17:02:16 +0200
Drew Adams <drew.adams <at> oracle.com> writes:

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

This was somewhat rewritten in 2015, and there's now a
delete-selection-uses-region-p.  So this would be simpler to express
now:

(put 'self-insert-command 'delete-selection
     (lambda ()
       (and (delete-selection-uses-region-p) 'kill)))

And I think that's sufficient here, and I'm therefore closing this bug
report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug closed, send any further explanations to 18100 <at> debbugs.gnu.org and Drew Adams <drew.adams <at> oracle.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 11 May 2022 15:03:04 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18100; Package emacs. (Wed, 11 May 2022 20:10:02 GMT) Full text and rfc822 format available.

Message #13 received at 18100 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Juri Linkov <juri <at> jurta.org>,
 "18100 <at> debbugs.gnu.org" <18100 <at> debbugs.gnu.org>
Subject: RE: [External] : Re: bug#18100: 24.4.50; Restore simplicity of (put
 'self-insert-command 'delete-selection 'kill)
Date: Wed, 11 May 2022 20:09:01 +0000
> This was somewhat rewritten in 2015, and there's now a
> delete-selection-uses-region-p.  So this would be
> simpler to express now:
> (put 'self-insert-command 'delete-selection
>      (lambda () (and (delete-selection-uses-region-p)
>                      'kill)))
> 
> And I think that's sufficient here, and I'm therefore closing this bug
> report.

Perhaps you didn't read the bug thread.

Or perhaps you did, but decided to ignore it
and reply to something unrelated.

The bug:

___
  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 ...
  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?
...  
  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 new bug is about 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.
___

All of that is still relevant.  The bug wasn't fixed.
Just another "wont-fix".  Please own up to that, here
and elsewhere.  This doesn't go in the "fix" column.
It's not "Done".  Not at all.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18100; Package emacs. (Thu, 12 May 2022 17:09:02 GMT) Full text and rfc822 format available.

Message #16 received at 18100 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>,
 "18100 <at> debbugs.gnu.org" <18100 <at> debbugs.gnu.org>
Subject: Re: [External] : Re: bug#18100: 24.4.50; Restore simplicity of (put
 'self-insert-command 'delete-selection 'kill)
Date: Thu, 12 May 2022 19:56:40 +0300
>   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.

What symbol name do you propose?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18100; Package emacs. (Thu, 12 May 2022 17:31:02 GMT) Full text and rfc822 format available.

Message #19 received at 18100 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Juri Linkov <juri <at> jurta.org>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>,
 "18100 <at> debbugs.gnu.org" <18100 <at> debbugs.gnu.org>
Subject: RE: [External] : Re: bug#18100: 24.4.50; Restore simplicity of (put
 'self-insert-command 'delete-selection 'kill)
Date: Thu, 12 May 2022 17:30:21 +0000
> >   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.
> 
> What symbol name do you propose?

Dunno.  See the other symbols used.
(I don't recall - what was wrong with `kill'?)

The "doc" should of course cover what such a symbol
means, especially if it's not obvious.  The "doc"
covers each symbol explicitly.  From the Commentary:

;; Commands which will delete the selection need a 'delete-selection
;; property on their symbols; commands which insert text but don't
;; have this property won't delete the selection.  It can be one of
;; the values:
;;  `yank'
;;      For commands which do a yank; ensures the region about to be
;;      deleted isn't immediately yanked back, which would make the
;;      command a no-op.
;;  `supersede'
;;      Delete the active region and ignore the current command,
;;      i.e. the command will just delete the region.  This is for
;;      commands that normally delete small amounts of text, like
;;      a single character -- they will instead delete the whole
;;      active region.
;;  `kill'
;;      `kill-region' is used on the selection, rather than
;;      `delete-region'.  (Text selected with the mouse will typically
;;      be yankable anyhow.)
;;  t
;;      The normal case: delete the active region prior to executing
;;      the command which will insert replacement text.
;;  FUNCTION
;;      For commands which need to dynamically determine this behavior.
;;      FUNCTION should take no argument and return one of the above
;;      values, or nil.  In the latter case, FUNCTION should itself
;;      do with the active region whatever is appropriate."




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 10 Jun 2022 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 318 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.