5

Emacs 中是否有命令打开可能被描述为“大写锁定次要模式”的命令?我想做类似的事情M-x toggle-caps-mode,然后我在缓冲区中输入的每个字母都是大写字母,直到我M-x toggle-caps-mode再次这样做。

注意:我不是在寻找有关如何交换上限和控制的说明。实际上,这是因为我已经这样做了。我通常对此很满意,但有时我正在编辑代码,其中有一堆全大写的常量,按住 shift 键会很费劲。我知道各种upcase转换功能;我宁愿不必输入单词,选择它,然后运行upcase-region​​.

如果重要的话,我使用的是带有 Emacs 23.3.1 的 Aquamacs 2.2。

4

2 回答 2

5

您无需键入单词然后选择它。如果要大写最后一个单词,请按M-b M-uESC b u。好的,b如果是word_with_underscores.

如果您真的想要大写锁定次要模式,请尝试John Paul Wallington 的lockcaps.el.

于 2011-10-27T21:17:32.060 回答
2

你可以尝试这样的事情:

(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
    ))
于 2011-10-27T19:29:16.770 回答