unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#21874: 25.0.50; point-entered no longer works
@ 2015-11-10 23:27 David Reitter
  2016-03-23 20:06 ` Kaushal Modi
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: David Reitter @ 2015-11-10 23:27 UTC (permalink / raw)
  To: 21874

Emacs -q

C-a avoids the minibuffer prompt, but cursor movement with left-arrow is still possible.  That seems to be intentional (and still a questionable default - a discussion on emacs-devel has been seen).

Setting minibuffer-prompt-properties to the new `cursor-intangible'  fixes the cursor movement issue and C-x h.

However,

(setq minibuffer-prompt-properties '(read-only t  point-entered minibuffer-avoid-prompt))

fails to work as intended.  That seems to be a bug, because `minibuffer-avoid-prompt' is just obsolete (since 25.1), and the NEWS file lists `point-entered' as obsolete, too.  So it should still work.

Feature suggestion:  Why can't Emacs see that a user had (point-entered minibuffer-avoid-prompt) and simply translate that to (cursor-intangible t)?

Another feature suggestion:  When the cursor is in a read-only area, why can’t self-insert-command jump to the next area where input is allowed?  When a region contains read-only areas, and delete is pressed or delete-selection-mode would cause the region to be killed, could Emacs just kill all the writeable text and leave the read-only portion (e.g., mini buffer prompts!) in place?  It would be so nice if Emacs could “do the right thing”!




In GNU Emacs 25.0.50.1 (x86_64-apple-darwin15.0.0, NS appkit-1404.13 Version 10.11.1 (Build 15B42))
 of 2015-11-10
Repository revision: 25775a12c5168b0494dff15639ac25d8e1017530
Windowing system distributor 'Apple', version 10.3.1404
Configured features:
ACL ZLIB TOOLKIT_SCROLL_BARS NS

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  diff-auto-refine-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
completing-read-default: Command attempted to use minibuffer while in minibuffer
Mark saved where search started
(read-only t point-entered minibuffer-avoid-prompt) [2 times]
C-h <left> is undefined
Quit
Mark set [3 times]
s-2 is undefined
Quit [2 times]
Mark set
(read-only t point-entered minibuffer-avoid-prompt)
Quit

Load-path shadows:
./ae24.git/.dir-locals hides ./aquamacs-emacs/.dir-locals
./ae24.git/.dir-locals hides ./emacs/.dir-locals
./ae24.git/.dir-locals hides /Users/dr/emacs/nextstep/Emacs.app/Contents/Resources/lisp/gnus/.dir-locals

Features:
(shadow sort mail-extr emacsbug message dired format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mail-utils
noutline outline eieio-opt speedbar sb-image ezimage dframe
character-fold misearch multi-isearch vc vc-dispatcher vc-git diff-mode
easy-mmode map seq cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles
cc-align cc-engine cc-vars cc-defs find-func pp thingatpt url-parse
auth-source cl-seq eieio byte-opt bytecomp byte-compile cconv eieio-core
cl-macs gv gnus-util mm-util mail-prsvr password-cache url-vars
cursor-sensor cus-edit cus-start cus-load wid-edit cl-extra help-fns
help-mode easymenu cl-loaddefs pcase cl-lib time-date mule-util tooltip
eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
ns-win term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese charscript case-table epa-hook jka-cmpr-hook help
simple abbrev minibuffer cl-preloaded nadvice loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
cocoa ns multi-tty make-network-process emacs)

Memory information:
((conses 16 141432 5750)
 (symbols 48 24818 0)
 (miscs 40 259 376)
 (strings 32 32647 16953)
 (string-bytes 1 998901)
 (vectors 16 18301)
 (vector-slots 8 530698 2662)
 (floats 8 190 305)
 (intervals 56 494 41)
 (buffers 976 18))






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

* bug#21874: 25.0.50; point-entered no longer works
  2015-11-10 23:27 bug#21874: 25.0.50; point-entered no longer works David Reitter
@ 2016-03-23 20:06 ` Kaushal Modi
  2016-03-23 20:30   ` Kaushal Modi
  2016-05-22  2:13 ` Paul Eggert
  2022-02-15 10:52 ` bug#21874: `backward-char' can move point into minibuffer prompt by default Lars Ingebrigtsen
  2 siblings, 1 reply; 10+ messages in thread
From: Kaushal Modi @ 2016-03-23 20:06 UTC (permalink / raw)
  To: 21874

[-- Attachment #1: Type: text/plain, Size: 1048 bytes --]

I confirm this bug in the latest build of emacs-25 branch.

I can confirm that evaluating below:

(setq minibuffer-prompt-properties '(read-only t  point-entered
minibuffer-avoid-prompt face minibuffer-prompt))

"does the right thing" in the minibuffer in emacsen 24.3, 24.4 and 24.5.

That is, arrow key navigation and C-x h does not enter the part of the
minibuffer that should be read-only.

To test it,

1. emacs -Q
2. C-x C-f
3. Pressing left arrow key will take the cursor to the left most area
within the read-only area "Find file:"
4. Now evaluate "(setq minibuffer-prompt-properties '(read-only t
 point-entered minibuffer-avoid-prompt face minibuffer-prompt))"
