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

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

Re: Caps-mode vs. Overwrite mode


From: Stefan Monnier
Subject: Re: Caps-mode vs. Overwrite mode
Date: Fri, 03 Apr 2015 11:26:36 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

>> The caps-mode.el that's in GNU ELPA shouldn't suffer from this
>> problem, AFAIK.
> My first search only turns up caps-lock.el?

Ah, right, that's the one.  Sorry for the typo.

> Spoke too soon.
> caps-lock mode isn't buffer local.

Indeed.

You can make it buffer-local with the patch below.

If someone wants to submit a patch which adds buffer-local variant, that
could be included in the GNU ELPA package.


        Stefan


diff --git a/packages/caps-lock/caps-lock.el b/packages/caps-lock/caps-lock.el
index 24729a4..5787ef8 100644
--- a/packages/caps-lock/caps-lock.el
+++ b/packages/caps-lock/caps-lock.el
@@ -29,10 +29,10 @@
 ;;;###autoload
 (define-minor-mode caps-lock-mode
   "Make self-inserting keys invert the capitalization."
-  :global t
+  ;; :global t
   (if caps-lock-mode
-      (add-hook 'pre-command-hook #'caps-lock--pch)
-    (remove-hook 'pre-command-hook #'caps-lock--pch)))
+      (add-hook 'pre-command-hook #'caps-lock--pch nil t)
+    (remove-hook 'pre-command-hook #'caps-lock--pch t)))
 
 (defun caps-lock--pch ()
   (when (and (characterp last-command-event)




reply via email to

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