GNU bug report logs - #21091
25.0.50; `isearch-done' called before `isearch-update' raises wrong-type-arg error

Previous Next

Package: emacs;

Reported by: Drew Adams <drew.adams <at> oracle.com>

Date: Sun, 19 Jul 2015 03:59:02 UTC

Severity: minor

Tags: fixed, patch

Found in versions 25.1, 25.0.50

Fixed in version 25.2

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Drew Adams <drew.adams <at> oracle.com>
To: 21091 <at> debbugs.gnu.org
Subject: bug#21091: 25.0.50; `isearch-done' called before `isearch-update' raises wrong-type-arg error
Date: Sat, 18 Jul 2015 20:57:32 -0700 (PDT)
Dunno whether I'll be able to convince you that this is a bug, but here
goes.

Recently someone added `isearch--current-buffer' to isearch.el.

This is initially nil.  It is given a string value (buffer name) only in
`isearch-update'.  But it is called in `isearch-done' and expected to
have a string value there.  If it does not, a wrong-type-arg error is
raised.

I have code that defines some Isearch commands that each start out by
calling (isearch-done) - they can be called at top level or from
`isearch-mode-map'.  Here is the beginning of one:

(defun foo (arg)
  (interactive "P")
  (bar 'isearch-forward arg))

(defun bar (arg)
  (isearch-done)
  (setq isearch-success   t
        isearch-adjusted  t)
  (let* ((enable-recursive-minibuffers t)
         ...)
    ...
    (setq isearch-filter-predicate ...)
    ...)
  (funcall search-fn))

When called at top level, `isearch--current-buffer' is nil, and the
wrong-type arg error is raised.

I can "fix" the problem that was introduced by wrapping the
`isearch-done' call in `ignore-errors'.  But I think it would be better
for isearch.el not to assume that `isearch-done' is called after
`isearch-update'.  I don't think there is a reason why the two need to
be coupled in that way.  Adding variable `isearch--current-buffer' in
the way it was done makes the isearch.el code more fragile than it needs
to be, I think.

Anyway, please consider somehow ensuring that `isearch-done' does not
care whether `isearch--current-buffer' has a string value.

Perhaps one possibility would be something like this - dunno.

  (when isearch--current-buffer
    (with-current-buffer isearch--current-buffer
      (setq isearch--current-buffer nil)
      (setq cursor-sensor-inhibit (delq 'isearch cursor-sensor-inhibit))))

Or maybe even:

  (when (and isearch--current-buffer
             (get-buffer isearch--current-buffer))
    ...)


In GNU Emacs 25.0.50.1 (i686-pc-mingw32)
 of 2015-07-03 on LEG570
Bzr revision: 2b848fadd51e805b2f46da64c5958ea7f009048a
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --host=i686-pc-mingw32 --enable-checking=yes,glyphs'




This bug report was last modified 8 years and 251 days ago.

Previous Next


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