Emacs 大写锁定次要模式?

发布于 2024-12-12 01:32:11 字数 374 浏览 6 评论 0原文

Emacs 中是否有命令可以打开所谓的“大写锁定次要模式”?我想做一些类似 Mxtoggle-caps-mode 的事情,然后我在缓冲区中输入的每个字母都是大写字母,直到我执行 Mxtoggle-caps-mode再次。

注意:我不是在寻找有关如何交换上限和控制的说明。事实上,这是因为我已经这样做了。我通常对此感到非常满意,但有时我正在编辑代码,其中有一堆全部大写的常量,并且按住 Shift 键会变得很紧张。我知道各种 upcase 转换函数;我不想输入单词,选择它,然后运行 ​​upcase-region

如果重要的话,我正在使用 Aquamacs 2.2 和 Emacs 23.3.1。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

懒的傷心 2024-12-19 01:32:12

您不需要输入单词然后选择它。如果您想将最后一个单词大写,请按 Mb MuESC b u。好的,如果是 word_with_underscores,您需要按几次 b

如果您确实想要大写锁定次要模式,请尝试 约翰·保罗·沃林顿 (John Paul Wallington) 的 lockcaps.el

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.

っ左 2024-12-19 01:32:12

你可以尝试这样的事情:

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

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
    ))
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文