help-gnu-emacs
[Top][All Lists]
Advanced

[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 <address@hidden>,
 address@hidden (Phillip Lord) wrote:

> Barry Margolin <address@hidden> writes:
> 
> > In article <address@hidden>,
> >  Emanuel Berg <address@hidden> 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, address@hidden
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


reply via email to

[Prev in Thread] Current Thread [Next in Thread]