From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#43617: 27.1; Define-minor-mode keybindings not get precedence over global keymap Date: Sat, 26 Sep 2020 08:25:37 -0700 (PDT) Message-ID: <59b95abb-1c57-4a94-b6e0-7f4bdeef72ee@default> References: <53faa17bc88194ba2a67440eb1ddd139ea1188c3.camel@gmail.com> <87eemoljlj.fsf@gnus.org> <878scwljdp.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14094"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 43617@debbugs.gnu.org To: Lars Ingebrigtsen , dalanicolai@gmail.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 26 17:26:25 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kMC5g-0003ZB-QL for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 26 Sep 2020 17:26:24 +0200 Original-Received: from localhost ([::1]:34528 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMC5f-00008j-Rf for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 26 Sep 2020 11:26:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38558) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kMC5K-00008Z-Pv for bug-gnu-emacs@gnu.org; Sat, 26 Sep 2020 11:26:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36031) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kMC5K-0007S1-Fn for bug-gnu-emacs@gnu.org; Sat, 26 Sep 2020 11:26:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kMC5K-00075w-CX for bug-gnu-emacs@gnu.org; Sat, 26 Sep 2020 11:26:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 26 Sep 2020 15:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43617 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: notabug Original-Received: via spool by 43617-submit@debbugs.gnu.org id=B43617.160113395127255 (code B ref 43617); Sat, 26 Sep 2020 15:26:02 +0000 Original-Received: (at 43617) by debbugs.gnu.org; 26 Sep 2020 15:25:51 +0000 Original-Received: from localhost ([127.0.0.1]:47577 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMC58-00075X-Lo for submit@debbugs.gnu.org; Sat, 26 Sep 2020 11:25:50 -0400 Original-Received: from userp2120.oracle.com ([156.151.31.85]:57542) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMC55-00075I-Oe for 43617@debbugs.gnu.org; Sat, 26 Sep 2020 11:25:49 -0400 Original-Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 08QFPgCd148088; Sat, 26 Sep 2020 15:25:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : cc : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=vWQ1UJQvt2NHDTKv5EP/oVTKhjHl/bvN8NN21c6tihg=; b=WL68un4aXLBZ9ka8Eixsmgt8I+yB+zBPTb2zhju4tDt+GptOsTqYkzXYepnmX+H9miXt CEzTAOv8VvYJCaFzJ9yCshDTzXpsm/RSLa5htuZQvdlf7OfNEi9+DRJqLgOfZ7HTHQ+2 daTsCAKeZTxKFWxMx9iHngL6ssgmcL9xcECW7WwRriQR37xQ48A/HhfbNzGwPpvaeLfb RpQXvJughnFGFJaodo1TrCe4yINf7pGfPa4+bIncR4WYFLXX5RSesLVE7KR91mbiz59v j4g4zEH27WAiFqP7bEDre/1fwqNjj/3qDRrE2okh0rzeKwjaeI/uK1bPJzNq3k+i5awQ BA== Original-Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 33sx9mrqa9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sat, 26 Sep 2020 15:25:41 +0000 Original-Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 08QFKEvI039025; Sat, 26 Sep 2020 15:25:41 GMT Original-Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 33sweyger3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 26 Sep 2020 15:25:41 +0000 Original-Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 08QFPc8Q026625; Sat, 26 Sep 2020 15:25:39 GMT In-Reply-To: <878scwljdp.fsf@gnus.org> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.5056.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9756 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 bulkscore=0 mlxscore=0 malwarescore=0 mlxlogscore=984 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009260140 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9756 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 phishscore=0 mlxscore=0 lowpriorityscore=0 adultscore=0 clxscore=1011 spamscore=0 impostorscore=0 malwarescore=0 bulkscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009260140 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:189041 Archived-At: > Ah, it just works for "j" by accident -- define-minor-mode does not > evaluate anything in the keymap form. It should. According to its doc string. > So there's no bug here in define-minor-mode, but the > here is wrong. It should be: >=20 > (define-minor-mode pdf-continuous-scroll-mode-5 > "Emulate continuous scroll with two synchronized buffers" > nil > " Continuous" > `((,(kbd "j") . (lambda () (interactive) (print "pushed j"))) > (,(kbd "C-n") . (lambda () (interactive)(print "pushed C-n")))) > (print "toggled minor mode")) >=20 > So I'm closing this bug report. I don't agree that there's no bug (IIUC). I think there's either a doc bug (if you think the current behavior is what we want - I don't) or a behavior bug (if you think the doc's described behavior is what we want - I do). The doc string says that KEYMAP can be: an expression that returns either a keymap or a list of (KEY . BINDING) pairs where KEY and BINDING are suitable for `define-key' The cons ((kbd "C-n") . 'foo) is exactly such a (KEY . BINDING) pair - both KEY and BINDING are suitable arguments for `define-key'. Yes, it's true that the _result of evaluating_ (kbd ...) is ALSO an acceptable arg for `define-key'. But `define-key' doesn't _require_ its KEY arg to be, say, a string or vector. `define-key' evaluates its arg. And a list (kbd ...) is an acceptable arg for `define-key'. You can write (define-key map (kbd "C-n") 'foo) Or you can write (define-key map " " 'foo) where that string with char ?\n (Control-J) is the result of evaluating the sexp (kbd "C-n"). Or you can write (define-key map "\n" 'foo) `define-minor-mode' should accept any expression that `define-key' accepts for KEY. In the case of `C-n' that means (kbd "C-n"), "\n", and " ".