From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.bugs Subject: bug#11747: 24.1.50; called-interactively-p vs. advice Date: Tue, 19 Jun 2012 20:21:06 +0200 Message-ID: <87lijj9n8t.fsf@web.de> Reply-To: michael_heerdegen@web.de NNTP-Posting-Host: plane.gmane.org X-Trace: dough.gmane.org 1340129989 14515 80.91.229.3 (19 Jun 2012 18:19:49 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 19 Jun 2012 18:19:49 +0000 (UTC) To: 11747@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jun 19 20:19:48 2012 Return-path: Envelope-to: geb-bug-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 1Sh31o-0001kW-2C for geb-bug-gnu-emacs@m.gmane.org; Tue, 19 Jun 2012 20:19:48 +0200 Original-Received: from localhost ([::1]:46794 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sh31o-0000Wo-1J for geb-bug-gnu-emacs@m.gmane.org; Tue, 19 Jun 2012 14:19:48 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:41823) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sh31h-0000W2-Mr for bug-gnu-emacs@gnu.org; Tue, 19 Jun 2012 14:19:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sh31f-0004WN-Vq for bug-gnu-emacs@gnu.org; Tue, 19 Jun 2012 14:19:41 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:39348) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sh31f-0004WG-SR for bug-gnu-emacs@gnu.org; Tue, 19 Jun 2012 14:19:39 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1Sh34w-0005kS-4C for bug-gnu-emacs@gnu.org; Tue, 19 Jun 2012 14:23:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Heerdegen Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 19 Jun 2012 18:23:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 11747 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.134013015522062 (code B ref -1); Tue, 19 Jun 2012 18:23:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 19 Jun 2012 18:22:35 +0000 Original-Received: from localhost ([127.0.0.1]:48894 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Sh34V-0005jn-1Q for submit@debbugs.gnu.org; Tue, 19 Jun 2012 14:22:35 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:55816) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Sh34T-0005jg-0V for submit@debbugs.gnu.org; Tue, 19 Jun 2012 14:22:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sh316-0004Ba-BF for submit@debbugs.gnu.org; Tue, 19 Jun 2012 14:19:10 -0400 Original-Received: from lists.gnu.org ([208.118.235.17]:56361) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sh316-0004BV-86 for submit@debbugs.gnu.org; Tue, 19 Jun 2012 14:19:04 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:41669) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sh314-0000SJ-G6 for bug-gnu-emacs@gnu.org; Tue, 19 Jun 2012 14:19:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sh312-0004Az-A0 for bug-gnu-emacs@gnu.org; Tue, 19 Jun 2012 14:19:01 -0400 Original-Received: from mout.web.de ([212.227.17.12]:59163) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sh312-0004As-09 for bug-gnu-emacs@gnu.org; Tue, 19 Jun 2012 14:19:00 -0400 Original-Received: from snow.dragon ([82.113.99.105]) by smtp.web.de (mrweb102) with ESMTPSA (Nemesis) id 0Lpezi-1SDmT91Z4Q-00fYEa for ; Tue, 19 Jun 2012 20:18:58 +0200 X-Provags-ID: V02:K0:uT8s2Po6ULppcku91mAE4KEVlFefLtQgs4MuaCXe5EU xxnoPwASYZ6yUHFkmE4dLIrknfrfCjQnWGuL4eG3+9NyKFg4yx ncOg9/IpZ09C+pXVNSdJieUWrKJCR4/GlLSrZbWgaNbzy7FVHH c3y67qnyXcg/Ah+M1ncqsRG1Cj5GcsR3TeseP4nGnYuinDqD38 Mp6INY+CAz8aE+ybNQoavqBrB1mtMaxjS2fddPWH8A= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:61127 Archived-At: Hi, `called-interactively-p' returns wrong values when called inside commands that are adviced. Example: (defun interactive-test () (interactive) (message "Called %sinteractively" (if (called-interactively-p 'any) "" "non-"))) M-x interactive-test ==> Called interactively M-: (interactive-test) ==> Called non-interactively Now eval e.g. this: (defadvice interactive-test (before foo activate) (sleep-for 1)) Then: M-x interactive-test ==> Called non-interactively This is quite surprising, and may cause surprising effects if the user decides to advice such a command. I found nothing in the doc about his behavior. If this is not a bug, maybe explain this behavior somewhere. This last paragraph in the docstring of `called-interactively-p' seems somewhat (but not directly) related: | This function is meant for implementing advice and other | function-modifying features. Instead of using this, it is sometimes | cleaner to give your function an extra optional argument whose | `interactive' spec specifies non-nil unconditionally ("p" is a good | way to do this), or via (not (or executing-kbd-macro noninteractive)). It seems a bit confusing - is there a "not" missing in the first sentence? Thanks, Michael. In GNU Emacs 24.1.50.1 (i486-pc-linux-gnu, GTK+ Version 3.4.2) of 2012-06-15 on zelenka, modified by Debian (emacs-snapshot package, version 2:20120615-1) Windowing system distributor `The X.Org Foundation', version 11.0.11201902 Configured using: `configure '--build' 'i486-linux-gnu' '--host' 'i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/24.1.50/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.1.50/site-lisp:/usr/share/emacs/site-lisp' '--without-compress-info' '--with-crt-dir=/usr/lib/i386-linux-gnu/' '--with-x=yes' '--with-x-toolkit=gtk3' '--with-imagemagick=yes' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2' 'LDFLAGS=-g -Wl,--as-needed -znocombreloc' 'CPPFLAGS=-D_FORTIFY_SOURCE=2'' Important settings: value of $LC_ALL: de_DE.utf8 value of $LC_TIME: C value of $LANG: de_DE.utf8 locale-coding-system: utf-8-unix default enable-multibyte-characters: t