5. C-x C-f
6. Now the cursor will stop to the right of the colon in "Find file:" when
the left arrow key is kept pressed.

Note that above works as expected in emacsen 24.3, 24.4 and 24.5.

But it does NOT work in the latest build of emacs-25 branch. On emacs-25
build, instead of Step 6 behavior, we see Step 3 behavior. Setting
point-entered does nothing.



--
Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 1475 bytes --]

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

* bug#21874: 25.0.50; point-entered no longer works
  2016-03-23 20:06 ` Kaushal Modi
@ 2016-03-23 20:30   ` Kaushal Modi
  2016-03-23 21:28     ` Stefan Monnier
  0 siblings, 1 reply; 10+ messages in thread
From: Kaushal Modi @ 2016-03-23 20:30 UTC (permalink / raw)
  To: 21874, Stefan Monnier

[-- Attachment #1: Type: text/plain, Size: 1581 bytes --]

Then I tried the below (which sort of works):

(progn
  (setq minibuffer-prompt-properties '(read-only t cursor-intangible t face
minibuffer-prompt))

  (defun turn-on-cursor-intangible-mode ()
    "Turns on cursor-intangible-mode."
    (interactive)
    (cursor-intangible-mode 1))
  (define-globalized-minor-mode global-cursor-intangible-mode
cursor-intangible-mode turn-on-cursor-intangible-mode)

  (global-cursor-intangible-mode 1))

Start emacs -Q and eval the above progn form.
The caveat is (and I cannot understand why) is that the cursor
intangibility does not kick in when you do C-x C-f for the first time! It
kicks in only from the second C-x C-f onwards.

The following steps try to explain what I mean (on latest build of
emacs-25):
1. emacs -Q
2. Eval the above progn form
3. C-x C-f C-x h (The read-only portion also gets selected!)
4. C-g
5. C-x C-f C-x h (NOW the read-only portion does not get selected as
expected)

So why is the cursor-intangible-mode not enabled in the minibuffer the
first time (Step 3)?

Also, would it be wise to enable cursor-intangible-mode globally? If not,
how can we have that mode always enabled in the minibuffer?


-------------------------

On the other hand, I have tested the below as an alternate solution
(probably better too as I am not enabling the mode globally) to always work:

(progn
  (setq minibuffer-prompt-properties '(read-only t cursor-intangible t face
minibuffer-prompt))
  (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode))

If we want emacs to "do the right thing", should the above be made default?

[-- Attachment #2: Type: text/html, Size: 2909 bytes --]

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

* bug#21874: 25.0.50; point-entered no longer works
  2016-03-23 20:30   ` Kaushal Modi
@ 2016-03-23 21:28     ` Stefan Monnier
  2016-03-23 21:38       ` Kaushal Modi
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2016-03-23 21:28 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: 21874

>   (defun turn-on-cursor-intangible-mode ()
>     "Turns on cursor-intangible-mode."
>     (interactive)
>     (cursor-intangible-mode 1))

   (defalias 'turn-on-cursor-intangible-mode #'cursor-intangible-mode)

would work just as well.  Better yet: just use `cursor-intangible-mode'
instead and skip turn-on-cursor-intangible-mode altogether, since it's
just redundant.

> 3. C-x C-f C-x h (The read-only portion also gets selected!)

The minibuffer is not placed in any kind of major mode, so it doesn't
enable any globalized minor mode when you enter it.

> 5. C-x C-f C-x h (NOW the read-only portion does not get selected as
> expected)

This is probably because I introduced minibuffer-inactive-mode which
does setup a major mode in the minibuffer, tho not when you enter it, but
when you leave it, so the globalized mode ends up activated in the
*next* minibuffer.

> Also, would it be wise to enable cursor-intangible-mode globally? If not,
> how can we have that mode always enabled in the minibuffer?

(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)

> If we want Emacs to "do the right thing", should the above be made default?

I personally like the fact that I can occasionally move into the prompt
and copy portions of it like any other chunk of text, so I think we
should generally (by default) refrain from making text intangible except
when *really* needed.


        Stefan


PS: What's with the `point-entered' in the subject?





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

