From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: phillip.lord@russet.org.uk (Phillip Lord) Newsgroups: gmane.emacs.help Subject: Re: hijack C function, use it transparently with in-between layer Date: Mon, 06 Jun 2016 12:30:34 +0100 Message-ID: <87bn3eftb9.fsf@russet.org.uk> References: <868tyjnghn.fsf@student.uu.se> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1465212678 2955 80.91.229.3 (6 Jun 2016 11:31:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 6 Jun 2016 11:31:18 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Barry Margolin Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jun 06 13:31:09 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1b9skN-00025i-Q5 for geh-help-gnu-emacs@m.gmane.org; Mon, 06 Jun 2016 13:31:08 +0200 Original-Received: from localhost ([::1]:41424 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9skM-00047r-RO for geh-help-gnu-emacs@m.gmane.org; Mon, 06 Jun 2016 07:31:06 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37714) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9sjx-00047W-Hx for help-gnu-emacs@gnu.org; Mon, 06 Jun 2016 07:30:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b9sjt-0004Gn-Bf for help-gnu-emacs@gnu.org; Mon, 06 Jun 2016 07:30:40 -0400 Original-Received: from cloud103.planethippo.com ([31.216.48.48]:44735) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9sjs-0004GY-Uv for help-gnu-emacs@gnu.org; Mon, 06 Jun 2016 07:30:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=russet.org.uk; s=default; h=Content-Type:MIME-Version:Message-ID: In-Reply-To:Date:References:Subject:Cc:To:From; bh=IP1+96o+8EVoqvMYHgNiaAbefZuR/HEniMwqoblWbJM=; b=JhyP9nvSjoipsN87w+EgwKcT0w kjwSkUt8NxPxYfcsMR3/jI0aLh5ibsMCBM2lqAlCNnMwIPZXtQ9Uv44wfRDgFrO3M/2Fn49eIQtBs BoGPg6I31PgiKJJJEuxsH0JvFYa4iKNgw/QNLejbdgaMapAlHqEkaBbL61E2ifkch9IU/FUPPKqjI UtCzyvPjicklvkXjZbfGqa00LP3fUeanDVUgocxxn1akvdqTYDr6QhEeaDmw/MXTbY/6IIejMcJhw oHBXPQbVhskXLgc31NDmAZCcQznmsiIrkRLUYA8vazWqMjdsCCst6Ap76Xm9fvKgGiz2sYPGh8IUK nrBjR7FA==; Original-Received: from janus-nat-128-240-225-60.ncl.ac.uk ([128.240.225.60]:33582 helo=russet.org.uk) by cloud103.planethippo.com with esmtpsa (TLSv1.2:DHE-RSA-AES128-SHA:128) (Exim 4.86_1) (envelope-from ) id 1b9sjq-002Y6S-QR; Mon, 06 Jun 2016 12:30:34 +0100 In-Reply-To: (Barry Margolin's message of "Mon, 06 Jun 2016 03:32:42 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.94 (gnu/linux) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cloud103.planethippo.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - russet.org.uk X-Get-Message-Sender-Via: cloud103.planethippo.com: authenticated_id: phillip.lord@russet.org.uk X-Authenticated-Sender: cloud103.planethippo.com: phillip.lord@russet.org.uk X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 31.216.48.48 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:110331 Archived-At: Barry Margolin writes: > In article <868tyjnghn.fsf@student.uu.se>, > Emanuel Berg 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. Phil