From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas Politz Newsgroups: gmane.emacs.help Subject: Re: window-specific Caps Lock Date: Sun, 08 Nov 2009 20:21:16 +0100 Message-ID: <87ocncyg9f.fsf@fh-trier.de> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1257708143 26128 80.91.229.12 (8 Nov 2009 19:22:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 8 Nov 2009 19:22:23 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Nov 08 20:22:16 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1N7DL3-000162-89 for geh-help-gnu-emacs@m.gmane.org; Sun, 08 Nov 2009 20:22:13 +0100 Original-Received: from localhost ([127.0.0.1]:54841 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N7DL2-0004P5-Nf for geh-help-gnu-emacs@m.gmane.org; Sun, 08 Nov 2009 14:22:12 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N7DKc-0004Ok-GL for help-gnu-emacs@gnu.org; Sun, 08 Nov 2009 14:21:46 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N7DKX-0004OI-Px for help-gnu-emacs@gnu.org; Sun, 08 Nov 2009 14:21:45 -0500 Original-Received: from [199.232.76.173] (port=58964 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N7DKX-0004OF-Kw for help-gnu-emacs@gnu.org; Sun, 08 Nov 2009 14:21:41 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:53886) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1N7DKX-0001ev-8f for help-gnu-emacs@gnu.org; Sun, 08 Nov 2009 14:21:41 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.50) id 1N7DKV-0000pl-2t for help-gnu-emacs@gnu.org; Sun, 08 Nov 2009 20:21:39 +0100 Original-Received: from dslb-088-068-200-001.pools.arcor-ip.net ([88.68.200.1]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 08 Nov 2009 20:21:39 +0100 Original-Received: from politza by dslb-088-068-200-001.pools.arcor-ip.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 08 Nov 2009 20:21:39 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 54 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: dslb-088-068-200-001.pools.arcor-ip.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:g0NDuEYCmGjkUmuMFbZ8vx+SdhE= X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:69613 Archived-At: Girish Kulkarni writes: > Hi, > > I spend much time programming in Fortran 90 on my system, which is > Debian 5.0 with GNOME. I type the code in GNU Emacs and I prefer > typing Fortran 90 ALL CAPS. > > This usually means that I need to toggle the `Caps Lock' switch on my > keyboard every time I switch from the Emacs window to the terminal > (which for me is Xterm). > > Is there a way I can set things up so that while I'm typing Fortran > 90, text will automatically be entered ALL CAPS in the Emacs buffer, > but not in any other windows? Maybe by telling Emacs? > > Thanks, > Girish. How about inverting the meaning of shift ? In case you need other non-ascii characters you'll have to extend this. (defvar inverse-case-mode-map (let ((km (make-sparse-keymap)) (ch ?A)) (while (<= ch ?z) (define-key km (vector ch) 'self-insert-inverse-case-command) (setq ch (1+ ch)) (if (eq ch ?Z) (setq ch ?a))) km)) (defun self-insert-inverse-case-command (arg) (interactive "p") (let ((last-command-event (+ last-command-event (if (equal (downcase (string last-command-event)) (string last-command-event)) (- ?A ?a) (- ?a ?A))))) (call-interactively 'self-insert-command))) (define-minor-mode inverse-case-mode nil nil " InvCase") ;;; (add-hook 'fortran-mode #'(lambda nil (inverse-case-mode 1))) ...or whatever. -ap