* Re: Caps-mode vs. Overwrite mode
2015-04-03 14:47 ` Dan Espen
@ 2015-04-03 15:10 ` Eli Zaretskii
2015-04-03 15:25 ` Eli Zaretskii
2015-04-03 15:14 ` Dan Espen
` (3 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2015-04-03 15:10 UTC (permalink / raw)
To: help-gnu-emacs
> From: Dan Espen <despen@verizon.net>
> Date: Fri, 03 Apr 2015 10:47:03 -0400
>
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
> >> When I toggle caps-mode on, overwrite mode stops working.
> >> That is, inserted characters insert instead of overwriting.
> >> Any hints?
> >
> > 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?
>
> Works better than caps-mode, but does type lower case
> when the shift key is used. I can live with that I think,
> might even learn to like it.
How do you even get caps-mode to work? If I type any self-inserting
character after turning on caps-mode, I get an error:
insert-char: Symbol's value as variable is void: last-command-char
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Caps-mode vs. Overwrite mode
2015-04-03 15:10 ` Eli Zaretskii
@ 2015-04-03 15:25 ` Eli Zaretskii
0 siblings, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2015-04-03 15:25 UTC (permalink / raw)
To: help-gnu-emacs
> Date: Fri, 03 Apr 2015 18:10:43 +0300
> From: Eli Zaretskii <eliz@gnu.org>
>
> > From: Dan Espen <despen@verizon.net>
> > Date: Fri, 03 Apr 2015 10:47:03 -0400
> >
> > Stefan Monnier <monnier@iro.umontreal.ca> writes:
> >
> > >> When I toggle caps-mode on, overwrite mode stops working.
> > >> That is, inserted characters insert instead of overwriting.
> > >> Any hints?
> > >
> > > 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?
> >
> > Works better than caps-mode, but does type lower case
> > when the shift key is used. I can live with that I think,
> > might even learn to like it.
>
> How do you even get caps-mode to work? If I type any self-inserting
> character after turning on caps-mode, I get an error:
>
> insert-char: Symbol's value as variable is void: last-command-char
OK, I see now: caps-mode should be fixed to use last-command-event
instead of (the now deleted) last-command-char.
And the problem with overwrite mode is that caps-mode doesn't pay
attention to overwrite-mode, it always inserts a character, even if
overwrite-mode is on.
So it's a bug in caps-mode: its caps-mode-self-insert-command should
be smarter, and pay attention to overwrite-mode.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Caps-mode vs. Overwrite mode
2015-04-03 14:47 ` Dan Espen
2015-04-03 15:10 ` Eli Zaretskii
@ 2015-04-03 15:14 ` Dan Espen
[not found] ` <mailman.3243.1428073855.31049.help-gnu-emacs@gnu.org>
` (2 subsequent siblings)
4 siblings, 0 replies; 11+ messages in thread
From: Dan Espen @ 2015-04-03 15:14 UTC (permalink / raw)
To: help-gnu-emacs
Dan Espen <despen@verizon.net> writes:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
>>> When I toggle caps-mode on, overwrite mode stops working.
>>> That is, inserted characters insert instead of overwriting.
>>> Any hints?
>>
>> 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?
>
> Works better than caps-mode, but does type lower case
> when the shift key is used. I can live with that I think,
> might even learn to like it.
>
> So, good enough, thanks!
Spoke too soon.
caps-lock mode isn't buffer local.
I want to turn this on only in selected buffers.
It looks like I have to toggle caps-lock mode off to enter
lower case commands in the mini-buffer.
I'm using this for editing HLASM, PL/I, etc, languages that
are traditionally done all upper case.
--
Dan Espen
^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <mailman.3243.1428073855.31049.help-gnu-emacs@gnu.org>]
* Re: Caps-mode vs. Overwrite mode
[not found] ` <mailman.3243.1428073855.31049.help-gnu-emacs@gnu.org>
@ 2015-04-03 15:21 ` Dan Espen
0 siblings, 0 replies; 11+ messages in thread
From: Dan Espen @ 2015-04-03 15:21 UTC (permalink / raw)
To: help-gnu-emacs
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Dan Espen <despen@verizon.net>
>> Date: Fri, 03 Apr 2015 10:47:03 -0400
>>
>> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>
>> >> When I toggle caps-mode on, overwrite mode stops working.
>> >> That is, inserted characters insert instead of overwriting.
>> >> Any hints?
>> >
>> > 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?
>>
>> Works better than caps-mode, but does type lower case
>> when the shift key is used. I can live with that I think,
>> might even learn to like it.
>
> How do you even get caps-mode to work? If I type any self-inserting
> character after turning on caps-mode, I get an error:
>
> insert-char: Symbol's value as variable is void: last-command-char
Good question.
My copy has the same author and version number, but it uses
last-command-event:
(defun caps-mode-self-insert-command (&optional n)
"Like `self-insert-command', but uppercase the the typed character."
(interactive "p")
(message "insert")
(insert-char (upcase last-command-event) n))
Not sure if I made that change or I got my copy somewhere else.
--
Dan Espen
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Caps-mode vs. Overwrite mode
2015-04-03 14:47 ` Dan Espen
` (2 preceding siblings ...)
[not found] ` <mailman.3243.1428073855.31049.help-gnu-emacs@gnu.org>
@ 2015-04-03 15:26 ` Stefan Monnier
[not found] ` <mailman.3246.1428074815.31049.help-gnu-emacs@gnu.org>
4 siblings, 0 replies; 11+ messages in thread
From: Stefan Monnier @ 2015-04-03 15:26 UTC (permalink / raw)
To: help-gnu-emacs
>> 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)
^ permalink raw reply related [flat|nested] 11+ messages in thread
[parent not found: <mailman.3246.1428074815.31049.help-gnu-emacs@gnu.org>]
* Re: Caps-mode vs. Overwrite mode
[not found] ` <mailman.3246.1428074815.31049.help-gnu-emacs@gnu.org>
@ 2015-04-03 16:35 ` Dan Espen
2015-04-03 16:44 ` Stefan Monnier
[not found] ` <mailman.3250.1428079480.31049.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 11+ messages in thread
From: Dan Espen @ 2015-04-03 16:35 UTC (permalink / raw)
To: help-gnu-emacs
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>> 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
This change gives me an error.
Debugger entered--Lisp error: (void-variable caps-lock-mode)
(if caps-lock-mode (add-hook (quote pre-command-hook) (function
caps-lock--pch)
nil t) (remove-hook (quote pre-command-hook) (function caps-lock--pch) t))
(defvar caps-lock-mode
Without that change, the buffer local issue is fixed.
--
Dan Espen
^ permalink raw reply [flat|nested] 11+ messages in thread