* cannot disable paren matching
@ 2016-12-27 20:29 Don Woods
2016-12-27 21:23 ` Skip Montanaro
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: Don Woods @ 2016-12-27 20:29 UTC (permalink / raw)
To: help-gnu-emacs; +Cc: don
I am having a problem where paren matching is not working as desired,
and I am unable either to turn it off or to make it work correctly.
The specific case where I'm having trouble is in PostScript mode,
when also in Overwrite mode. When I type a character that acts as a
close paren -- such as > or } -- the character is inserted instead of
overwriting the current char. Emacs briefly highlights the matching
open paren, or reports a mismatch, as the case may be, but does NOT
remove the char I was intending to overwrite.
Since I don't especially need the paren highlighting in my current
editing, most of my attempts to work around this bug have involved
trying to disable the paren-matching behavior. I have tried such
things as
(show-paren-mode 0) ;; no noticeable change
(show-paren-mode nil) ;; no longer shows matching open
;; but still does not overwrite
(modify-syntax-entry ?> "w" ps-mode-syntax-table)
;; > now highlights the char AFTER the matching <
;; but still does not overwrite
(modify-syntax-entry ?< "w" ps-mode-syntax-table)
;; when combined with previous, > goes back to
;; showing matching <, but still does not overwrite
I know I've tinkered with other paren-related vars without success,
but no longer recall everything I tried.
My only successful workaround so far is to scrap postscript-mode and
use fundamental-mode. I'm using overwrite-mode while editing a portion
of the PostScript file that is a block of "ascii art" data, so don't
really need postscript-mode there, but it's awkward when switching
between the data and code portions of the file.
Note: emacs-version is:
"GNU Emacs 22.1.1 (mac-apple-darwin)
of 2016-04-22 on osx143.apple.com"
Suggestions appreciated!
-- Don Woods
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: cannot disable paren matching
2016-12-27 20:29 Don Woods
@ 2016-12-27 21:23 ` Skip Montanaro
2016-12-27 21:30 ` John Mastro
` (2 subsequent siblings)
3 siblings, 0 replies; 11+ messages in thread
From: Skip Montanaro @ 2016-12-27 21:23 UTC (permalink / raw)
To: Don Woods; +Cc: help-gnu-emacs
Have you tried (show-paren-mode -1)? The function help (24.3 here, not
22.x) says, "enable Show Paren mode if ARG is positive, and disable it
otherwise." Not sure whether ELisp considers 0 a positive number or
not, or how it might classify nil, but maybe give that a try...
Skip
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: cannot disable paren matching
2016-12-27 20:29 Don Woods
2016-12-27 21:23 ` Skip Montanaro
@ 2016-12-27 21:30 ` John Mastro
2016-12-27 21:52 ` John Mastro
2016-12-27 21:36 ` Stefan Monnier
2016-12-27 22:42 ` Konstantin Shakhnov
3 siblings, 1 reply; 11+ messages in thread
From: John Mastro @ 2016-12-27 21:30 UTC (permalink / raw)
To: help-gnu-emacs@gnu.org; +Cc: Don Woods
Don Woods <don@icynic.com> wrote:
> I am having a problem where paren matching is not working as desired,
> and I am unable either to turn it off or to make it work correctly.
>
> The specific case where I'm having trouble is in PostScript mode,
> when also in Overwrite mode. When I type a character that acts as a
> close paren -- such as > or } -- the character is inserted instead of
> overwriting the current char. Emacs briefly highlights the matching
> open paren, or reports a mismatch, as the case may be, but does NOT
> remove the char I was intending to overwrite.
>
> Since I don't especially need the paren highlighting in my current
> editing, most of my attempts to work around this bug have involved
> trying to disable the paren-matching behavior. I have tried such
> things as
>
> (show-paren-mode 0) ;; no noticeable change
>
> (show-paren-mode nil) ;; no longer shows matching open
> ;; but still does not overwrite
>
> (modify-syntax-entry ?> "w" ps-mode-syntax-table)
> ;; > now highlights the char AFTER the matching <
> ;; but still does not overwrite
> (modify-syntax-entry ?< "w" ps-mode-syntax-table)
> ;; when combined with previous, > goes back to
> ;; showing matching <, but still does not overwrite
>
> I know I've tinkered with other paren-related vars without success,
> but no longer recall everything I tried.
>
> My only successful workaround so far is to scrap postscript-mode and
> use fundamental-mode. I'm using overwrite-mode while editing a portion
> of the PostScript file that is a block of "ascii art" data, so don't
> really need postscript-mode there, but it's awkward when switching
> between the data and code portions of the file.
>
> Note: emacs-version is:
> "GNU Emacs 22.1.1 (mac-apple-darwin)
> of 2016-04-22 on osx143.apple.com"
I'm not totally sure I understand the scenario, but I tried to reproduce
this in Emacs 25 using the steps below and everything seemed to work as
intended. Specifically, at the end of the steps, the buffer contained
"a{b}c{d}".
Here are the steps I tried:
emacs -Q
C-x b ps RET
M-x ps-mode RET
M-x show-paren-mode RET
M-x overwrite-mode RET
foo{bar}
C-a
a{b}c{d}
If my recipe above would indeed trigger the problem you're describing,
perhaps using a newer version of Emacs would do the trick - Emacs 22 is
quite old (circa 2006 I believe).
If the recipe above does not capture the problem, can you provide
similar steps from "emacs -Q" that we can experiment with?
John
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: cannot disable paren matching
2016-12-27 20:29 Don Woods
2016-12-27 21:23 ` Skip Montanaro
2016-12-27 21:30 ` John Mastro
@ 2016-12-27 21:36 ` Stefan Monnier
2016-12-27 22:42 ` Konstantin Shakhnov
3 siblings, 0 replies; 11+ messages in thread
From: Stefan Monnier @ 2016-12-27 21:36 UTC (permalink / raw)
To: help-gnu-emacs
> Note: emacs-version is:
> "GNU Emacs 22.1.1 (mac-apple-darwin)
> of 2016-04-22 on osx143.apple.com"
IOW, this is Apple's brain-dead version which is only about 15 years old.
Please stay away from it, use the real thing instead.
Stefan
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: cannot disable paren matching
2016-12-27 21:30 ` John Mastro
@ 2016-12-27 21:52 ` John Mastro
2016-12-27 22:35 ` Don Woods
0 siblings, 1 reply; 11+ messages in thread
From: John Mastro @ 2016-12-27 21:52 UTC (permalink / raw)
To: help-gnu-emacs@gnu.org; +Cc: Don Woods
John Mastro <john.b.mastro@gmail.com> wrote:
> I'm not totally sure I understand the scenario, but I tried to reproduce
> this in Emacs 25 using the steps below and everything seemed to work as
> intended. Specifically, at the end of the steps, the buffer contained
> "a{b}c{d}".
By the way, I believe disabling show-paren-mode should be as simple as
typing `M-x show-paren-mode RET', or (show-paren-mode -1), though to be
honest Emacs 22 is from before I started using Emacs.
John
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: cannot disable paren matching
2016-12-27 21:52 ` John Mastro
@ 2016-12-27 22:35 ` Don Woods
0 siblings, 0 replies; 11+ messages in thread
From: Don Woods @ 2016-12-27 22:35 UTC (permalink / raw)
To: help-gnu-emacs; +Cc: don
Thanks John and Skip for the answers so far. I tried (show-paren-mode -1)
and it seems to be the same as (show-paren-mode 0) in that it yields nil,
whereas (show-paren-mode 1) yields t. I've also tried M-x show-paren-mode,
which toggles the state. Interestingly, even in fundamental-mode, turning
show-paren-mode off does NOT stop emacs from briefly moving to the matching
open when I type a close, whether or not I'm in overwrite-mode.
As to John's scenario starting with emacs -Q, I tried it on my emacs and
ended with "a{b}c{d}r}" in the buffer, i.e. with two extra chars at the end
due to the two occurrences of buggy behavior on close. I have emacs 24.2.1
on another system (unix not Mac, not that that should matter) and it shows
the same bug. I guess I'll have to see if I can get 25 installed on either
or both of those systems.
Perhaps someone who has Emacs 24 installed can try John's scenario and shed
further light?
-- Don.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: cannot disable paren matching
2016-12-27 20:29 Don Woods
` (2 preceding siblings ...)
2016-12-27 21:36 ` Stefan Monnier
@ 2016-12-27 22:42 ` Konstantin Shakhnov
2016-12-27 23:05 ` John Mastro
3 siblings, 1 reply; 11+ messages in thread
From: Konstantin Shakhnov @ 2016-12-27 22:42 UTC (permalink / raw)
To: help-gnu-emacs
On Tue, Dec 27, 2016 at 01:29:47PM -0700, Don Woods wrote:
> I am having a problem where paren matching is not working as desired,
> and I am unable either to turn it off or to make it work correctly.
>
> The specific case where I'm having trouble is in PostScript mode,
> when also in Overwrite mode. When I type a character that acts as a
> close paren -- such as > or } -- the character is inserted instead of
> overwriting the current char. Emacs briefly highlights the matching
> open paren, or reports a mismatch, as the case may be, but does NOT
> remove the char I was intending to overwrite.
>
> Since I don't especially need the paren highlighting in my current
> editing, most of my attempts to work around this bug have involved
> trying to disable the paren-matching behavior. I have tried such
> things as
>
Similar at GNU Emacs 24.5.1.
Are you sure that the culprit is the (show-paren-mode) ?
M-x describe-mode ps-mode said
...
> ps-mode-r-gt
] ps-mode-r-angle
} ps-mode-r-brace
...
(defun ps-mode-r-brace ()
"Insert `}' and perform balance."
(interactive)
(insert "}")
(ps-mode-r-balance "}"))
So it seems like you need overwrite or disable or make something other
with ps-mode-r-brace. For instance (add to .emacs):
(defun my-ps-mode-r-brace ()
(interactive)
(self-insert-command 1))
(add-hook 'ps-mode-hook
(lambda () (local-set-key (kbd "}") 'my-ps-mode-r-brace)))
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: cannot disable paren matching
2016-12-27 22:42 ` Konstantin Shakhnov
@ 2016-12-27 23:05 ` John Mastro
2016-12-27 23:14 ` Stefan Monnier
2016-12-28 0:46 ` Don Woods
0 siblings, 2 replies; 11+ messages in thread
From: John Mastro @ 2016-12-27 23:05 UTC (permalink / raw)
To: help-gnu-emacs@gnu.org; +Cc: Don Woods
Konstantin Shakhnov <kastian@mail.ru> wrote:
> Similar at GNU Emacs 24.5.1.
>
> Are you sure that the culprit is the (show-paren-mode) ?
>
> M-x describe-mode ps-mode said
>
> ...
>> ps-mode-r-gt
> ] ps-mode-r-angle
> } ps-mode-r-brace
In Emacs 25 these are all bound to `self-insert-command', so I suspect
that's the issue (and not show-paren-mode).
John
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: cannot disable paren matching
2016-12-27 23:05 ` John Mastro
@ 2016-12-27 23:14 ` Stefan Monnier
2016-12-28 0:46 ` Don Woods
1 sibling, 0 replies; 11+ messages in thread
From: Stefan Monnier @ 2016-12-27 23:14 UTC (permalink / raw)
To: help-gnu-emacs
> In Emacs 25 these are all bound to `self-insert-command', so I suspect
> that's the issue (and not show-paren-mode).
Indeed. The issue is that the ps-mode-r-* commands just used `insert`
which does just what it says. If they had used self-insert-command
internally (which is the function which pays attention to overwrite
mode), then it could have worked right.
These issues were part of the motivation to add post-self-insert-hook,
so that those commands can be replaced by `self-insert-command` without
any need to rebind the keys.
Stefan
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: cannot disable paren matching
@ 2016-12-27 23:18 martin rudalics
0 siblings, 0 replies; 11+ messages in thread
From: martin rudalics @ 2016-12-27 23:18 UTC (permalink / raw)
To: don; +Cc: help-gnu-emacs
> Interestingly, even in fundamental-mode, turning
> show-paren-mode off does NOT stop emacs from briefly moving to the matching
> open when I type a close, whether or not I'm in overwrite-mode.
From what you write here the thing that seems to annoy you is
‘blink-matching-paren’. Try setting it to nil.
martin
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: cannot disable paren matching
2016-12-27 23:05 ` John Mastro
2016-12-27 23:14 ` Stefan Monnier
@ 2016-12-28 0:46 ` Don Woods
1 sibling, 0 replies; 11+ messages in thread
From: Don Woods @ 2016-12-28 0:46 UTC (permalink / raw)
To: help-gnu-emacs, john.b.mastro; +Cc: don
> > Are you sure that the culprit is the (show-paren-mode) ?
> >
> > M-x describe-mode ps-mode said
> >
> > ...
> >> ps-mode-r-gt
> > ] ps-mode-r-angle
> > } ps-mode-r-brace
>
> In Emacs 25 these are all bound to `self-insert-command', so I suspect
> that's the issue (and not show-paren-mode).
>
> John
We have a winner!! Indeed, in Emacs 22 and 24 those functions all
use (insert ">") and such, rather than self-insert-command. I changed
them to use (self-insert-command 1) and now they behave as desired!
(I suppose the 1 might be optional. Whatever. It works!)
Thanks, John! And apparently there is no lingering bug to be fixed,
since Emacs 25 already includes the correction.
-- Don.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2016-12-28 0:46 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-27 23:18 cannot disable paren matching martin rudalics
-- strict thread matches above, loose matches on Subject: below --
2016-12-27 20:29 Don Woods
2016-12-27 21:23 ` Skip Montanaro
2016-12-27 21:30 ` John Mastro
2016-12-27 21:52 ` John Mastro
2016-12-27 22:35 ` Don Woods
2016-12-27 21:36 ` Stefan Monnier
2016-12-27 22:42 ` Konstantin Shakhnov
2016-12-27 23:05 ` John Mastro
2016-12-27 23:14 ` Stefan Monnier
2016-12-28 0:46 ` Don Woods
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.