From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#25505: 24.5; doc of `define-minor-mode': incorrect for :keymap Date: Fri, 10 Feb 2017 18:28:32 -0500 Message-ID: <8737flmxr3.fsf@users.sourceforge.net> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1486769295 16378 195.159.176.226 (10 Feb 2017 23:28:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 10 Feb 2017 23:28:15 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) Cc: 25505@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Feb 11 00:28:10 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ccKbo-0003qK-LA for geb-bug-gnu-emacs@m.gmane.org; Sat, 11 Feb 2017 00:28:08 +0100 Original-Received: from localhost ([::1]:46418 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccKbs-0002qh-Jc for geb-bug-gnu-emacs@m.gmane.org; Fri, 10 Feb 2017 18:28:12 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36556) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccKbl-0002pP-S7 for bug-gnu-emacs@gnu.org; Fri, 10 Feb 2017 18:28:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ccKbi-0005mk-Nv for bug-gnu-emacs@gnu.org; Fri, 10 Feb 2017 18:28:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36915) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ccKbi-0005mg-Jx for bug-gnu-emacs@gnu.org; Fri, 10 Feb 2017 18:28:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ccKbi-0000b7-91 for bug-gnu-emacs@gnu.org; Fri, 10 Feb 2017 18:28:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 10 Feb 2017 23:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25505 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 25505-submit@debbugs.gnu.org id=B25505.14867692502255 (code B ref 25505); Fri, 10 Feb 2017 23:28:02 +0000 Original-Received: (at 25505) by debbugs.gnu.org; 10 Feb 2017 23:27:30 +0000 Original-Received: from localhost ([127.0.0.1]:35114 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ccKbC-0000aD-LU for submit@debbugs.gnu.org; Fri, 10 Feb 2017 18:27:30 -0500 Original-Received: from mail-it0-f49.google.com ([209.85.214.49]:38317) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ccKb9-0000Zt-R4; Fri, 10 Feb 2017 18:27:28 -0500 Original-Received: by mail-it0-f49.google.com with SMTP id c7so43794936itd.1; Fri, 10 Feb 2017 15:27:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=Cw44uJb7Kl5eTlItM20YKjdztOYy1/oLTPOUw+C+5XU=; b=Sqm1ZcRKaxongbftt3RZLQkDDVN9kJl1anN4zwnX3CxAl3dkkSD996mJonKi7i+Un1 Z+BygS7hi62PyVhmaWzYD0PowGF0jFDgRzie+qM69wA4+pWUtBUKgmz2IT4BTOyLxAy6 e3djgxYgvUORiBNTQGx7LmUpx573EoNvcffODf9adNm079bEDILcxNtkfVYhCaZelDat ZgtHryGtZDBeQX5HD5HL4XeEGvnzWqPuXld8WZLdxiySsS8+hE9f7eTiS8AxPEJHJqb0 fzBGRQIk4nSgjqLyNRScXn5gLXydxhDbj1W7KntPgL+VRFwdlCkJmrdiXo0aa1NxRrkO Vuqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=Cw44uJb7Kl5eTlItM20YKjdztOYy1/oLTPOUw+C+5XU=; b=FyzEJDTFuDBtSXh+5jzkjGm0RpTdwZduKrb3TN3VM90CLw/rUAuMmE1gN4mZR0CILd RroVUpNd6l9NHKQdXZQdtYcN5q8bgikuWKJC/iOCbHXEgWnJYzr0p7HxTRlvT/EajrDv +/TAVL+idtXqEG0G57nnFINJteEXNa0osY+8N8mYvHwupEEYFYZlNEClACQ5tCR5LujV t5lJZSIoMiA2wRPm6/mkPKjsrkZAzmAXTMVH7LBhYXKB6bqPi/jV2QyxpiFuG9A2yoRH sCJCj0CIS6/dHyQfTSjZyt3G963r5kh7SP5bNcvY4k1cH19I/aP4hmUvDUyxcojNLUJi vZMg== X-Gm-Message-State: AIkVDXI888y6qx8M5rkNZ/hA3RJJqguFsOfUQb2BpqjEfgIDMAsmwL8mnIpoACjyVotJVA== X-Received: by 10.36.122.131 with SMTP id a125mr28999861itc.3.1486769242059; Fri, 10 Feb 2017 15:27:22 -0800 (PST) Original-Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id 86sm1634166iok.8.2017.02.10.15.27.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Feb 2017 15:27:21 -0800 (PST) In-Reply-To: (Drew Adams's message of "Sat, 21 Jan 2017 10:24:11 -0800 (PST)") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:129223 Archived-At: tags 25505 notabug quit Drew Adams writes: > For :keymap, the doc string says "Same as the KEYMAP argument." > Similarly the doc in (elisp) `Defining Minor Modes'. This does not > appear to be correct. > > For positional arg KEYMAP, the doc string says: > > If non-nil, it should be a variable name (whose value is a keymap), > or an expression that returns either a keymap or a list of > arguments for `easy-mmode-define-keymap'. > ... > > But the value of :keymap apparently cannot be a variable name whose > value is a keymap or an expression that evaluates to a keymap. The > :keymap value you pass is apparently not evaluated - unlike other > keyword values such as :group. The doc says "variable name" as opposed to "expression", I think it's clear that expression will be evaluated, and something which is not an expression will not be evaluated. I guess we could add "it should be an unquoted variable name..." > > So, for example, the `define-minor-mode' fr `follow-mode' uses this: > > :keymap follow-mode-map This is correct, follow-mode-map is the name of the variable. > and not this: > > :keymap 'follow-mode-map This is not correct, it's an expression which evaluates to the name of the variable. > > and not this: > > (let ((mainmap (make-sparse-keymap)) > (map (make-sparse-keymap))) > (define-key map "\C-v" 'follow-scroll-up) > ... > (define-key mainmap follow-mode-prefix map) > (define-key mainmap [remap end-of-buffer] 'follow-end-of-buffer) > ... > mainmap) This is correct, it's an expression which evaluates to a keymap. > In fact, it is not clear from the doc whether and which keyword values > are evaluated. And shouldn't they all be evaluated or else none be so? I don't see why, it's a macro, some arguments are evaluated, some aren't. > Here is allout.el, for example. It DOES use a quoted map-variable > (and it jumps through a few hoops). I don't think it should be doing that, it seems to be using some kind of needlessly complicated trickery. > Next up: autoarg-mode. This uses an UNquoted map variable. That's correct. > Those are only the first two grep hits for `define-minor-mode'. I checked a few more at random, I found no more incorrect cases.