* bug#21874: 25.0.50; point-entered no longer works
  2016-03-23 21:28     ` Stefan Monnier
@ 2016-03-23 21:38       ` Kaushal Modi
  2016-03-23 21:55         ` Kaushal Modi
  2016-03-24  2:14         ` David Reitter
  0 siblings, 2 replies; 10+ messages in thread
From: Kaushal Modi @ 2016-03-23 21:38 UTC (permalink / raw)
  To: Stefan Monnier, David Reitter; +Cc: 21874

[-- Attachment #1: Type: text/plain, Size: 1744 bytes --]

On Wed, Mar 23, 2016 at 5:28 PM, Stefan Monnier <monnier@iro.umontreal.ca>
wrote:

> (defalias 'turn-on-cursor-intangible-mode #'cursor-intangible-mode)
>
> would work just as well.  Better yet: just use `cursor-intangible-mode'
> instead and skip turn-on-cursor-intangible-mode altogether, since it's
> just redundant.
>

Thanks!

> Also, would it be wise to enable cursor-intangible-mode globally? If not,
> > how can we have that mode always enabled in the minibuffer?
> (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)


Yes, that's what I ended up doing :) The last part of my previous email was
an after-thought or an "aha" moment as I was typing the question "how can
we have that mode always enabled in the minibuffer?"

I personally like the fact that I can occasionally move into the prompt
> and copy portions of it like any other chunk of text, so I think we
> should generally (by default) refrain from making text intangible except
> when *really* needed.


OK


> PS: What's with the `point-entered' in the subject?


I believe that the OP (David)'s primary question was how to get the
"cursor-intangible" behavior working in emacs 25.1 because the below does
not work as it used to in emacs 24.5:

(setq minibuffer-prompt-properties '(read-only t point-entered
minibuffer-avoid-prompt))

The secondary question I believe is how to get the above to work in
emacs 25.1 (even though point-entered and minibuffer-avoid-prompt are
obsolete).

@David The fact that the below get the behavior you want, would you
consider this bug as closed?

(progn
  (setq minibuffer-prompt-properties '(read-only t cursor-intangible t
face minibuffer-prompt))
  (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode))

--
Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 4895 bytes --]

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

* bug#21874: 25.0.50; point-entered no longer works
  2016-03-23 21:38       ` Kaushal Modi
@ 2016-03-23 21:55         ` Kaushal Modi
  2016-03-24  0:27           ` Stefan Monnier
  2016-03-24  2:14         ` David Reitter
  1 sibling, 1 reply; 10+ messages in thread
From: Kaushal Modi @ 2016-03-23 21:55 UTC (permalink / raw)
  To: Stefan Monnier, David Reitter; +Cc: 21874

[-- Attachment #1: Type: text/plain, Size: 1700 bytes --]

@Stefan With respect to:

>
> I personally like the fact that I can occasionally move into the prompt
> and copy portions of it like any other chunk of text, so I think we
> should generally (by default) refrain from making text intangible except
> when *really* needed.


How about setting the below as default:

    (setq minibuffer-prompt-properties '(read-only t cursor-intangible t
face minibuffer-prompt))

I find having the above very risky in user config because it simply
overrides whatever the default value of minibuffer-prompt-properties would
be. Also using setq/defcustom is the best way; append/add-to-list/setcdr
will not work very well because of the format of this variable's value.
What I mean is that the list manipulation would have been much more
convenient from the user end without risking complete override of the
default value, had it been in an alist format like below:

    (setq minibuffer-prompt-properties '((read-only t)
                                         (cursor-intangible t)
                                         (face minibuffer-prompt)))


The user then needs to add just one line to their config if they want to
make the minibuffer prompts untouchable.

    (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)

If you don't have that add-hook in your config, you will get the behavior
you want, correct?

