From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: Caps Lock affects Ctrl+keys Date: Fri, 24 Jan 2014 10:56:27 -0500 Message-ID: References: <87ppnmulrq.fsf@nl106-137-194.student.uu.se> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1390579041 19800 80.91.229.3 (24 Jan 2014 15:57:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 24 Jan 2014 15:57:21 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jan 24 16:57:28 2014 Return-path: Envelope-to: geh-help-gnu-emacs@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 1W6j8F-0007bD-FW for geh-help-gnu-emacs@m.gmane.org; Fri, 24 Jan 2014 16:57:23 +0100 Original-Received: from localhost ([::1]:47382 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W6j8F-0007mU-3t for geh-help-gnu-emacs@m.gmane.org; Fri, 24 Jan 2014 10:57:23 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60809) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W6j7s-0007hC-SZ for help-gnu-emacs@gnu.org; Fri, 24 Jan 2014 10:57:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W6j7k-0005CT-5E for help-gnu-emacs@gnu.org; Fri, 24 Jan 2014 10:57:00 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:42821) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W6j7j-0005CG-Ug for help-gnu-emacs@gnu.org; Fri, 24 Jan 2014 10:56:52 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1W6j7e-0007DI-MV for help-gnu-emacs@gnu.org; Fri, 24 Jan 2014 16:56:46 +0100 Original-Received: from 108.161.115.189 ([108.161.115.189]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 24 Jan 2014 16:56:46 +0100 Original-Received: from monnier by 108.161.115.189 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 24 Jan 2014 16:56:46 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 33 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 108.161.115.189 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Cancel-Lock: sha1:vMRzd4CLjVVYrGc7p0SIjfCNYj0= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:95623 Archived-At: > Does anyone happen to know what is the canonical repository for > caps-mode? I’d like to submit a couple of patches that fix the > following: > * the use of obsolete last-command-char variable, > * caps-mode ignores the state of overwrite-mode and always inserts. FWIW I've been using the following hack occasionally. Never bothered to distribute it. Stefan (defvar caps-lock-commands '(self-insert-command isearch-printing-char) "List of commands that are subject to `caps-lock-mode'.") (define-minor-mode caps-lock-mode "Make self-inserting keys invert the capitalization." :global t (if caps-lock-mode (add-hook 'pre-command-hook #'caps-lock--pch) (remove-hook 'pre-command-hook #'caps-lock--pch))) (defun caps-lock--pch () (when (memq this-command caps-lock-commands) (setq last-command-event (condition-case nil (let ((up (upcase last-command-event))) (if (eq up last-command-event) (downcase last-command-event) up)) (error last-command-event)))))