GNU bug report logs - #20532
25.0.50; void-variable cursor-sensor-inhibit

Previous Next

Package: emacs;

Reported by: Kaushal <kaushal.modi <at> gmail.com>

Date: Fri, 8 May 2015 16:48:02 UTC

Severity: normal

Merged with 20516

Found in version 25.0.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

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 20532 in the body.
You can then email your comments to 20532 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#20532; Package emacs. (Fri, 08 May 2015 16:48:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Kaushal <kaushal.modi <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 08 May 2015 16:48:02 GMT) Full text and rfc822 format available.

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

From: Kaushal <kaushal.modi <at> gmail.com>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: 25.0.50; void-variable cursor-sensor-inhibit
Date: Fri, 08 May 2015 16:46:50 +0000
[Message part 1 (text/plain, inline)]
Hi,

Lately, I have been facing this issue in the emacs built from master
branch. I haven't yet seen this error occur on emacs 24.4.

I see it happen now and then and haven't been able to consistently
reproduce it but here is the backtrace. I have not been able to create this
error on "emacs -Q".

I get this error when I am trying to quit isearch. I don't know if this
happens when I try to quit after I tried to search for a term that failed
to be found in the buffer or when I try to quit after a successful search
hit.

But once this started happening, repeated C-g hits keep on throwing this
error and I can't quit isearch.

Then the only way is to restart emacs.

Debugger entered--Lisp error: (void-variable cursor-sensor-inhibit)
  isearch-done(t)
  isearch-cancel()
  isearch-abort()
  funcall-interactively(isearch-abort)
  #<subr call-interactively>(isearch-abort nil nil)
  ad-Advice-call-interactively(#<subr call-interactively> isearch-abort nil
nil)
  apply(ad-Advice-call-interactively #<subr call-interactively>
(isearch-abort nil nil))
  call-interactively(isearch-abort nil nil)
  command-execute(isearch-abort)


In GNU Emacs 25.0.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 2.10.4)
 of 2015-05-05 on ...
Windowing system distributor `The X.Org Foundation', version 11.0.60900000
System Description: Red Hat Enterprise Linux Client release 5.10 (Tikanga)

Configured using:
 `configure --prefix=/home/kmodi/usr_local/apps/emacs/master
 CPPFLAGS=-fgnu89-inline'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE LIBOTF XFT ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Minor modes in effect:
  global-auto-complete-mode: t
  minibuffer-line-mode: t
  guide-key-mode: t
  desktop-save-mode: t
  pdf-occur-global-minor-mode: t
  global-anzu-mode: t
  anzu-mode: t
  recentf-mode: t
  winner-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  projectile-global-mode: t
  projectile-mode: t
  global-page-break-lines-mode: t
  keyfreq-autosave-mode: t
  keyfreq-mode: t
  diff-auto-refine-mode: t
  ido-ubiquitous-mode: t
  ido-vertical-mode: t
  flx-ido-mode: t
  global-hungry-delete-mode: t
  hungry-delete-mode: t
  volatile-highlights-mode: t
  global-hi-lock-mode: t
  hi-lock-mode: t
  global-hardcore-mode: t
  hardcore-mode: t
  drag-stuff-global-mode: t
  drag-stuff-mode: t
  ido-everywhere: t
  ace-window-display-mode: t
  global-adaptive-wrap-prefix-mode: t
  adaptive-wrap-prefix-mode: t
  display-time-mode: t
  popwin-mode: t
  which-function-mode: t
  shell-dirtrack-mode: t
  global-modi-mode: t
  modi-mode: t
  override-global-mode: t
  save-place-mode: t
  show-paren-mode: t
  delete-selection-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
[Message part 2 (text/html, inline)]