Summary:
(1) Proposal to set the default value of minibuffer-prompt-properties
to '(read-only
t cursor-intangible t face minibuffer-prompt). I believe this should go in
emacs-25, not master.
(2) User can then put the following in their config to get untouchable
minibuffer prompts: (add-hook 'minibuffer-setup-hook
#'cursor-intangible-mode)

[-- Attachment #2: Type: text/html, Size: 2776 bytes --]

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

* bug#21874: 25.0.50; point-entered no longer works
  2016-03-23 21:55         ` Kaushal Modi
@ 2016-03-24  0:27           ` Stefan Monnier
  0 siblings, 0 replies; 10+ messages in thread
From: Stefan Monnier @ 2016-03-24  0:27 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: David Reitter, 21874

>     (setq minibuffer-prompt-properties '((read-only t)
>                                          (cursor-intangible t)
>                                          (face minibuffer-prompt)))
>
> The user then needs to add just one line to their config if they want to
> make the minibuffer prompts untouchable.

I kind of find it a poor choice, since it sets a property which just
happens to be unused.

>     (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)

A user might do this for other reasons and might find the
side-effect unexpected.

Note that setting minibuffer-prompt-properties via Custom will
automatically do this `add-hook' when needed.


        Stefan





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

* bug#21874: 25.0.50; point-entered no longer works
  2016-03-23 21:38       ` Kaushal Modi
  2016-03-23 21:55         ` Kaushal Modi
@ 2016-03-24  2:14         ` David Reitter
  1 sibling, 0 replies; 10+ messages in thread
From: David Reitter @ 2016-03-24  2:14 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: 21874, Stefan Monnier

On Mar 23, 2016, at 5:38 PM, Kaushal Modi <kaushal.modi@gmail.com> wrote:
> 
> @David The fact that the below get the behavior you want, would you consider this bug as closed?

Well, it was surprising that cursor-intangible as a property wasn’t sufficient until the mode was enabled.  I can see why one would design it that way.

So, in order to not have people bump into errors all the time (which, IIRC, also are displayed in the echo area, overwriting the mini buffer that the user is working on at that very moment), I would still suggest that this protection be made default.  (I’ve had that in Aquamacs for a long time.)

Stefan’s desire to copy the prompt is the exception (perhaps because he’s working on and maybe teaching Emacs).  The user who wants to delete the whole text behind the prompt to replace it, or mark-all and delete selection, or C-a to the beginning and so on, this user is the norm.  We should think about that use case first.

- D




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

* bug#21874: 25.0.50; point-entered no longer works
  2015-11-10 23:27 bug#21874: 25.0.50; point-entered no longer works David Reitter
  2016-03-23 20:06 ` Kaushal Modi
@ 2016-05-22  2:13 ` Paul Eggert
  2022-02-15 10:52 ` bug#21874: `backward-char' can move point into minibuffer prompt by default Lars Ingebrigtsen
  2 siblings, 0 replies; 10+ messages in thread
From: Paul Eggert @ 2016-05-22  2:13 UTC (permalink / raw)
  To: 21874

Bug#21874 was listed as a blocker for Emacs 25, but in looking over it it 
appears to be more of a wishlist item. Eli suggested in 
<http://lists.gnu.org/archive/html/emacs-devel/2016-05/msg00460.html> to unblock 
it and I tend to agree, so I've done that.





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

* bug#21874: `backward-char' can move point into minibuffer prompt by default
  2015-11-10 23:27 bug#21874: 25.0.50; point-entered no longer works David Reitter
  2016-03-23 20:06 ` Kaushal Modi
  2016-05-22  2:13 ` Paul Eggert
@ 2022-02-15 10:52 ` Lars Ingebrigtsen
  2 siblings, 0 replies; 10+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-15 10:52 UTC (permalink / raw)
  To: David Reitter; +Cc: 21874

David Reitter <david.reitter@gmail.com> writes:

> Setting minibuffer-prompt-properties to the new `cursor-intangible'
> fixes the cursor movement issue and C-x h.

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

`C-x h' only copies the bit after the prompt in Emacs 28.

>>     (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)
>
> A user might do this for other reasons and might find the
> side-effect unexpected.
>
> Note that setting minibuffer-prompt-properties via Custom will
> automatically do this `add-hook' when needed.

Skimming this bug report, I think everything here works as designed, and
I'm therefore closing it.

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





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

end of thread, other threads:[~2022-02-15 10:52 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-10 23:27 bug#21874: 25.0.50; point-entered no longer works David Reitter
2016-03-23 20:06 ` Kaushal Modi
2016-03-23 20:30   ` Kaushal Modi
2016-03-23 21:28     ` Stefan Monnier
2016-03-23 21:38       ` Kaushal Modi
2016-03-23 21:55         ` Kaushal Modi
2016-03-24  0:27           ` Stefan Monnier
2016-03-24  2:14         ` David Reitter
2016-05-22  2:13 ` Paul Eggert
2022-02-15 10:52 ` bug#21874: `backward-char' can move point into minibuffer prompt by default Lars Ingebrigtsen

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