unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bibtex-convert-alien fails
@ 2008-02-19 22:06 Ulrich Mueller
  2008-02-19 23:59 ` Ulrich Mueller
  0 siblings, 1 reply; 3+ messages in thread
From: Ulrich Mueller @ 2008-02-19 22:06 UTC (permalink / raw)
  To: bug-gnu-emacs; +Cc: Andreas K. Huettel, emacs

Andreas K. Huettel has discovered a bug in bibtex.el in Emacs 22.1
(also in 22.1.90 and current EMACS_22_BASE CVS):

Function bibtex-convert-alien always fails with error message
"Wrong type argument: number-or-marker-p, nil".

The reason is that "sit-for" is called with 3 arguments, while it
accepts only 2. There are actually two problems:

1) bibtex-convert-alien calls sit-for in the obsolete three-argument
   form.

2) sit-for cannot be called with three arguments if the second
   argument is nil (i.e. the second argument is not optional).
   This is not backwards compatible with the behaviour of the function
   in Emacs 21.

The patch included below should fix both problems.

Ulrich


Index: lisp/textmodes/bibtex.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/textmodes/bibtex.el,v
retrieving revision 1.128.2.2
diff -u -B -u -r1.128.2.2 bibtex.el
--- lisp/textmodes/bibtex.el	7 Jan 2008 02:21:46 -0000	1.128.2.2
+++ lisp/textmodes/bibtex.el	19 Feb 2008 21:34:37 -0000
@@ -4176,14 +4176,14 @@
 entries from minibuffer."
   (interactive "*P")
   (message "Starting to validate buffer...")
-  (sit-for 1 nil t)
+  (sit-for 1 t)
   (bibtex-realign)
   (deactivate-mark)  ; So bibtex-validate works on the whole buffer.
   (if (not (let (bibtex-maintain-sorted-entries)
              (bibtex-validate)))
       (message "Correct errors and call `bibtex-convert-alien' again")
     (message "Starting to reformat entries...")
-    (sit-for 2 nil t)
+    (sit-for 2 t)
     (bibtex-reformat read-options)
     (goto-char (point-max))
     (message "Buffer is now parsable. Please save it.")))
Index: lisp/subr.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/subr.el,v
retrieving revision 1.554.2.11
diff -u -B -u -r1.554.2.11 subr.el
--- lisp/subr.el	4 Feb 2008 15:31:09 -0000	1.554.2.11
+++ lisp/subr.el	19 Feb 2008 21:55:13 -0000
@@ -1764,7 +1764,7 @@
 
 \(fn SECONDS &optional NODISP)"
   (when (or obsolete (numberp nodisp))
-    (setq seconds (+ seconds (* 1e-3 nodisp)))
+    (setq seconds (+ seconds (* 1e-3 (or nodisp 0))))
     (setq nodisp obsolete))
   (cond
    (noninteractive




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: bibtex-convert-alien fails
  2008-02-19 22:06 Ulrich Mueller
@ 2008-02-19 23:59 ` Ulrich Mueller
  0 siblings, 0 replies; 3+ messages in thread
From: Ulrich Mueller @ 2008-02-19 23:59 UTC (permalink / raw)
  To: bug-gnu-emacs

>>>>> On Tue, 19 Feb 2008, Ulrich Mueller wrote:

> [patch for subr.el]
> -    (setq seconds (+ seconds (* 1e-3 nodisp)))
> +    (setq seconds (+ seconds (* 1e-3 (or nodisp 0))))

On second thought, it might be cleaner to test for nodisp first:

-    (setq seconds (+ seconds (* 1e-3 nodisp)))
+    (if nodisp (setq seconds (+ seconds (* 1e-3 nodisp))))




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: bibtex-convert-alien fails
       [not found] <mailman.7642.1203458832.18990.bug-gnu-emacs@gnu.org>
@ 2008-02-20  4:27 ` Roland Winkler
  0 siblings, 0 replies; 3+ messages in thread
From: Roland Winkler @ 2008-02-20  4:27 UTC (permalink / raw)
  To: bug-gnu-emacs, Ulrich Mueller; +Cc: Andreas K. Huettel, emacs

Ulrich Mueller <ulm@gentoo.org> writes:
> Function bibtex-convert-alien always fails with error message
> "Wrong type argument: number-or-marker-p, nil".
>
> The reason is that "sit-for" is called with 3 arguments, while it
> accepts only 2.

Thanks, I wasn't aware that in emacs 22 sit-for should use only up
to two arguments. I think that anyway the first arg of sit-for is
all that is needed by bibtex-convert-alien.
(Others might want to look at sit-for itself.)

Roland




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-02-20  4:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.7642.1203458832.18990.bug-gnu-emacs@gnu.org>
2008-02-20  4:27 ` bibtex-convert-alien fails Roland Winkler
2008-02-19 22:06 Ulrich Mueller
2008-02-19 23:59 ` Ulrich Mueller

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).