GNU bug report logs - #16799
24.3.50; delete-selection-mode and electric-pair-mode interaction

Previous Next

Package: emacs;

Reported by: Harald Hanche-Olsen <hanche <at> math.ntnu.no>

Date: Tue, 18 Feb 2014 20:48:02 UTC

Severity: normal

Found in version 24.3.50

Done: Juanma Barranquero <lekktu <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 16799 in the body.
You can then email your comments to 16799 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#16799; Package emacs. (Tue, 18 Feb 2014 20:48:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Harald Hanche-Olsen <hanche <at> math.ntnu.no>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 18 Feb 2014 20:48:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Harald Hanche-Olsen <hanche <at> math.ntnu.no>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50; delete-selection-mode and electric-pair-mode interaction
Date: Tue, 18 Feb 2014 21:47:14 +0100 (CET)
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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16799; Package emacs. (Wed, 19 Feb 2014 22:25:01 GMT) Full text and rfc822 format available.

Message #8 received at 16799 <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Harald Hanche-Olsen <hanche <at> math.ntnu.no>
Cc: 16799 <at> debbugs.gnu.org
Subject: Re: bug#16799: 24.3.50;
 delete-selection-mode and electric-pair-mode interaction
Date: Wed, 19 Feb 2014 23:23:40 +0100
On Tue, Feb 18, 2014 at 9:47 PM, Harald Hanche-Olsen
<hanche <at> 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))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16799; Package emacs. (Thu, 20 Feb 2014 04:50:02 GMT) Full text and rfc822 format available.

Message #11 received at 16799 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: Harald Hanche-Olsen <hanche <at> math.ntnu.no>, 16799 <at> debbugs.gnu.org
Subject: Re: bug#16799: 24.3.50;
 delete-selection-mode and electric-pair-mode interaction
Date: Wed, 19 Feb 2014 23:49:34 -0500
> -  (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




Reply sent to Juanma Barranquero <lekktu <at> gmail.com>:
You have taken responsibility. (Thu, 20 Feb 2014 10:39:02 GMT) Full text and rfc822 format available.

Notification sent to Harald Hanche-Olsen <hanche <at> math.ntnu.no>:
bug acknowledged by developer. (Thu, 20 Feb 2014 10:39:02 GMT) Full text and rfc822 format available.

Message #16 received at 16799-done <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Harald Hanche-Olsen <hanche <at> math.ntnu.no>, 16799-done <at> debbugs.gnu.org
Subject: Re: bug#16799: 24.3.50;
 delete-selection-mode and electric-pair-mode interaction
Date: Thu, 20 Feb 2014 11:38:11 +0100
On Thu, Feb 20, 2014 at 5:49 AM, Stefan Monnier
<monnier <at> 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.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 20 Mar 2014 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 108 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.