all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
To: Andreas Schwab <schwab@linux-m68k.org>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: change in call-next-method
Date: Sun, 03 Jan 2016 07:43:08 -0600	[thread overview]
Message-ID: <86d1tibwyb.fsf@stephe-leake.org> (raw)
In-Reply-To: <874meudg0c.fsf@igel.home> (Andreas Schwab's message of "Sun, 03 Jan 2016 13:06:11 +0100")

Andreas Schwab <schwab@linux-m68k.org> writes:

> Stephen Leake <stephen_leake@stephe-leake.org> writes:
>
>> I'm updating JDEE to Emacs 25. It has several functions like this:
>>
>> (cl-defmethod initialize-instance ((this jdee-jddocset) &rest rest)
>>   (apply 'call-next-method rest)
>>   (unless (oref this description)
>>     (oset this :description
>> 	  (if (oref this jdkp)
>> 	      (format "JDK %s Javadoc" (oref this version))
>> 	    (let ((file (jdee-url-file (oref this url))))
>> 	      (if (string-match ".*\\/\\(.*?\\)\\/doc\\/api" file)
>> 		  (match-string 1 file)
>> 		(jdee-url-name (oref this url))))))))
>>
>> This breaks if I just change call-next-method to cl-call-next-method.
>
> How do you change it?  

I tried:

(apply 'cl-call-next-method rest)
(cl-call-next-method rest)

They both give the error:

cl-call-next-method: cl-call-next-method only allowed inside primary and around methods

> I think you are supposed to call it as
> (cl-call-next-method).

That gives the same error.

Note that I don't actually need to call the superclass init; I just need
to process the args in `rest', storing them in the slots.

I can write code that does it:

  (let ((description (plist-get rest :description))
        (url (plist-get rest :url))
        (jdkp (plist-get rest :jdkp))
        (version (plist-get rest :version)))
    (when description
      (oset this :description description))
    (when url
      (oset this :url url))
    (when jdkp
      (oset this :jdkp jdkp))
    (when version
      (oset this :version version)))

but that's tedious and error-prone.

-- 
-- Stephe



  reply	other threads:[~2016-01-03 13:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-03 11:37 change in call-next-method Stephen Leake
2016-01-03 12:06 ` Andreas Schwab
2016-01-03 13:43   ` Stephen Leake [this message]
2016-01-03 14:48     ` Eric Abrahamsen
2016-01-03 18:05       ` Stephen Leake
2016-01-03 21:48     ` Stephen Leake
  -- strict thread matches above, loose matches on Subject: below --
2016-01-03 11:38 Stephen Leake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86d1tibwyb.fsf@stephe-leake.org \
    --to=stephen_leake@stephe-leake.org \
    --cc=emacs-devel@gnu.org \
    --cc=schwab@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.