Merged 20516 20532. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 08 May 2015 16:56:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20532; Package emacs. (Fri, 08 May 2015 18:03:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Kaushal <kaushal.modi <at> gmail.com>
Cc: 20532 <at> debbugs.gnu.org
Subject: Re: bug#20532: 25.0.50; void-variable cursor-sensor-inhibit
Date: Fri, 08 May 2015 14:02:04 -0400
> I get this error when I am trying to quit isearch. I don't know if this
> happens when I try to quit after I tried to search for a term that failed
> to be found in the buffer or when I try to quit after a successful search
> hit.

Hmmm... I can see 2 ways it could happen:
1- isearch-done is called without having called isearch-mode earlier.
2- isearch-done is called in a different buffer than the one in which
   isearch-mode was called.

I expect you're in case n°2.
Can you think of any reason why you might have started your search in
one buffer and ended it in another?  If not, maybe next time you bump
into it, try to figure what you've done in that search that might have
caused the buffer to be different at the end.

> ad-Advice-call-interactively(#<subr call-interactively> isearch-abort nil nil)

Obligatory side-question: what kind of advice do you have on
call-interactively (in case it might interact in odd ways and ends up
changing the current buffer, for example)?


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20532; Package emacs. (Fri, 08 May 2015 18:11:02 GMT) Full text and rfc822 format available.

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

From: Kaushal <kaushal.modi <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 20532 <at> debbugs.gnu.org
Subject: Re: bug#20532: 25.0.50; void-variable cursor-sensor-inhibit
Date: Fri, 08 May 2015 18:10:35 +0000
[Message part 1 (text/plain, inline)]
> Can you think of any reason why you might have started your search in
> one buffer and ended it in another?

I hit C-' by mistake inbetween an isearch while in an org file and that
called `org-cycle-agenda-files` and switched to a different org file while
the search was active.

I tried doing
- C-s
- search something that fails search / search something that has search hits
- C-' (switch to a different org file)
- C-g

But that issue did not occur this time; isearch quit gracefully.

> what kind of advice do you have on
> call-interactively (in case it might interact in odd ways and ends up
> changing the current buffer, for example)?

Doing ag showed me that the ido-ubiquitous.el is advising that:

(defadvice call-interactively (around ido-ubiquitous activate)
  "Implements the behavior specified in `ido-ubiquitous-command-overrides'."
  (let* ((cmd (ad-get-arg 0))
         (override (ido-ubiquitous-get-command-override cmd)))
    (when override
      (ido-ubiquitous--debug-message "Using override `%s' for command `%s'"
                                     override cmd))
    (ido-ubiquitous-with-override override
        ad-do-it)))

I don't understand what it's doing in this advice though.


On Fri, May 8, 2015 at 2:02 PM Stefan Monnier <monnier <at> iro.umontreal.ca>
wrote:

> > I get this error when I am trying to quit isearch. I don't know if this
> > happens when I try to quit after I tried to search for a term that failed
> > to be found in the buffer or when I try to quit after a successful search
> > hit.
>
> Hmmm... I can see 2 ways it could happen:
> 1- isearch-done is called without having called isearch-mode earlier.
> 2- isearch-done is called in a different buffer than the one in which
>    isearch-mode was called.
>
> I expect you're in case n°2.
> Can you think of any reason why you might have started your search in
> one buffer and ended it in another?  If not, maybe next time you bump
> into it, try to figure what you've done in that search that might have
> caused the buffer to be different at the end.
>
> > ad-Advice-call-interactively(#<subr call-interactively> isearch-abort
> nil nil)
>
> Obligatory side-question: what kind of advice do you have on
> call-interactively (in case it might interact in odd ways and ends up
> changing the current buffer, for example)?
>
>
>         Stefan
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20532; Package emacs. (Fri, 08 May 2015 22:38:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Kaushal <kaushal.modi <at> gmail.com>
Cc: 20532 <at> debbugs.gnu.org
Subject: Re: bug#20532: 25.0.50; void-variable cursor-sensor-inhibit
Date: Fri, 08 May 2015 18:37:10 -0400
>> Can you think of any reason why you might have started your search in
>> one buffer and ended it in another?
> I hit C-' by mistake inbetween an isearch while in an org file and that
> called `org-cycle-agenda-files` and switched to a different org file while
> the search was active.

> I tried doing
> - C-s
> - search something that fails search / search something that has search hits
> - C-' (switch to a different org file)
> - C-g

> But that issue did not occur this time; isearch quit gracefully.

Hmm... thanks, I think that will give me enough info for now.

> (defadvice call-interactively (around ido-ubiquitous activate)
>   "Implements the behavior specified in `ido-ubiquitous-command-overrides'."
>   (let* ((cmd (ad-get-arg 0))
>          (override (ido-ubiquitous-get-command-override cmd)))
>     (when override
>       (ido-ubiquitous--debug-message "Using override `%s' for command `%s'"
>                                      override cmd))
>     (ido-ubiquitous-with-override override
>         ad-do-it)))
>
> I don't understand what it's doing in this advice though.

It's kinda nasty, but I think it's not responsible for what you're
seeing,


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20532; Package emacs. (Mon, 25 May 2015 21:01:03 GMT) Full text and rfc822 format available.

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

From: Johan Bockgård <bojohan <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 20532 <at> debbugs.gnu.org
Subject: Re: bug#20532: 25.0.50; void-variable cursor-sensor-inhibit
Date: Mon, 25 May 2015 23:00:20 +0200
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> Can you think of any reason why you might have started your search in
> one buffer and ended it in another?

This will happen by design if you use isearch to search across multiple
files (i.e. multi-isearch), such as a sequence of ChangeLog.N files.

(There may be other variables than cursor-sensor-inhibit that are also
mishandled in this situation.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20532; Package emacs. (Mon, 25 May 2015 22:56:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: 20532 <at> debbugs.gnu.org
Subject: Re: bug#20532: 25.0.50; void-variable cursor-sensor-inhibit
Date: Mon, 25 May 2015 18:54:53 -0400
>> Can you think of any reason why you might have started your search in
>> one buffer and ended it in another?
> This will happen by design if you use isearch to search across multiple
> files (i.e. multi-isearch), such as a sequence of ChangeLog.N files.

Duh!  Indeed.


        Stefan




Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Wed, 27 May 2015 16:19:02 GMT) Full text and rfc822 format available.

Notification sent to Kaushal <kaushal.modi <at> gmail.com>:
bug acknowledged by developer. (Wed, 27 May 2015 16:19:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: 20532-done <at> debbugs.gnu.org
Subject: Re: bug#20532: 25.0.50; void-variable cursor-sensor-inhibit
Date: Wed, 27 May 2015 12:18:20 -0400
>> Can you think of any reason why you might have started your search in
>> one buffer and ended it in another?

> This will happen by design if you use isearch to search across multiple
> files (i.e. multi-isearch), such as a sequence of ChangeLog.N files.
> (There may be other variables than cursor-sensor-inhibit that are also
> mishandled in this situation.)

I installed the patch below which should fix this.


        Stefan


diff --git a/lisp/isearch.el b/lisp/isearch.el
index dc10502..5599ea5 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -932,12 +932,6 @@ convert the search string to a regexp used by regexp search functions."
   (add-hook 'post-command-hook 'isearch-post-command-hook)
   (add-hook 'mouse-leave-buffer-hook 'isearch-done)
   (add-hook 'kbd-macro-termination-hook 'isearch-done)
-  (make-local-variable 'cursor-sensor-inhibit)
-  (unless (boundp 'cursor-sensor-inhibit)
-    (setq cursor-sensor-inhibit nil))
-  ;; Suspend things like cursor-intangible during Isearch so we can search even
-  ;; within intangible text.
-  (push 'isearch cursor-sensor-inhibit)
 
   ;; isearch-mode can be made modal (in the sense of not returning to
   ;; the calling function until searching is completed) by entering
@@ -949,10 +943,23 @@ convert the search string to a regexp used by regexp search functions."
 
 
 ;; Some high level utilities.  Others below.
+(defvar isearch--current-buffer)
 
 (defun isearch-update ()
   "This is called after every isearch command to update the display.
 The last thing it does is to run `isearch-update-post-hook'."
+  (unless (eq (current-buffer) isearch--current-buffer)
+    (when isearch--current-buffer
+      (with-current-buffer isearch--current-buffer
+        (setq cursor-sensor-inhibit (delq 'isearch cursor-sensor-inhibit))))
+    (setq isearch--current-buffer (current-buffer))
+    (make-local-variable 'cursor-sensor-inhibit)
+    (unless (boundp 'cursor-sensor-inhibit)
+      (setq cursor-sensor-inhibit nil))
+    ;; Suspend things like cursor-intangible during Isearch so we can search
+    ;; even within intangible text.
+    (push 'isearch cursor-sensor-inhibit))
+
   (if (and (null unread-command-events)
 	   (null executing-kbd-macro))
       (progn
@@ -1026,7 +1033,9 @@ NOPUSH is t and EDIT is t."
   (remove-hook 'mouse-leave-buffer-hook 'isearch-done)
   (remove-hook 'kbd-macro-termination-hook 'isearch-done)
   (setq isearch-lazy-highlight-start nil)
-  (setq cursor-sensor-inhibit (delq 'isearch cursor-sensor-inhibit))
+  (with-current-buffer isearch--current-buffer
+    (setq isearch--current-buffer nil)
+    (setq cursor-sensor-inhibit (delq 'isearch cursor-sensor-inhibit)))
 
   ;; Called by all commands that terminate isearch-mode.
   ;; If NOPUSH is non-nil, we don't push the string on the search ring.




Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Wed, 27 May 2015 16:19:03 GMT) Full text and rfc822 format available.

Notification sent to Vitalie Spinu <spinuvit <at> gmail.com>:
bug acknowledged by developer. (Wed, 27 May 2015 16:19:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20532; Package emacs. (Wed, 27 May 2015 20:53:01 GMT) Full text and rfc822 format available.

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

From: Christoph Ruegge <chrueg <at> gmail.com>
To: 20532 <at> debbugs.gnu.org
Subject: 25.0.50; void-variable cursor-sensor-inhibit
Date: Wed, 27 May 2015 22:52:20 +0200
This patch causes void-variable errors for me. Shouldn't
isearch--current-buffer have an init value?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20532; Package emacs. (Thu, 28 May 2015 01:50:04 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Christoph Ruegge <chrueg <at> gmail.com>
Cc: 20532 <at> debbugs.gnu.org
Subject: Re: bug#20532: 25.0.50; void-variable cursor-sensor-inhibit
Date: Wed, 27 May 2015 21:49:10 -0400
> This patch causes void-variable errors for me. Shouldn't
> isearch--current-buffer have an init value?

Duh, yes, indeed!


        Stefan




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

This bug report was last modified 10 years ago.

Previous Next


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