bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#21091: 25.0.50; `isearch-done' called before `isearch-update' raises


From: Drew Adams
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'





reply via email to

[Prev in Thread] Current Thread [Next in Thread]