all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: 21033@debbugs.gnu.org
Subject: bug#21033: 25.0.50; `local-map' property inside `:eval' sexp in mode-line
Date: Fri, 10 Jul 2015 14:01:26 -0700 (PDT)	[thread overview]
Message-ID: <bab4c4ef-8b05-4dea-b0e7-ac2d2cca14dc@default> (raw)

This might not be a bug, but I cannot seem to figure it out.
If it is not, please let me know what I'm missing.

This code puts string "abcdefg" in the mode-line with text property
`local-map', which has a single key binding to command `foo' for
`mouse-2'.

(setq global-mode-string
      '(:eval (let* ((map  (make-sparse-keymap))
		     (str  "abcdefg"))
		(define-key map [mouse-2] 'foo)
		(add-text-properties 0 (1- (length str))
				      `(local-map ,map) str)
		str)))

(defun foo (ev)
  (interactive "e")
  (message "@@@@@@@@@@@@@"))

I've fiddled with umpteen variations, but I cannot seem to get the
`local-map' property (or the `keymap' property) to have any effect
within an `:eval' form.

It is perhaps the case that this is simply not supported?  I don't see
anything in the doc saying that.  I'm hoping that I'm just missing
something, and there is a simple way to accomplish this.


In GNU Emacs 25.0.50.1 (i686-pc-mingw32)
 of 2015-07-03 on LEG570
Repository revision: 2b848fadd51e805b2f46da64c5958ea7f009048a
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --host=i686-pc-mingw32 --enable-checking=yes,glyphs'

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB
TOOLKIT_SCROLL_BARS

Important settings:
  value of $LANG: ENU
  locale-coding-system: cp1252





             reply	other threads:[~2015-07-10 21:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-10 21:01 Drew Adams [this message]
2015-07-10 22:24 ` bug#21033: 25.0.50; `local-map' property inside `:eval' sexp in mode-line Stefan Monnier
2015-07-10 23:03   ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bab4c4ef-8b05-4dea-b0e7-ac2d2cca14dc@default \
    --to=drew.adams@oracle.com \
    --cc=21033@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.