From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#20718: 25.0.50; find-function fails on advised subrs (again) Date: Thu, 4 Jun 2015 03:09:55 +0300 Message-ID: <556F9753.7090807@yandex.ru> References: <87wpzmnum6.fsf@web.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1433376684 3999 80.91.229.3 (4 Jun 2015 00:11:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 4 Jun 2015 00:11:24 +0000 (UTC) To: michael_heerdegen@web.de, 20718@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jun 04 02:11:14 2015 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 1Z0IkZ-0006B4-3M for geb-bug-gnu-emacs@m.gmane.org; Thu, 04 Jun 2015 02:11:11 +0200 Original-Received: from localhost ([::1]:39681 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0IkY-0000QL-3P for geb-bug-gnu-emacs@m.gmane.org; Wed, 03 Jun 2015 20:11:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57625) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0IkU-0000QB-W0 for bug-gnu-emacs@gnu.org; Wed, 03 Jun 2015 20:11:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z0IkR-0002JC-OW for bug-gnu-emacs@gnu.org; Wed, 03 Jun 2015 20:11:06 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:57850) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0IkR-0002Iz-KP for bug-gnu-emacs@gnu.org; Wed, 03 Jun 2015 20:11:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Z0IkQ-0001Lu-QF for bug-gnu-emacs@gnu.org; Wed, 03 Jun 2015 20:11:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 04 Jun 2015 00:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20718 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 20718-submit@debbugs.gnu.org id=B20718.14333766105134 (code B ref 20718); Thu, 04 Jun 2015 00:11:02 +0000 Original-Received: (at 20718) by debbugs.gnu.org; 4 Jun 2015 00:10:10 +0000 Original-Received: from localhost ([127.0.0.1]:39592 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z0IjY-0001Ki-2t for submit@debbugs.gnu.org; Wed, 03 Jun 2015 20:10:09 -0400 Original-Received: from mail-wi0-f181.google.com ([209.85.212.181]:33548) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z0IjT-0001K8-KA for 20718@debbugs.gnu.org; Wed, 03 Jun 2015 20:10:05 -0400 Original-Received: by wiwd19 with SMTP id d19so4481969wiw.0 for <20718@debbugs.gnu.org>; Wed, 03 Jun 2015 17:09:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=zEFCQP/webL+k3HbFiVdSmD56/zrpsAPD6JLpWcdpBE=; b=RH2/oIxCRGZUxPe/PIsALz8l9I4D5uTfXZLUjwC08Me6GoYNsfuhKE4PU95VD17awh Au9EIGwDIadcmsx3ZNCqA+usNiadQINIsvtaRdv+3Emy0yahLqkBX2Xa5jBUEQoUAKJr Rm8nzUC2ZfmBv9M1/SCBMdqALFtQ7g2ZtoxIXJB3S1gUZV5jVzd6BP3EU6YvSnff8Uj7 sBNyKDhU12SreMy5M4iyHKy79nHAOy2vOxji5AtCWkFdV0xJugQwzDe8VcgbmuDricI7 LZ9HgFtUOFT4ArSTQ6NcXi8/F6mR/fjQ/sRNtzhxcZSoOtTICw6QEujT+tVfCpIQgT+x 3zNQ== X-Received: by 10.194.88.38 with SMTP id bd6mr11055315wjb.153.1433376597995; Wed, 03 Jun 2015 17:09:57 -0700 (PDT) Original-Received: from [192.168.1.2] ([82.102.93.54]) by mx.google.com with ESMTPSA id m10sm3820333wib.17.2015.06.03.17.09.57 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Jun 2015 17:09:57 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0 In-Reply-To: <87wpzmnum6.fsf@web.de> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x 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:103552 Archived-At: On 06/02/2015 03:49 PM, Michael Heerdegen wrote: > It doesn't work because `find-function-library' performs the subrp test > just on the symbol function of the given function name, which is the > advice, not the original subr. At a glance, the problem is in find-function-advised-original: it only supports the old-style advice, and returns nil for 'handle-switch-frame augmented with advice-add. Something like the patch below should fix it, but then the function returns a # object, instead of function symbol, and several callers seem to depend on the return value being the latter (because they want to call symbol-function on it). diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index 7ea13d4..75fdfc7 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -192,9 +192,9 @@ defined in C.") "Return the original function symbol of an advised function FUNC. If FUNC is not the symbol of an advised function, just returns FUNC." (or (and (symbolp func) - (featurep 'advice) - (let ((ofunc (cdr (assq 'origname (ad-get-advice-info func))))) - (and (fboundp ofunc) ofunc))) + (featurep 'nadvice) + (let ((ofunc (advice--symbol-function func))) + (and (advice--p ofunc) (advice--cd*r ofunc)))) func)) (defun find-function-C-source (fun-or-var file type)