unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#27517: 26.0.50; 25.2.2; Cannot add "help-echo" property to buffer regions.
@ 2017-06-28 12:35 Vitalie Spinu
  2017-06-28 16:38 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Vitalie Spinu @ 2017-06-28 12:35 UTC (permalink / raw)
  To: 27517


Hi,

Do

 (put-text-property (point-min) 100 'help-echo "my-mouse-over" (current-buffer))

No "help-ehco" property is added. Any other property (including special
properties) can be added.

Same problem with emacs 25.2.2, but works in emacs 24.5.1.


  Vitalie


In GNU Emacs 26.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
 of 2017-06-28 built on galago
Repository revision: 5d45ba1a05bccc53d52422e867f378a0adeb8970
Windowing system distributor 'The X.Org Foundation', version 11.0.11804000
System Description:	Ubuntu 16.04.2 LTS





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

* bug#27517: 26.0.50; 25.2.2; Cannot add "help-echo" property to buffer regions.
  2017-06-28 12:35 bug#27517: 26.0.50; 25.2.2; Cannot add "help-echo" property to buffer regions Vitalie Spinu
@ 2017-06-28 16:38 ` Eli Zaretskii
  2017-06-28 22:22   ` Vitalie Spinu
  2021-08-13 13:18   ` bug#27517: 26.0.50; 25.2.2; Cannot add "help-echo" property to buffer regions in *lisp-mode Lars Ingebrigtsen
  0 siblings, 2 replies; 6+ messages in thread
From: Eli Zaretskii @ 2017-06-28 16:38 UTC (permalink / raw)
  To: Vitalie Spinu, Stefan Monnier; +Cc: 27517

> From: Vitalie Spinu <spinuvit@gmail.com>
> Date: Wed, 28 Jun 2017 14:35:07 +0200
> 
>  (put-text-property (point-min) 100 'help-echo "my-mouse-over" (current-buffer))
> 
> No "help-ehco" property is added. Any other property (including special
> properties) can be added.

But only in lisp-mode, right?

This happens because lisp-mode.el wants itself to manage the help-echo
property:

  (defun lisp-mode-variables (&optional lisp-syntax keywords-case-insensitive
					elisp)
  ...
    (setq font-lock-defaults
	  `(,(if elisp '(lisp-el-font-lock-keywords
			 lisp-el-font-lock-keywords-1
			 lisp-el-font-lock-keywords-2)
	       '(lisp-cl-font-lock-keywords
		 lisp-cl-font-lock-keywords-1
		 lisp-cl-font-lock-keywords-2))
	    nil ,keywords-case-insensitive nil nil
	    (font-lock-mark-block-function . mark-defun)
	    (font-lock-extra-managed-props help-echo)
	     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

When a property appears in font-lock-extra-managed-props, font-lock
removes that property when it's about to re-fontify some region, see
font-lock-default-unfontify-region.

CC'ing Stefan, who made that change.





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

* bug#27517: 26.0.50; 25.2.2; Cannot add "help-echo" property to buffer regions.
  2017-06-28 16:38 ` Eli Zaretskii
@ 2017-06-28 22:22   ` Vitalie Spinu
  2021-08-13 13:18   ` bug#27517: 26.0.50; 25.2.2; Cannot add "help-echo" property to buffer regions in *lisp-mode Lars Ingebrigtsen
  1 sibling, 0 replies; 6+ messages in thread
From: Vitalie Spinu @ 2017-06-28 22:22 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 27517, Stefan Monnier


Indeed. Works in other buffers.

 Vitalie

>> On Wed, Jun 28 2017 19:38, Eli Zaretskii wrote:

>> From: Vitalie Spinu <spinuvit@gmail.com>
>> Date: Wed, 28 Jun 2017 14:35:07 +0200
>> 
>>  (put-text-property (point-min) 100 'help-echo "my-mouse-over" (current-buffer))
>> 
>> No "help-ehco" property is added. Any other property (including special
>> properties) can be added.

> But only in lisp-mode, right?

> This happens because lisp-mode.el wants itself to manage the help-echo
> property:

>   (defun lisp-mode-variables (&optional lisp-syntax keywords-case-insensitive
> 					elisp)
>   ...
>     (setq font-lock-defaults
> 	  `(,(if elisp '(lisp-el-font-lock-keywords
> 			 lisp-el-font-lock-keywords-1
> 			 lisp-el-font-lock-keywords-2)
> 	       '(lisp-cl-font-lock-keywords
> 		 lisp-cl-font-lock-keywords-1
> 		 lisp-cl-font-lock-keywords-2))
> 	    nil ,keywords-case-insensitive nil nil
> 	    (font-lock-mark-block-function . mark-defun)
> 	    (font-lock-extra-managed-props help-echo)
> 	     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

