From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alexis Newsgroups: gmane.emacs.devel Subject: Re: invoke a keyboard menu map from lisp? Date: Thu, 27 Aug 2015 12:21:12 +1000 Message-ID: <878u8xbhev.fsf@gmail.com> References: <86egipk9tu.fsf@stephe-leake.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1440642093 25502 80.91.229.3 (27 Aug 2015 02:21:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 27 Aug 2015 02:21:33 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Aug 27 04:21:28 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZUmoi-0008UH-7D for ged-emacs-devel@m.gmane.org; Thu, 27 Aug 2015 04:21:28 +0200 Original-Received: from localhost ([::1]:49973 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUmoh-0004Ad-95 for ged-emacs-devel@m.gmane.org; Wed, 26 Aug 2015 22:21:27 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42178) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUmoc-0004AF-Jl for emacs-devel@gnu.org; Wed, 26 Aug 2015 22:21:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZUmoZ-000702-HZ for emacs-devel@gnu.org; Wed, 26 Aug 2015 22:21:22 -0400 Original-Received: from mail-pa0-x22f.google.com ([2607:f8b0:400e:c03::22f]:35490) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUmoZ-0006yd-2o for emacs-devel@gnu.org; Wed, 26 Aug 2015 22:21:19 -0400 Original-Received: by pacdd16 with SMTP id dd16so7525861pac.2 for ; Wed, 26 Aug 2015 19:21:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:from:to:subject:in-reply-to:date:message-id:mime-version :content-type:content-transfer-encoding; bh=vAIdM21Cf0AOGs/ICt587ufigg5u816Kvcs9+CdDxZk=; b=JsIa777v/SkcDT8yQ/5yqKwYIDQdDbamNubUkLOpvALa+pSlI3Pk/lbPtdTzWwhCZw QC/PCFpcHUdGmdh6zGlnSMgIGWBZLMrqdfxQHre0nsYachyildkBh+N1c+QBKDEIPJ+W tQcxQsGWFA7es+tWjDiFfuU6PiCiTFFjTJDWAye+viXrSTwitvH/4zPRqWHwzcvlvlsD MPE+KAbFu6HkqgFQeCLLIr/c5tO0pgGORVsBwu0Qyt//lwOzIbuW1z+sSS59jRnXEhTd 7bjvQQhIRFojRo0aYYVRvulO0kx2Q/GPsuJcTlLUMFW1vvNgSagz6ObhdmLaxWfFIWkr kYfg== X-Received: by 10.66.221.193 with SMTP id qg1mr2746771pac.103.1440642077332; Wed, 26 Aug 2015 19:21:17 -0700 (PDT) Original-Received: from localhost (CPE-58-161-15-29.cqqy2.win.bigpond.net.au. [58.161.15.29]) by smtp.gmail.com with ESMTPSA id bf14sm435928pdb.28.2015.08.26.19.21.15 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Aug 2015 19:21:16 -0700 (PDT) In-reply-to: <86egipk9tu.fsf@stephe-leake.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c03::22f X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:189203 Archived-At: Stephen Leake writes: > I'm trying to build a keyboard menu keymap on the fly, and then > invoke it. I've gotten this far: > > (defun dvc-offer-choices (comment choices) > "Present user with a choice of actions, labeled by > COMMENT. CHOICES is a list of pairs > containing (function description)." > ;; Build a keyboard menu keymap (let ((i 0) > (map (make-sparse-keymap "actions")) choice) > (unless (< (length choices) 10) > (error "‘dvc-offer-choices’ only supports up to 10 > choices")) > > (while choices > (setq choice (pop choices)) (define-key map (int-to-string > i) > (list menu-item (format "%d) %s" i (cadr choice)) (car > choice)))) > ;; FIXME: invoke the map )) > > But I can't find the function that executes the keymap. Is setting the value of `overriding-local-map` perhaps what you want? Alexis.