all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#18100: 24.4.50; Restore simplicity of (put 'self-insert-command 'delete-selection 'kill)
@ 2014-07-24 17:22 Drew Adams
  2022-05-11 15:02 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Drew Adams @ 2014-07-24 17:22 UTC (permalink / raw)
  To: 18100

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





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

* bug#18100: 24.4.50; Restore simplicity of (put 'self-insert-command 'delete-selection 'kill)
  2014-07-24 17:22 bug#18100: 24.4.50; Restore simplicity of (put 'self-insert-command 'delete-selection 'kill) Drew Adams
@ 2022-05-11 15:02 ` Lars Ingebrigtsen
  2022-05-11 20:09   ` Drew Adams
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-11 15:02 UTC (permalink / raw)
  To: Drew Adams; +Cc: Juri Linkov, 18100

Drew Adams <drew.adams@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





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

* bug#18100: 24.4.50; Restore simplicity of (put 'self-insert-command 'delete-selection 'kill)
  2022-05-11 15:02 ` Lars Ingebrigtsen
@ 2022-05-11 20:09   ` Drew Adams
  2022-05-12 16:56     ` Juri Linkov
  0 siblings, 1 reply; 5+ messages in thread
From: Drew Adams @ 2022-05-11 20:09 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Juri Linkov, 18100@debbugs.gnu.org

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





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

* bug#18100: 24.4.50; Restore simplicity of (put 'self-insert-command 'delete-selection 'kill)
  2022-05-11 20:09   ` Drew Adams
@ 2022-05-12 16:56     ` Juri Linkov
  2022-05-12 17:30       ` Drew Adams
  0 siblings, 1 reply; 5+ messages in thread
From: Juri Linkov @ 2022-05-12 16:56 UTC (permalink / raw)
  To: Drew Adams; +Cc: Lars Ingebrigtsen, 18100@debbugs.gnu.org

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





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

* bug#18100: 24.4.50; Restore simplicity of (put 'self-insert-command 'delete-selection 'kill)
  2022-05-12 16:56     ` Juri Linkov
@ 2022-05-12 17:30       ` Drew Adams
  0 siblings, 0 replies; 5+ messages in thread
From: Drew Adams @ 2022-05-12 17:30 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Lars Ingebrigtsen, 18100@debbugs.gnu.org

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





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

end of thread, other threads:[~2022-05-12 17:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-24 17:22 bug#18100: 24.4.50; Restore simplicity of (put 'self-insert-command 'delete-selection 'kill) Drew Adams
2022-05-11 15:02 ` Lars Ingebrigtsen
2022-05-11 20:09   ` Drew Adams
2022-05-12 16:56     ` Juri Linkov
2022-05-12 17:30       ` Drew Adams

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.