From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Dima Kogan Newsgroups: gmane.emacs.bugs Subject: bug#24456: 25.1; [PATCH] Caps-lock doesn't affect interpretation of key chords Date: Wed, 21 Sep 2016 16:30:21 -0700 Message-ID: <8737ks7rw2.fsf@secretsauce.net> References: <87oa3l7ku4.fsf@secretsauce.net> <87k2e9z4l9.fsf@users.sourceforge.net> <87lgyp6p5h.fsf@secretsauce.net> <834m5ciq4m.fsf@gnu.org> <87k2e879by.fsf@secretsauce.net> <83shsvhmc2.fsf@gnu.org> <87fuov7o3a.fsf@secretsauce.net> <83lgynhgg1.fsf@gnu.org> <87d1jz7hx3.fsf@secretsauce.net> <83mvj1fgi4.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1474500681 15401 195.159.176.226 (21 Sep 2016 23:31:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 21 Sep 2016 23:31:21 +0000 (UTC) User-Agent: mu4e 0.9.17; emacs 25.1.1 Cc: 24456@debbugs.gnu.org, npostavs@users.sourceforge.net To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Sep 22 01:31:17 2016 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 1bmqyx-0003LG-Hq for geb-bug-gnu-emacs@m.gmane.org; Thu, 22 Sep 2016 01:31:15 +0200 Original-Received: from localhost ([::1]:35135 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmqyv-0003mQ-Ig for geb-bug-gnu-emacs@m.gmane.org; Wed, 21 Sep 2016 19:31:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58981) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmqyo-0003lu-Rw for bug-gnu-emacs@gnu.org; Wed, 21 Sep 2016 19:31:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmqyl-00009m-Kq for bug-gnu-emacs@gnu.org; Wed, 21 Sep 2016 19:31:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:53856) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmqyk-00009S-CJ for bug-gnu-emacs@gnu.org; Wed, 21 Sep 2016 19:31:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bmqyk-0002UA-5A for bug-gnu-emacs@gnu.org; Wed, 21 Sep 2016 19:31:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dima Kogan Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 21 Sep 2016 23:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24456 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 24456-submit@debbugs.gnu.org id=B24456.14745006269511 (code B ref 24456); Wed, 21 Sep 2016 23:31:02 +0000 Original-Received: (at 24456) by debbugs.gnu.org; 21 Sep 2016 23:30:26 +0000 Original-Received: from localhost ([127.0.0.1]:60046 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bmqyA-0002TL-Au for submit@debbugs.gnu.org; Wed, 21 Sep 2016 19:30:26 -0400 Original-Received: from out2-smtp.messagingengine.com ([66.111.4.26]:38448) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bmqy8-0002TD-IK for 24456@debbugs.gnu.org; Wed, 21 Sep 2016 19:30:25 -0400 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 1F28D20675; Wed, 21 Sep 2016 19:30:24 -0400 (EDT) Original-Received: from frontend2 ([10.202.2.161]) by compute5.internal (MEProxy); Wed, 21 Sep 2016 19:30:24 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=secretsauce.net; h=cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=1SG4L /Pp2WIsQ4NQd1TVtJm7Xo4=; b=Gocl8XSb8TQhSG5AzVUGr7HU486HPe8SULyxH ctsSAGpAjcWP1tf9OCPuP02srjYxfbbf54OcGXA9u4iDOqYieGwZ39RbyD03+GXO f0Y684GoPodQPWOIbDDK8pgDTK+BGqwzUz3KAkwBGkFXpBDRw2yGopuusu8/N9BK M1GdYw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=1SG4L/Pp2WIsQ4NQd1TVtJm7Xo4=; b=j2DJR oKgHB81k/WReX+q2QijyAgfdrMHyQYlcCg6h/WmlhUWimxfYXcpnX5WWyVdMdnnB O31XedbztrKrJ2sMMY+aIS7+IL8JpOS7OLPMFzV/znxqeieBj+uvbXIHricNMW98 oNk9yZU+zLHQvGiLU1mHq37BnfWv+0JaqPQfIY= X-Sasl-enc: olWSBbFrQh5I6Sl8s8AXUls/NBYILa8AjxOsmq8zsHxK 1474500623 Original-Received: from shorty.local (unknown [128.149.110.210]) by mail.messagingengine.com (Postfix) with ESMTPA id C8118CCE8B; Wed, 21 Sep 2016 19:30:23 -0400 (EDT) Original-Received: from dima by shorty.local with local (Exim 4.87) (envelope-from ) id 1bmqy5-0006GU-Db; Wed, 21 Sep 2016 16:30:21 -0700 In-reply-to: <83mvj1fgi4.fsf@gnu.org> 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:123538 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: > We already have an inline function 'uppercasep', which you could use; > it supports any character that Emacs supports. OK. In that case, how about the attached patch? Tested working on gtk. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Caps-lock-doesn-t-affect-interpretation-of-key-chord.patch >From 2b81504e1f34fed36c5ec1ee95dbceaf8df9d321 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Sat, 17 Sep 2016 23:47:48 -0700 Subject: [PATCH] Caps-lock doesn't affect interpretation of key chords * src/keyboard.c (make_lispy_event): when a user pressed key-chords the caps-lock no longer affects the "shift" state of the generated chord. For instance Control+s produces C-s regardless of the caps-lock state. And Control+Shift+s produces C-S-s regardless of the caps-lock state. --- src/keyboard.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/keyboard.c b/src/keyboard.c index b8bc361..ed0d9db 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -5417,6 +5417,33 @@ make_lispy_event (struct input_event *event) { c &= 0377; eassert (c == event->code); + + /* Caps-lock shouldn't affect interpretation of key chords: + Control+s should produce C-s whether caps-lock is on or + not. And Control+Shift+s should produce C-S-s whether + caps-lock is on or not. */ + if (event->modifiers & ~shift_modifier) + { + /* this is a key chord: some non-shift modifier is + depressed */ + + if (uppercasep(c) && + !(event->modifiers & shift_modifier) ) + { + /* Got a capital letter without a shift. The caps + lock is on. Un-capitalize the letter */ + c = downcase(c); + } + else if (lowercasep(c) && + (event->modifiers & shift_modifier) ) + { + /* Got a lower-case letter even though shift is + depressed. The caps lock is on. Capitalize the + letter */ + c = upcase(c); + } + } + /* Turn ASCII characters into control characters when proper. */ if (event->modifiers & ctrl_modifier) -- 2.9.3 --=-=-=--