help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Caps Lock affects Ctrl+keys


From: Stefan Monnier
Subject: Re: Caps Lock affects Ctrl+keys
Date: Fri, 24 Jan 2014 10:56:27 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> 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)))))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]