From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark Lillibridge Newsgroups: gmane.emacs.bugs Subject: bug#13305: 24.2; describe-function gives incorrect function location information (for functions changed in a hook?) Date: Sat, 29 Dec 2012 12:16:09 -0800 Message-ID: <87ehi8ty0m.fsf@foil.strangled.net> Reply-To: mdl@alum.mit.edu NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1356812235 29919 80.91.229.3 (29 Dec 2012 20:17:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 29 Dec 2012 20:17:15 +0000 (UTC) To: 13305@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Dec 29 21:17:29 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 1Tp2qX-0002hL-4k for geb-bug-gnu-emacs@m.gmane.org; Sat, 29 Dec 2012 21:17:29 +0100 Original-Received: from localhost ([::1]:38354 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tp2qI-0005QL-FI for geb-bug-gnu-emacs@m.gmane.org; Sat, 29 Dec 2012 15:17:14 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:58913) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tp2qC-0005PC-FK for bug-gnu-emacs@gnu.org; Sat, 29 Dec 2012 15:17:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tp2q7-0006Nv-8Y for bug-gnu-emacs@gnu.org; Sat, 29 Dec 2012 15:17:08 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54372) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tp2q7-0006Nr-57 for bug-gnu-emacs@gnu.org; Sat, 29 Dec 2012 15:17:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1Tp2r4-0000IX-ED for bug-gnu-emacs@gnu.org; Sat, 29 Dec 2012 15:18:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Mark Lillibridge Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 29 Dec 2012 20:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 13305 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.13568122581111 (code B ref -1); Sat, 29 Dec 2012 20:18:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 29 Dec 2012 20:17:38 +0000 Original-Received: from localhost ([127.0.0.1]:36390 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tp2qe-0000Hr-S7 for submit@debbugs.gnu.org; Sat, 29 Dec 2012 15:17:37 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:47467) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tp2qY-0000Hd-9O for submit@debbugs.gnu.org; Sat, 29 Dec 2012 15:17:32 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tp2pV-0006KQ-JP for submit@debbugs.gnu.org; Sat, 29 Dec 2012 15:16:29 -0500 Original-Received: from lists.gnu.org ([208.118.235.17]:46607) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tp2pV-0006KM-G2 for submit@debbugs.gnu.org; Sat, 29 Dec 2012 15:16:25 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:58821) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tp2pR-0004hW-Fs for bug-gnu-emacs@gnu.org; Sat, 29 Dec 2012 15:16:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tp2pM-0006J4-Tu for bug-gnu-emacs@gnu.org; Sat, 29 Dec 2012 15:16:21 -0500 Original-Received: from alum-mailsec-scanner-7.mit.edu ([18.7.68.19]:53265) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tp2pM-0006Iw-NF for bug-gnu-emacs@gnu.org; Sat, 29 Dec 2012 15:16:16 -0500 X-AuditID: 12074413-b7f786d0000008bb-34-50df4f8f4dfd Original-Received: from outgoing-alum.mit.edu (OUTGOING-ALUM.MIT.EDU [18.7.68.33]) by alum-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP id 81.81.02235.F8F4FD05; Sat, 29 Dec 2012 15:16:15 -0500 (EST) Original-Received: from foil.strangled.net (c-67-188-235-212.hsd1.ca.comcast.net [67.188.235.212]) (authenticated bits=0) (User authenticated as mdl@ALUM.MIT.EDU) by outgoing-alum.mit.edu (8.13.8/8.12.4) with ESMTP id qBTKGDIs028614 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Sat, 29 Dec 2012 15:16:14 -0500 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrKIsWRmVeSWpSXmKPExsUixO6iqNvvfz/AYMkxBYvvB6ospn48w+bA 5PH3/Qcmj7ZpZgFMUdw2SYklZcGZ6Xn6dgncGVd2PmYpWKJV8WxjD2MD40mFLkZODgkBE4k3 f/YyQdhiEhfurWfrYuTiEBK4zCgx9cFVFgjnKpPE3rX/GUGq2AQ0JaY/+84OYosISEp8vdPK 2sXIwSEsUCjx72otSFhIQEpi6aITYCUsAqoSWxpfsYOU8AroS3TNiwIJ8woISpyc+YQFxGYW kJA4+OIF8wRGnllIUrOQpBYwMq1ilEvMKc3VzU3MzClOTdYtTk7My0st0jXXy80s0UtNKd3E CAkW4R2Mu07KHWIU4GBU4uE9fftugBBrYllxZe4hRkkOJiVR3o8u9wOE+JLyUyozEosz4otK c1KLDzFKcDArifB+0AfK8aYkVlalFuXDpKQ5WJTEedWWqPsJCaQnlqRmp6YWpBbBZGU4OJQk eIP9gBoFi1LTUyvSMnNKENJMHJwgw7mkRIpT81JSixJLSzLiQfESXwyMGJAUD9BeS5B23uKC xFygKETrKUZdjl8rbz5lFGLJy89LlRLnTQEpEgApyijNg1sBSw2vGMWBPhbm9QKp4gGmFbhJ r4CWMAEtsea5A7KkJBEhJdXA6Lnx0zTn6y3a0Tk7Ij70RIgU18x7ukM7OI/t9079MCVnFbN0 D/MXVT0/38XO3WE2Q3ct94cJu+b+m+G7tX1/Q3m+T/PuF9MU5wfFBc6ofDzl87u3/VJ7l1+I XPZqu8rB8ryput31Man99Ua7WZdlMwhKrpCL4rm4S+in4XT953dnsXX6539lU2Ip X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x 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.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:69171 Archived-At: While working on a patch, I ran into a really weird and misleading case where describe-function lied about where a function was located, making me think my redefinition of the function had been ignored. Here's a recipe to reproduce the problem: Start with emacs -q, do M-: (require 'rmailsum), then use C-h f on rmail-summary-output; you should (correctly) see: rmail-summary-output is an interactive compiled Lisp function in `rmailsum.el'. (rmail-summary-output &optional FILE-NAME N) Append this message to mail file FILE-NAME. This works with both mbox format and Babyl format files, outputting in the appropriate format for each. The default file name comes from `rmail-default-file', which is updated to the name you use in this command. A prefix argument N says to output that many consecutive messages from those in the summary, starting with the current one. Deleted messages are skipped and don't count. When called from Lisp code, N may be omitted and defaults to 1. This command always outputs the complete message header, even the header display is currently pruned. Note that the location of the function is correctly given as in rmailsum.el. Now start again with emacs -q then evaluate the following elisp code: ==================== cut here for elisp ==================== (add-hook 'rmail-mode-hook (function (lambda() (require 'rmailsum) (defun rmail-summary-output (&optional file-name n) "MODIFIED! Append this message to mail file FILE-NAME. This works with both mbox format and Babyl format files, outputting in the appropriate format for each. The default file name comes from `rmail-default-file', which is updated to the name you use in this command. A prefix argument N says to output that many consecutive messages from those in the summary, starting with the current one. Deleted messages are skipped and don't count. When called from Lisp code, N may be omitted and defaults to 1. This command always outputs the complete message header, even the header display is currently pruned. [mdl: patched for bug #12214]" (interactive (progn (require 'rmailout) (list (with-current-buffer rmail-buffer (rmail-output-read-file-name)) (prefix-numeric-value current-prefix-arg)))) (let ((i 0) prev-msg) (while (and (< i n) (progn (rmail-summary-goto-msg) (not (eq prev-msg (setq prev-msg (with-current-buffer rmail-buffer rmail-current-message)))))) (setq i (1+ i)) (with-current-buffer rmail-buffer (let ((rmail-delete-after-output nil)) (with-no-warnings (rmail-output file-name 1)))) (if rmail-delete-after-output (rmail-summary-delete-forward nil) (if (< i n) (rmail-summary-next-msg 1)))))) ))) ==================== cut here for elisp ==================== Basically, this replaces the built-in version of rmail-summary-output with a patched version; the patching is done only when Rmail started via the Rmail mode hook (I don't always use Rmail mode and don't want to unnecessarily load things to save on start up speed with slow connections). Now do M-x rmail then once again C-h f on rmail-summary-output; you should (incorrectly) see: rmail-summary-output is an interactive Lisp function in `rmailsum.el'. (rmail-summary-output &optional FILE-NAME N) MODIFIED! Append this message to mail file FILE-NAME. This works with both mbox format and Babyl format files, outputting in the appropriate format for each. The default file name comes from `rmail-default-file', which is updated to the name you use in this command. A prefix argument N says to output that many consecutive messages from those in the summary, starting with the current one. Deleted messages are skipped and don't count. When called from Lisp code, N may be omitted and defaults to 1. This command always outputs the complete message header, even the header display is currently pruned. [mdl: patched for bug #12214] Note that the modification has been made (see the MODIFIED! at the top) *BUT* help still thinks the function is located in rmailsum.el. By contrast, if I do the patching outside of the Rmail mode hook, (emacs -q, eval all but first 2 and last line, M-x rmail, then C-h f) I get: rmail-summary-output is an interactive Lisp function in `temporary'. (rmail-summary-output &optional FILE-NAME N) MODIFIED! Append this message to mail file FILE-NAME. This works with both mbox format and Babyl format files, outputting in the appropriate format for each. The default file name comes from `rmail-default-file', which is updated to the name you use in this command. A prefix argument N says to output that many consecutive messages from those in the summary, starting with the current one. Deleted messages are skipped and don't count. When called from Lisp code, N may be omitted and defaults to 1. This command always outputs the complete message header, even the header display is currently pruned. [mdl: patched for bug #12214] (temporary is the name of the file I evaluated the list from). - Mark