all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Le Wang <l26wang@gmail.com>
Cc: 12610@debbugs.gnu.org
Subject: bug#12610: unable to use macro in defadvice
Date: Sun, 13 Sep 2020 18:43:10 +0200	[thread overview]
Message-ID: <87imchiq5d.fsf@gnus.org> (raw)
In-Reply-To: <CAM=K+iq-7ijbLg+-mtnKShVhQQFuPORDc5nbUEsqZidgtNNp=A@mail.gmail.com> (Le Wang's message of "Tue, 9 Oct 2012 21:02:58 +0800")

Le Wang <l26wang@gmail.com> writes:

> I have this simplified macro.
>
> (defadvice kill-buffer (around show-diff-rephrase-question activate compile)
>   "Prompt when a buffer is about to be killed."
>   (case (read-char-choice
>          "(s/k/q)? "
>          (append "sSKkQq" nil))
>     ((?s ?S)
>      ad-do-it)
>     ((?k ?K)
>      ad-do-it)
>     ((?q ?Q) nil))
>   ad-do-it)
>
> If I compile the file and load it, then I get "Invalid function: (115 83)"
>
> It works if I evaluate it.

I've modernised the code slightly:

(require 'cl-lib)
	 
(defadvice kill-buffer (around show-diff-rephrase-question activate compile)
  "Prompt when a buffer is about to be killed."
  (cl-case (read-char-choice
            "(s/k/q)? "
            (append "sSKkQq" nil))
    ((?s ?S)
     ad-do-it)
    ((?k ?K)
     ad-do-it)
    ((?q ?Q) nil))
  ad-do-it)

I tried byte-compiling it and loading the .elc file, and it still
doesn't bug out.

So I'm guessing this has been fixed over the years?  I'm closing this
bug report; if you're still seeing this in recent Emacs versions, please
respond to the debbugs address and we'll reopen.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





      parent reply	other threads:[~2020-09-13 16:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-09 13:02 bug#12610: unable to use macro in defadvice Le Wang
2012-10-12  2:05 ` Glenn Morris
2012-10-12  3:46   ` Glenn Morris
2012-10-12 13:35   ` Stefan Monnier
2012-10-12 17:54     ` Glenn Morris
2012-10-12 18:15       ` Stefan Monnier
2020-09-13 16:43 ` Lars Ingebrigtsen [this message]

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=87imchiq5d.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=12610@debbugs.gnu.org \
    --cc=l26wang@gmail.com \
    /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.