From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: John Mastro Newsgroups: gmane.emacs.help Subject: Re: Advice on advice needed Date: Fri, 13 Feb 2015 16:22:29 -0800 Message-ID: References: <87oaoxwh3e.fsf@wmi.amu.edu.pl> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1423873386 15529 80.91.229.3 (14 Feb 2015 00:23:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 14 Feb 2015 00:23:06 +0000 (UTC) Cc: Marcin Borkowski To: Help Gnu Emacs mailing list Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Feb 14 01:23:06 2015 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 1YMQVj-0003S8-F9 for geh-help-gnu-emacs@m.gmane.org; Sat, 14 Feb 2015 01:23:03 +0100 Original-Received: from localhost ([::1]:58301 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMQVi-0002nO-LE for geh-help-gnu-emacs@m.gmane.org; Fri, 13 Feb 2015 19:23:02 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47684) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMQVX-0002mp-Hn for help-gnu-emacs@gnu.org; Fri, 13 Feb 2015 19:22:52 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YMQVW-0004Qa-I6 for help-gnu-emacs@gnu.org; Fri, 13 Feb 2015 19:22:51 -0500 Original-Received: from mail-ob0-x22c.google.com ([2607:f8b0:4003:c01::22c]:38951) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMQVW-0004QW-Co for help-gnu-emacs@gnu.org; Fri, 13 Feb 2015 19:22:50 -0500 Original-Received: by mail-ob0-f172.google.com with SMTP id nt9so25921955obb.3 for ; Fri, 13 Feb 2015 16:22:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=D7wn9pYOAOq1fYbNve26iqp7F4Rhepy6UYOIFjAQK9M=; b=MDZIX7+lJobp4q7PhH5C/QzP6R7/ku3yDGxNlh+4JT4cs748AehljKHjaO7p1BQ7n5 vl1BgGaWwBSlfPJYKubG1a12np49z10yyD3HBT9si9Sb4Evy5WtpBY4FfrSdxCGuaHuH xjmA6Deex2ywukxC8w2VJkSoVHrubWaTkUqWiAEa1GaRkL54sbmnWPrZK45z+CDfBN9h PtNyxuzlL1BFguusnU7UBVz9A3OckwUAbTOz1vNsrImcxm/bBmtHJifV6wy7c5gHegpf SFlw1w1XOgQI1FjLws74E3+gCaDYzdD/8vYJ+yU9FfpwmU3YcarOlgbzOUH/k15ft59h Bkdw== X-Received: by 10.202.94.197 with SMTP id s188mr7796930oib.94.1423873369895; Fri, 13 Feb 2015 16:22:49 -0800 (PST) Original-Received: by 10.76.12.162 with HTTP; Fri, 13 Feb 2015 16:22:29 -0800 (PST) In-Reply-To: <87oaoxwh3e.fsf@wmi.amu.edu.pl> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c01::22c X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 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-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:102709 Archived-At: Marcin Borkowski wrote: > There is a function in Emacs which really should be wrapped in > `save-excursion' (it's `message-insert-signature'). I advised it, so > that I can repeatedly press C-c C-w to cycle between a few signatures. > However, it puts the point at the end of the buffer. > > Is there a way to wrap it in `save-excursion' using advice, or is > writing a wrapper function the only way to do it? (I guess the latter, > but maybe I'm wrong?) I'm on Emacs 25.0.50.1, so I have the "new > advice" system on board. I think something like this should work: (defun save-excursion-wrapper (function &rest args) (save-excursion (apply function args))) (advice-add 'message-insert-signature :around #'save-excursion-wrapper) -- john