* bug#16799: 24.3.50; delete-selection-mode and electric-pair-mode interaction
@ 2014-02-18 20:47 Harald Hanche-Olsen
2014-02-19 22:23 ` Juanma Barranquero
0 siblings, 1 reply; 4+ messages in thread
From: Harald Hanche-Olsen @ 2014-02-18 20:47 UTC (permalink / raw)
To: 16799
Starting from emacs -Q, switch to the *scratch* buffer and run:
M-x electric-pair-mode RET
M-x delete-selection-mode RET
Place the cursor in the first line, but not at the befinning,
and type C-space C-a.
Now the region is active, and point is at the beginning of the buffer.
Type any character bound to self-insert-command.
Result:
Error in pre-command-hook (delete-selection-pre-hook): (args-out-of-range 0 1)
As a side effect, delete-selection-pre-hook is removed from
pre-command-hook, effectively disabling delete-selection-mode.
In GNU Emacs 24.3.50.1 (x86_64-apple-darwin13.0.0,
NS apple-appkit-1265.00) of 2014-02-18 on airy
Windowing system distributor `Apple', version 10.3.1265
Configured using:
`configure --with-ns'
The source code was pulled from the git repo less than an hour ago.
Important settings:
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
– Harald
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#16799: 24.3.50; delete-selection-mode and electric-pair-mode interaction
2014-02-18 20:47 bug#16799: 24.3.50; delete-selection-mode and electric-pair-mode interaction Harald Hanche-Olsen
@ 2014-02-19 22:23 ` Juanma Barranquero
2014-02-20 4:49 ` Stefan Monnier
0 siblings, 1 reply; 4+ messages in thread
From: Juanma Barranquero @ 2014-02-19 22:23 UTC (permalink / raw)
To: Harald Hanche-Olsen; +Cc: 16799
On Tue, Feb 18, 2014 at 9:47 PM, Harald Hanche-Olsen
<hanche@math.ntnu.no> wrote:
> Error in pre-command-hook (delete-selection-pre-hook): (args-out-of-range 0 1)
I think something like this is needed to avoid
electric-pair-syntax-info parsing before the start of the
region/buffer.
=== modified file 'lisp/elec-pair.el'
--- lisp/elec-pair.el 2014-02-03 00:28:57 +0000
+++ lisp/elec-pair.el 2014-02-19 22:18:02 +0000
@@ -215,8 +215,10 @@
`electric-pair-pairs' or `electric-pair-text-pairs' were used to
lookup syntax. STRING-OR-COMMENT-START indicates that point is
inside a comment of string."
- (let* ((pre-string-or-comment (nth 8 (save-excursion
- (syntax-ppss (1- (point))))))
+ (let* ((pre-string-or-comment (if (> (point) (point-min))
+ (nth 8 (save-excursion
+ (syntax-ppss (1- (point)))))
+ t))
(post-string-or-comment (nth 8 (syntax-ppss (point))))
(string-or-comment (and post-string-or-comment
pre-string-or-comment))
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#16799: 24.3.50; delete-selection-mode and electric-pair-mode interaction
2014-02-19 22:23 ` Juanma Barranquero
@ 2014-02-20 4:49 ` Stefan Monnier
2014-02-20 10:38 ` Juanma Barranquero
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2014-02-20 4:49 UTC (permalink / raw)
To: Juanma Barranquero; +Cc: Harald Hanche-Olsen, 16799
> - (let* ((pre-string-or-comment (nth 8 (save-excursion
> - (syntax-ppss (1- (point))))))
> + (let* ((pre-string-or-comment (if (> (point) (point-min))
> + (nth 8 (save-excursion
> + (syntax-ppss (1- (point)))))
> + t))
Looks right, except that I'd write (not (bobp)) instead of (> (point)
(point-min)).
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#16799: 24.3.50; delete-selection-mode and electric-pair-mode interaction
2014-02-20 4:49 ` Stefan Monnier
@ 2014-02-20 10:38 ` Juanma Barranquero
0 siblings, 0 replies; 4+ messages in thread
From: Juanma Barranquero @ 2014-02-20 10:38 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Harald Hanche-Olsen, 16799-done
On Thu, Feb 20, 2014 at 5:49 AM, Stefan Monnier
<monnier@iro.umontreal.ca> wrote:
> Looks right, except that I'd write (not (bobp)) instead of (> (point)
> (point-min)).
Yes, thanks. I always forget bobp.
I've installed the patch using
(or (bobp)
(nth ...))
which is shorter and pretty clear IMO.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-02-20 10:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-18 20:47 bug#16799: 24.3.50; delete-selection-mode and electric-pair-mode interaction Harald Hanche-Olsen
2014-02-19 22:23 ` Juanma Barranquero
2014-02-20 4:49 ` Stefan Monnier
2014-02-20 10:38 ` Juanma Barranquero
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).