[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: hijack C function, use it transparently with in-between layer
From: |
Barry Margolin |
Subject: |
Re: hijack C function, use it transparently with in-between layer |
Date: |
Mon, 06 Jun 2016 10:40:48 -0400 |
User-agent: |
MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) |
In article <mailman.967.1465212644.1216.help-gnu-emacs@gnu.org>,
phillip.lord@russet.org.uk (Phillip Lord) wrote:
> Barry Margolin <barmar@alum.mit.edu> writes:
>
> > In article <868tyjnghn.fsf@student.uu.se>,
> > Emanuel Berg <embe8573@student.uu.se> wrote:
> >
> >> The truth is down there!
> >>
> >> (defvar old-message)
> >> (fset 'old-message (symbol-function #'message))
> >>
> >> (defun message (format-string &rest args)
> >> (unless (member format-string
> >> '(
> >> "It was just another system of control."
> >> "Mark set"
> >> ))
> >> (apply `(old-message ,format-string ,@args) )))
> >>
> >> ;; test:
> >> ;;
> >> ;; (message "%s - %s" "1" "2")
> >> ;; (message "Break on thru to the other side.")
> >> ;; (message "It was just another system of control.")
> >> ;; (message "Mark set")
> >
> > Shouldn't you do this using advice?
>
>
> Advice only works partially (as I expect this will). The message
> function is also called directly in the C layer. Advice will not capture
> those cases.
The same is true for redefining it as above. Nothing you do in Emacs
Lisp will affect what happens for C-to-C calls.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
- Re: hijack C function, use it transparently with in-between layer, (continued)
- Re: hijack C function, use it transparently with in-between layer, Stefan Monnier, 2016/06/06
- Re: hijack C function, use it transparently with in-between layer, Emanuel Berg, 2016/06/06
- Re: hijack C function, use it transparently with in-between layer, John Mastro, 2016/06/06
- Re: hijack C function, use it transparently with in-between layer, Barry Margolin, 2016/06/06
- Re: hijack C function, use it transparently with in-between layer, Emanuel Berg, 2016/06/06
- Message not available
- Re: hijack C function, use it transparently with in-between layer, Emanuel Berg, 2016/06/06
- Re: hijack C function, use it transparently with in-between layer, Phillip Lord, 2016/06/07
- Re: hijack C function, use it transparently with in-between layer, Eli Zaretskii, 2016/06/07
- Re: hijack C function, use it transparently with in-between layer, Emanuel Berg, 2016/06/07
- Message not available
- Re: hijack C function, use it transparently with in-between layer, Emanuel Berg, 2016/06/07
- Message not available
- Re: hijack C function, use it transparently with in-between layer,
Barry Margolin <=