Subject: Warning (bytecomp): misplaced interactive spec

From: Philippe Vaucher <[email-masked]>
Date: Mon, 5 Oct 2015 15:34:11 +0200

Hello,

I'm using Emacs snapshot from
https://launchpad.net/~ubuntu-elisp/+archive/ubuntu/ppa on ubuntu 15.04,
which at the moment is "GNU Emacs 25.0.50.2 (x86_64-pc-linux-gnu, GTK+
Version 3.14.13) of 2015-10-05."

Whenever I start emacs I get the following warning:

Warning (bytecomp): misplaced interactive spec: ‘(interactive (let ((args
(find-tag-interactive "[PCRE] Find tag regexp: " t))) (list
(rxt-pcre-to-elisp (nth 0 args)) (nth 1 args) (nth 2 args))))’

The function it refers to looks well defined:

(defadvice find-tag-regexp
  (before pcre-mode first (regexp &optional next-p other-window) disable)
  "Read regexp using PCRE syntax and convert to Elisp equivalent."
  "Perform `find-tag-regexp' using emulated PCRE regexp syntax."
  (interactive
   (let ((args (find-tag-interactive "[PCRE] Find tag regexp: " t)))
     (list (rxt-pcre-to-elisp (nth 0 args))
           (nth 1 args) (nth 2 args)))))

The code I'm refering to is
https://github.com/joddie/pcre2el/blob/master/pcre2el.el#L967

What is funny is that there is another `defadvice' that follows almost
exactly the same pattern right before this one and the other one doesn't
trigger the warning.

This made me do some research and basically I think the problem is in
`find-tag-regexp':

(defun find-tag-regexp (regexp &optional next-p other-window)
  "(snip doc)"
  (declare (obsolete xref-find-apropos "25.1"))
  (interactive (find-tag-interactive "Find tag regexp: " t))
  ;; We go through find-tag-other-window to do all the display hair there.
  (funcall (if other-window 'find-tag-other-window 'find-tag)
  regexp next-p t))

As you can see, it starts with a `declare' form instead of the
`interactive' form, and I think it confuses the `defadvice'.

Tell me if you need more information.

Thanks in advance,
Philippe