[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
John Paul Wallington
11 Sep 2001 19:06:44 +0100
Gnus/5.090003 (Oort 0.03) Emacs/22.214.171.124 (i686-pc-linux-gnu)
I'm trying to get lockcaps.el to work for LEIM users. It appears to work
for me using the french-azerty input method on GNU Emacs 21.
Any comments, fixes and improvements are much appreciated.
;;; lockcaps.el --- caps lock mode for Emacs
;; Copyright (C) 2001 John Paul Wallington
;; Author: John Paul Wallington <address@hidden>
;; Created: 5 Sep 2001
;; Version: 0.4, 11 Sep 2001
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation; either version 2, or (at
;; your option) any later version.
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;; Whilst playing with Hemlock on CMU Common Lisp I did:
;; M-x apropos lock
;; and the first match was:
;; "Caps Lock Mode\n Simulate having a CAPS LOCK key."
;; What a neat idea. A Google search for capslock.el garnered:
;; capslock.el, a quick and dirty Emacs 19 caps-lock minor mode
;; by Eberhard Mattes <address@hidden>
;; dated 19-May-1993.
;; It had been done already. Rats. Anyway, this is my version.
;; This version implements a minor-mode keymap rather than changing
;; the global keymap. It doesn't need special minibuffer precautions.
;; If you (setq lockcaps-all-keys t) before loading, all self-inserting
;; keys are upcase-d, and LEIM methods might work.
(defvar lockcaps-mode nil
"Mode variable for lockcaps minor mode.")
(defvar lockcaps-all-keys nil
"Non-nil means include all self-inserting keys, and some others,
(defvar lockcaps-mode-map nil
"Keymap for lockcaps minor mode.")
(setq lockcaps-mode-map (make-keymap))
;; brain-damage follows...
(let ((key 129))
(while (< key 256)
(global-set-key (vector key) 'lockcaps-self-insert)
(setq key (1+ key)))))
'(?a ?b ?c ?d ?e ?f ?g ?h ?i ?j ?k ?l ?m
?n ?o ?p ?q ?r ?s ?t ?u ?v ?w ?x ?y ?z)))
(char-to-string (car keys)) 'lockcaps-self-insert)
(setq keys (cdr keys))))))
(or (assq 'lockcaps-mode minor-mode-map-alist)
(cons (cons 'lockcaps-mode lockcaps-mode-map)
(or (assq 'lockcaps-mode minor-mode-alist)
(cons '(lockcaps-mode " CAPS") minor-mode-alist)))
(defun lockcaps-mode (&optional arg)
"Toggle lockcaps minor mode."
(if (null arg)
(> (prefix-numeric-value arg) 0)))
(defun lockcaps-self-insert (arg)
"Insert a character in upper case."
(setq last-command-char (upcase last-command-char))
;;; lockcaps.el ends here
John Paul Wallington
Send your questions to ``ASK ZIPPY'', Box 40474,
San Francisco, CA 94140, USA
|[Prev in Thread]
||[Next in Thread]|
- lockcaps.el 0.4,
John Paul Wallington <=