Question

Is there a command in Emacs to turn on what might be described as "caps lock minor mode"? I'm looking to do something like M-x toggle-caps-mode, then every letter I type in the buffer is a capital letter until I do M-x toggle-caps-mode again.

Note: I'm NOT looking for directions on how to swap caps and control. In reality this is because I have already done that. I am generally quite happy with it, but occasionally I'm editing code where there are a bunch of constants that are in all caps, and it gets to be a strain holding down the shift key. I'm aware of the various upcase conversion functions; I'd rather not have to type the word, select it, then run upcase-region.

If it matters, I'm using Aquamacs 2.2 w/ Emacs 23.3.1.

Was it helpful?

Solution

You don't need to type the word then select it. If you want to upcase the last word, press M-b M-u or ESC b u. Ok, you'll need to press b several times if it's a word_with_underscores.

If you really want a caps lock minor mode, try John Paul Wallington's lockcaps.el.

OTHER TIPS

You can try something like this:

(define-minor-mode caps-lock-mode
  "caps-lock mode"
  ;;   The initial value.   
  nil   
  ;; The indicator for the mode line.   
  " CAPS-LOCK"   
  ;; The minor mode bindings.   
  '(("a" . (lambda () (interactive) (insert-char ?A 1)))
    ("b" . (lambda () (interactive) (insert-char ?B 1)))
    ;;etc 
    ("A" . (lambda () (interactive) (insert-char ?a 1)))    
    ("B" . (lambda () (interactive) (insert-char ?b 1)))    
    ;;etc
    ))
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top