> When a property appears in font-lock-extra-managed-props, font-lock
> removes that property when it's about to re-fontify some region, see
> font-lock-default-unfontify-region.

> CC'ing Stefan, who made that change.





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

* bug#27517: 26.0.50; 25.2.2; Cannot add "help-echo" property to buffer regions in *lisp-mode
  2017-06-28 16:38 ` Eli Zaretskii
  2017-06-28 22:22   ` Vitalie Spinu
@ 2021-08-13 13:18   ` Lars Ingebrigtsen
  2021-08-14  3:06     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 6+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-13 13:18 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 27517, Vitalie Spinu, Stefan Monnier

Eli Zaretskii <eliz@gnu.org> writes:

> This happens because lisp-mode.el wants itself to manage the help-echo
> property:

[...]

> 	    (font-lock-extra-managed-props help-echo)
>
> When a property appears in font-lock-extra-managed-props, font-lock
> removes that property when it's about to re-fontify some region, see
> font-lock-default-unfontify-region.

This is presumably so that font-locking can add help-echo warnings like

+       (lisp--match-hidden-arg
+        (0 '(face font-lock-warning-face
+             help-echo "Hidden behind deeper element; move to another line?")))

which seems useful.

But it'd also be nice to allow other packages to also add help-echo on
bits and bobs.  Is there no way to achieve that?

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





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

* bug#27517: 26.0.50; 25.2.2; Cannot add "help-echo" property to buffer regions in *lisp-mode
  2021-08-13 13:18   ` bug#27517: 26.0.50; 25.2.2; Cannot add "help-echo" property to buffer regions in *lisp-mode Lars Ingebrigtsen
@ 2021-08-14  3:06     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-08-14 12:03       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-08-14  3:06 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 27517, Eli Zaretskii, Vitalie Spinu

Lars Ingebrigtsen [2021-08-13 15:18:23] wrote:
> Eli Zaretskii <eliz@gnu.org> writes:
>> This happens because lisp-mode.el wants itself to manage the help-echo
>> property:
>
> [...]
>
>> 	    (font-lock-extra-managed-props help-echo)
>>
>> When a property appears in font-lock-extra-managed-props, font-lock
>> removes that property when it's about to re-fontify some region, see
>> font-lock-default-unfontify-region.
>
> This is presumably so that font-locking can add help-echo warnings like
>
> +       (lisp--match-hidden-arg
> +        (0 '(face font-lock-warning-face
> +             help-echo "Hidden behind deeper element; move to another line?")))
>
> which seems useful.
>
> But it'd also be nice to allow other packages to also add help-echo on
> bits and bobs.  Is there no way to achieve that?

There is sadly no easy way to do that currently.
You can do things like:
- Use an overlay instead of a text-property.
- Apply the text-property via `font-lock-add-keywords` rather than directly.
- Add support for "multiple planes" in text-properties.  This means that
  font-lock would use its own "plane" and your package could use another
  plane, and the two would be correctly merged and font-lock wouldn't
  erase your properties.
  It's been on my todo list for many years.  I've proposed it to as
  a summer project to some of my students but so far to no avail.


        Stefan






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

* bug#27517: 26.0.50; 25.2.2; Cannot add "help-echo" property to buffer regions in *lisp-mode
  2021-08-14  3:06     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-08-14 12:03       ` Lars Ingebrigtsen
  0 siblings, 0 replies; 6+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-14 12:03 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 27517, Vitalie Spinu

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> There is sadly no easy way to do that currently.
> You can do things like:
> - Use an overlay instead of a text-property.
> - Apply the text-property via `font-lock-add-keywords` rather than directly.

Hm, yes...

> - Add support for "multiple planes" in text-properties.  This means that
>   font-lock would use its own "plane" and your package could use another
>   plane, and the two would be correctly merged and font-lock wouldn't
>   erase your properties.

Oh, yeah!  I'd totally forgotten -- that would indeed be the long term
fix for these issues.  I think there's an issue for that somewhere in
here...

In any case, I'm closing this report, because it's basically "working as
designed" (until we get a new design).

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





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

end of thread, other threads:[~2021-08-14 12:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-28 12:35 bug#27517: 26.0.50; 25.2.2; Cannot add "help-echo" property to buffer regions Vitalie Spinu
2017-06-28 16:38 ` Eli Zaretskii
2017-06-28 22:22   ` Vitalie Spinu
2021-08-13 13:18   ` bug#27517: 26.0.50; 25.2.2; Cannot add "help-echo" property to buffer regions in *lisp-mode Lars Ingebrigtsen
2021-08-14  3:06     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-08-14 12:03       ` 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).