unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#20528: 25.0.50; `keymap' property to work for symbol-value, not just symbol-function
@ 2015-05-07 20:14 Drew Adams
  2015-05-08  6:38 ` Andreas Schwab
  0 siblings, 1 reply; 6+ messages in thread
From: Drew Adams @ 2015-05-07 20:14 UTC (permalink / raw)
  To: 20528

The `keymap' text or overlay property can have a value that is
`keymapp', which means that it can be a list with car `keymap' etc. or a
symbol whose `symbol-function' is a keymap.

Please allow it to also be a symbol, such as `Info-mode-map', whose
`symbol-value' is a keymap.  It is used only as a keymap.  It is not
used as a function.  It is convenient to be able to reuse an existing
keymap variable to provide a map for a given portion of text.

Likewise, for property `local-map'.

(I'm guessing that I cannot change Emacs to recognize this, myself,
because it involves the C level (e.g. `key-binding' or `lookup-key').
If I'm mistaken, please point me to the Lisp code that interprets
the keymap property, looks up a key in the map and invokes its command.)


In GNU Emacs 25.0.50.1 (i686-pc-mingw32)
 of 2014-10-20 on LEG570
Bzr revision: 118168 rgm@gnu.org-20141020195941-icp42t8ttcnud09g
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --enable-checking=yes,glyphs CPPFLAGS=-DGLYPH_DEBUG=1'





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

* bug#20528: 25.0.50; `keymap' property to work for symbol-value, not just symbol-function
  2015-05-07 20:14 bug#20528: 25.0.50; `keymap' property to work for symbol-value, not just symbol-function Drew Adams
@ 2015-05-08  6:38 ` Andreas Schwab
  2015-05-08 15:25   ` Drew Adams
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2015-05-08  6:38 UTC (permalink / raw)
  To: Drew Adams; +Cc: 20528

Drew Adams <drew.adams@oracle.com> writes:

> Please allow it to also be a symbol, such as `Info-mode-map', whose
> `symbol-value' is a keymap.  It is used only as a keymap.  It is not
> used as a function.  It is convenient to be able to reuse an existing
> keymap variable to provide a map for a given portion of text.

Why can't you dereference the variable when assigning the property?

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





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

* bug#20528: 25.0.50; `keymap' property to work for symbol-value, not just symbol-function
  2015-05-08  6:38 ` Andreas Schwab
@ 2015-05-08 15:25   ` Drew Adams
  2015-05-08 15:33     ` Andreas Schwab
  2015-05-08 17:51     ` Stefan Monnier
  0 siblings, 2 replies; 6+ messages in thread
From: Drew Adams @ 2015-05-08 15:25 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 20528

> > Please allow it to also be a symbol, such as `Info-mode-map',
> > whose `symbol-value' is a keymap.  It is used only as a keymap.
> > It is not used as a function.  It is convenient to be able to
> > reuse an existing keymap variable to provide a map for a given
> > portion of text.
> 
> Why can't you dereference the variable when assigning the property?

Why can't you dereference the function symbol when assigning the
property? ;-)  As I said, it is used here only as a keymap, not
as a function.

But the real reason is that I want to have `C-u C-x =' show the
variable name, not the raw keymap value (after [Show]).  In my
version, clicking that name then provides a human-readable
description of the keymap (from command `describe-keymap').

Anyway, my guess about requiring C code modification was wrong.
I've done what I wanted now, locally.  You can do likewise for
Emacs, if you want.  Or not.

The descr-text.el code is here:
http://www.emacswiki.org/emacs/download/descr-text%2b.el

Command `describe-keymap' is here:
http://www.emacswiki.org/emacs/download/help-fns%2b.el

All that's needed is to add a `help-keymap' button, and to use that
in `describe-property-list' for a keymap variable.  And to have
`describe-text-sexp' use action `describe-keymap' for a keymap var. 

Then, when you click on the keymap var name from `C-u C-x =', you
get a readable description of the keymap for that `keymap' or
`local-map' property.  Properties `keymap' and `local-map' are as
important as properties such as `face' for `what-cursor-position'
output, and they too can provide useful info here, if you let them.





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

* bug#20528: 25.0.50; `keymap' property to work for symbol-value, not just symbol-function
  2015-05-08 15:25   ` Drew Adams
@ 2015-05-08 15:33     ` Andreas Schwab
  2015-05-08 17:51     ` Stefan Monnier
  1 sibling, 0 replies; 6+ messages in thread
From: Andreas Schwab @ 2015-05-08 15:33 UTC (permalink / raw)
  To: Drew Adams; +Cc: 20528

Drew Adams <drew.adams@oracle.com> writes:

>> > Please allow it to also be a symbol, such as `Info-mode-map',
>> > whose `symbol-value' is a keymap.  It is used only as a keymap.
>> > It is not used as a function.  It is convenient to be able to
>> > reuse an existing keymap variable to provide a map for a given
>> > portion of text.
>> 
>> Why can't you dereference the variable when assigning the property?
>
> Why can't you dereference the function symbol when assigning the
> property? ;-)

That's how lisp works, fundamentally.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





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

* bug#20528: 25.0.50; `keymap' property to work for symbol-value, not just symbol-function
  2015-05-08 15:25   ` Drew Adams
  2015-05-08 15:33     ` Andreas Schwab
@ 2015-05-08 17:51     ` Stefan Monnier
  2021-09-04  7:22       ` Lars Ingebrigtsen
  1 sibling, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2015-05-08 17:51 UTC (permalink / raw)
  To: Drew Adams; +Cc: 20528, Andreas Schwab

> Why can't you dereference the function symbol when assigning the
> property? ;-)

When the function symbol is used, often the reason is so that it works
even if the keymap is not yet defined (e.g. the keymap is autoloaded).

> But the real reason is that I want to have `C-u C-x =' show the
> variable name, not the raw keymap value (after [Show]).  In my

Would be nice, indeed.  But I'm not sure it's worth the hassle.


        Stefan





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

* bug#20528: 25.0.50; `keymap' property to work for symbol-value, not just symbol-function
  2015-05-08 17:51     ` Stefan Monnier
@ 2021-09-04  7:22       ` Lars Ingebrigtsen
  0 siblings, 0 replies; 6+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-04  7:22 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 20528, Andreas Schwab

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

>> Why can't you dereference the function symbol when assigning the
>> property? ;-)
>
> When the function symbol is used, often the reason is so that it works
> even if the keymap is not yet defined (e.g. the keymap is autoloaded).
>
>> But the real reason is that I want to have `C-u C-x =' show the
>> variable name, not the raw keymap value (after [Show]).  In my
>
> Would be nice, indeed.  But I'm not sure it's worth the hassle.

And I think it would make things more ambiguous -- today we only look at
the symbol's function value, and if we looked at both the function value
and the, er, value value, we'd have to come up with rules for
precedence.

So I think the way it works currently is fine, and I'm closing this bug
report.

-- 
(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-09-04  7:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-07 20:14 bug#20528: 25.0.50; `keymap' property to work for symbol-value, not just symbol-function Drew Adams
2015-05-08  6:38 ` Andreas Schwab
2015-05-08 15:25   ` Drew Adams
2015-05-08 15:33     ` Andreas Schwab
2015-05-08 17:51     ` Stefan Monnier
2021-09-04  7:22       ` 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).