all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* perhaps rephrase "misplaced interactive spec"
@ 2014-07-31 21:06 Emanuel Berg
  2014-07-31 21:21 ` Emanuel Berg
  2014-08-21 19:55 ` lee
  0 siblings, 2 replies; 4+ messages in thread
From: Emanuel Berg @ 2014-07-31 21:06 UTC (permalink / raw
  To: help-gnu-emacs

If have a minor mode (i.e., buffer local) for caps, all
in sweet software [1]. I got it from someone else but I
modified it to auto-reset when one uppercased C
constant or acronym or whatever is typed, so you get
back to non-caps automatically.

I got the following message when otherwise successfully
and without warnings byte-compiling it:

;; caps.el ... Warning: misplaced interactive spec:
;; `(interactive (list (or current-prefix-arg (quote
;; toggle))))'

Turns out, I didn't have a docstring! As in, the second
line of:

(define-minor-mode caps-mode
  "Caps on you."
  :init-value nil
  :lighter " Caps")

After thinking my brains out over this, I see now in
the help that

(define-minor-mode MODE DOC ...

so I wonder why I just didn't get a
wrong-number-of-arguments? That would have instantly
made it clear.

Well, just a suggestion. But I think most people will
have a hard time deciphering that kind of error
message.

[1] http://user.it.uu.se/~embe8573/conf/emacs-init/caps.el

-- 
underground experts united


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

* Re: perhaps rephrase "misplaced interactive spec"
  2014-07-31 21:06 perhaps rephrase "misplaced interactive spec" Emanuel Berg
@ 2014-07-31 21:21 ` Emanuel Berg
  2014-07-31 22:45   ` Barry Margolin
  2014-08-21 19:55 ` lee
  1 sibling, 1 reply; 4+ messages in thread
From: Emanuel Berg @ 2014-07-31 21:21 UTC (permalink / raw
  To: help-gnu-emacs

Emanuel Berg <embe8573@student.uu.se> writes:

> (define-minor-mode MODE DOC ...
>
> so I wonder why I just didn't get a
> wrong-number-of-arguments? That would have instantly
> made it clear.

Aha, now I see, it is because of those others :property
arguments. So it is more complicated.

Is the reason for having those (:some thing) that some
can be provided, and others left out? Is that
implemented function-by-function (like a C binary or
shell function that has to decode what options were
passed)?

(define-minor-mode MODE DOC &optional INIT-VALUE
LIGHTER KEYMAP &rest BODY)

Although it was more complicated than I thought, that
doesn't make the warning message any more clear...
Especially since it works just fine (the minor mode)
without the docstring it gets even more confusing.

-- 
underground experts united


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

* Re: perhaps rephrase "misplaced interactive spec"
  2014-07-31 21:21 ` Emanuel Berg
@ 2014-07-31 22:45   ` Barry Margolin
  0 siblings, 0 replies; 4+ messages in thread
From: Barry Margolin @ 2014-07-31 22:45 UTC (permalink / raw
  To: help-gnu-emacs

In article <87iomdusvs.fsf@debian.uxu>,
 Emanuel Berg <embe8573@student.uu.se> wrote:

> Emanuel Berg <embe8573@student.uu.se> writes:
> 
> > (define-minor-mode MODE DOC ...
> >
> > so I wonder why I just didn't get a
> > wrong-number-of-arguments? That would have instantly
> > made it clear.
> 
> Aha, now I see, it is because of those others :property
> arguments. So it is more complicated.
> 
> Is the reason for having those (:some thing) that some
> can be provided, and others left out? Is that
> implemented function-by-function (like a C binary or
> shell function that has to decode what options were
> passed)?
> 
> (define-minor-mode MODE DOC &optional INIT-VALUE
> LIGHTER KEYMAP &rest BODY)
> 
> Although it was more complicated than I thought, that
> doesn't make the warning message any more clear...
> Especially since it works just fine (the minor mode)
> without the docstring it gets even more confusing.

This type of thing tends to happen when functions and macros evolve over 
time. Probably the original definition was just

(define-minor-mode MODE DOC &rest BODY)

Then someone decided to add options, and the most obvious place to add 
them was before the BODY.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


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

* Re: perhaps rephrase "misplaced interactive spec"
  2014-07-31 21:06 perhaps rephrase "misplaced interactive spec" Emanuel Berg
  2014-07-31 21:21 ` Emanuel Berg
@ 2014-08-21 19:55 ` lee
  1 sibling, 0 replies; 4+ messages in thread
From: lee @ 2014-08-21 19:55 UTC (permalink / raw
  To: help-gnu-emacs

Emanuel Berg <embe8573@student.uu.se> writes:

> If have a minor mode (i.e., buffer local) for caps, all
> in sweet software [1]. I got it from someone else but I
> modified it to auto-reset when one uppercased C
> constant or acronym or whatever is typed, so you get
> back to non-caps automatically.
>
> I got the following message when otherwise successfully
> and without warnings byte-compiling it:
>
> ;; caps.el ... Warning: misplaced interactive spec:
> ;; `(interactive (list (or current-prefix-arg (quote
> ;; toggle))))'
>
> Turns out, I didn't have a docstring!
> [...]
>
> (define-minor-mode MODE DOC ...
>
> so I wonder why I just didn't get a
> wrong-number-of-arguments? That would have instantly
> made it clear.
>
> Well, just a suggestion. But I think most people will
> have a hard time deciphering that kind of error
> message.

IMO, the error message could (should) say that the documentation string
is missing for all instances in which the documentation string is a
mandatory argument because it is usually not.

Did you make a bug report?

Is it optionally possible to get a warning for all instances in which a
voluntary docstring is missing?

For it appears inconsistent to have the docstring mandatory in some
cases and voluntarily in others ...


-- 
GNU Emacs 24.4.50.2 (x86_64-unknown-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2014-08-17 on yun.yagibdah.de



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

end of thread, other threads:[~2014-08-21 19:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-31 21:06 perhaps rephrase "misplaced interactive spec" Emanuel Berg
2014-07-31 21:21 ` Emanuel Berg
2014-07-31 22:45   ` Barry Margolin
2014-08-21 19:55 ` lee

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.