GNU logs - #26470, boring messages


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#26470: Feature Request:  Autoload tracing function.
Resent-From: Keith David Bershatsky <esq@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 13 Apr 2017 03:56:01 +0000
Resent-Message-ID: <handler.26470.B.14920557381898 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 26470
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 26470 <at> debbugs.gnu.org
X-Debbugs-Original-To: Emacs Bug Reports <bug-gnu-emacs@HIDDEN>
Received: via spool by submit <at> debbugs.gnu.org id=B.14920557381898
          (code B ref -1); Thu, 13 Apr 2017 03:56:01 +0000
Received: (at submit) by debbugs.gnu.org; 13 Apr 2017 03:55:38 +0000
Received: from localhost ([127.0.0.1]:44918 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cyVr7-0000UY-LS
	for submit <at> debbugs.gnu.org; Wed, 12 Apr 2017 23:55:37 -0400
Received: from eggs.gnu.org ([208.118.235.92]:34883)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <esq@HIDDEN>) id 1cyVr6-0000UJ-0S
 for submit <at> debbugs.gnu.org; Wed, 12 Apr 2017 23:55:36 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <esq@HIDDEN>) id 1cyVqz-0000gC-G8
 for submit <at> debbugs.gnu.org; Wed, 12 Apr 2017 23:55:30 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,T_DKIM_INVALID
 autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:50830)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <esq@HIDDEN>) id 1cyVqz-0000g8-DX
 for submit <at> debbugs.gnu.org; Wed, 12 Apr 2017 23:55:29 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:54084)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <esq@HIDDEN>) id 1cyVqy-0003iR-1b
 for bug-gnu-emacs@HIDDEN; Wed, 12 Apr 2017 23:55:29 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <esq@HIDDEN>) id 1cyVqt-0000fi-2b
 for bug-gnu-emacs@HIDDEN; Wed, 12 Apr 2017 23:55:28 -0400
Received: from gateway36.websitewelcome.com ([192.185.194.2]:31701)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <esq@HIDDEN>) id 1cyVqs-0000co-O9
 for bug-gnu-emacs@HIDDEN; Wed, 12 Apr 2017 23:55:23 -0400
Received: from cm4.websitewelcome.com (unknown [108.167.139.16])
 by gateway36.websitewelcome.com (Postfix) with ESMTP id AD000400D9C12
 for <bug-gnu-emacs@HIDDEN>; Wed, 12 Apr 2017 22:55:08 -0500 (CDT)
Received: from gator3053.hostgator.com ([50.87.144.69])
 by cm4.websitewelcome.com with 
 id 7fv71v0071W3Awq01fv8fV; Wed, 12 Apr 2017 22:55:08 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lawlist.com
 ; s=default;
 h=Content-Type:MIME-Version:Subject:To:From:Message-ID:Date:
 Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description:
 Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:
 In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:
 List-Post:List-Owner:List-Archive;
 bh=traMx7cs2IvpuCtknUWeZOxoq4sxq6tDbxAeNp5HWw4=; b=eQ5TLmxta9G6PdO7svSqPH9JXR
 qVT69BtjJ9qNIz5KBblp7t3dyUaQ6PdkNQUbjWaQzffRhu5ZyBp7gTAX7TXkupFKd1cYAir35gVKq
 xSEtoqy2HQdWc3jEVl9QMI+x0PBWoCyTjxLR3dN3xoic+0KjlNViUWj+PlsAcqA6CUVor88FjLxBC
 GejcwhRJ2QX6QhiImBF8W4iVPepXQ7BGNcEWRWoD2DVISe50f1/HY9xcnQVh7nCQ1cwVk/mUAbWak
 /OewY8EgpMXYzkuhvaHHEYtKaan4RtF/9wT27pXeWBIlURZZZEA1MVY4Ss0dc9a+1eDfZ3b0eQt5F
 UOXGq2ug==;
Received: from cpe-45-48-239-195.socal.res.rr.com ([45.48.239.195]:51412
 helo=server.local)
 by gator3053.hostgator.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256)
 (Exim 4.87) (envelope-from <esq@HIDDEN>) id 1cyVqc-0004uI-U0
 for bug-gnu-emacs@HIDDEN; Wed, 12 Apr 2017 22:55:07 -0500
Date: Wed, 12 Apr 2017 20:55:06 -0700
Message-ID: <m2shldufl1.wl%esq@HIDDEN>
From: Keith David Bershatsky <esq@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
X-AntiAbuse: This header was added to track abuse,
 please include it with any abuse report
X-AntiAbuse: Primary Hostname - gator3053.hostgator.com
X-AntiAbuse: Original Domain - gnu.org
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - lawlist.com
X-BWhitelist: no
X-Source-IP: 45.48.239.195
X-Exim-ID: 1cyVqc-0004uI-U0
X-Source: 
X-Source-Args: 
X-Source-Dir: 
X-Source-Sender: cpe-45-48-239-195.socal.res.rr.com (server.local)
 [45.48.239.195]:51412
X-Source-Auth: lawlist
X-Email-Count: 1
X-Source-Cap: bGF3bGlzdDtsYXdsaXN0O2dhdG9yMzA1My5ob3N0Z2F0b3IuY29t
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
 [fuzzy]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)

I like to see when an autoloaded function is requiring or loading a library; however, I did not find any built-in facility to accomplish that goal.  I also could not find a function to show me the initial constants vector of a byte-code function that had been autoloaded.  The disassemble library does not show the initial constants vector -- instead, the disassemble library goes to work in earnest after the function has already been fully loaded and the constants vector has already changed -- i.e., it no longer begins with [require ...].  The only way I found to see the initial byte-code constants vector of an autoloaded function before it was fully loaded was to use the following tracing function.

The Emacs team may wish to consider adding a function that can show a user all six (6) possible elements of a byte-code function without necessarily fully loading it if has been autoloaded.  And, the Emacs team may wish to offer a tracing mechanism to let a user know when a particular autoloaded function is loading a library.

(require 'help-fns)

(defun require--tracing-function (orig-fun &rest args)
  (message "`require' called with args %S" args)
  (with-current-buffer (get-buffer-create "*TRACE*")
    (let* ((standard-output (current-buffer))
           (print-escape-newlines t)
           (print-level 8)
           (print-length 50)
           beg end)
        (goto-char (point-max))
        (setq beg (point))
        (setq truncate-lines t)
        (set-buffer-multibyte t)
        (setq buffer-undo-list t)
        (backtrace)
        (insert "===============================\n")
        (setq end (point))
        (narrow-to-region beg end)
        (let ((regex "^\s+byte-code\(\\(\\(?:.\\)*?\\)\s\\(\\[.*\\]\\)\s\\([0-9]+\\)\)"))
          (goto-char (point-max))
          (while (re-search-backward regex nil t)
            (replace-match "BYTESTR" nil nil nil 1)
            (replace-match "MAXDEPTH" nil nil nil 3)))
        (let ((regex
                (concat
                  "^\s+\(let\\*\s\(\(standard-output.*\(current-buffer\)\)\)$"
                  "\\|"
                  "^\s+\(let\s\(\(res\s.*res\)\sres\)$"
                  "\\|"
                  "^\s+\(save-current-buffer\s\(set-buffer.*\(current-buffer\)\)\)\)$"
                  "\\|"
                  "^\s+backtrace\(\)$"
                  "\\|"
                  "^\s+apply\(require--tracing-function .*\)$"
                  "\\|"
                  "^\s+require--tracing-function\(.*\)$")))
          (goto-char (point-max))
          (while (re-search-backward regex nil t)
            (delete-region (match-beginning 0) (1+ (match-end 0)))))
        (goto-char (point-min))
        ;;; slight variation of the built-in `debugger-make-xrefs`
        (while (progn
           (goto-char (+ (point) 2))
           (skip-syntax-forward "^w_")
           (not (eobp)))
          (let* ((beg (point))
                 (end (progn (skip-syntax-forward "w_") (point)))
                 (fn (function-called-at-point))
                 (sym (intern-soft (buffer-substring-no-properties beg end)))
                 (file
                   (if fn
                     (let* (
                          (function fn)
                          (advised (and (symbolp function)
                              (featurep 'nadvice)
                              (advice--p (advice--symbol-function function))))
                          ;; If the function is advised, use the symbol that has the
                          ;; real definition, if that symbol is already set up.
                          (real-function
                            (or (and advised
                                     (advice--cd*r (advice--symbol-function function)))
                               function))
                          ;; Get the real definition.
                         (def (if (symbolp real-function)
                                 (or (symbol-function real-function)
                                     (signal 'void-function (list real-function)))
                                 real-function))
                         (aliased (or (symbolp def)
                               ;; Advised & aliased function.
                               (and advised (symbolp real-function)
                              (not (eq 'autoload (car-safe def))))))
                         (file-name (find-lisp-object-file-name function
                                      (if aliased 'defun def))))
                      file-name)
                  (and sym (symbol-file sym 'defun)))))
            (when file
              (goto-char beg)
              ;; help-xref-button needs to operate on something matched
              ;; by a regexp, so set that up for it.
              (re-search-forward "\\(\\sw\\|\\s_\\)+")
              (help-xref-button 0 'help-function-def sym file)))
          (forward-line 1))
        (widen)
      (display-buffer (current-buffer))))
  (let ((res (apply orig-fun args)))
    (message "`require' returned %S" res)
    res))

(advice-add 'require :around #'require--tracing-function)




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Keith David Bershatsky <esq@HIDDEN>
Subject: bug#26470: Acknowledgement (Feature Request:  Autoload tracing
 function.)
Message-ID: <handler.26470.B.14920557381898.ack <at> debbugs.gnu.org>
References: <m2shldufl1.wl%esq@HIDDEN>
X-Gnu-PR-Message: ack 26470
X-Gnu-PR-Package: emacs
Reply-To: 26470 <at> debbugs.gnu.org
Date: Thu, 13 Apr 2017 03:56:02 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-gnu-emacs@HIDDEN

If you wish to submit further information on this problem, please
send it to 26470 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
26470: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D26470
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#26470: Feature Request:  Autoload tracing function.
References: <m2shldufl1.wl%esq@HIDDEN>
In-Reply-To: <m2shldufl1.wl%esq@HIDDEN>
Resent-From: Keith David Bershatsky <esq@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 13 Apr 2017 19:59:01 +0000
Resent-Message-ID: <handler.26470.B26470.149211348623908 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 26470
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 26470 <at> debbugs.gnu.org
Received: via spool by 26470-submit <at> debbugs.gnu.org id=B26470.149211348623908
          (code B ref 26470); Thu, 13 Apr 2017 19:59:01 +0000
Received: (at 26470) by debbugs.gnu.org; 13 Apr 2017 19:58:06 +0000
Received: from localhost ([127.0.0.1]:46086 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cyksX-0006DX-O8
	for submit <at> debbugs.gnu.org; Thu, 13 Apr 2017 15:58:06 -0400
Received: from gateway34.websitewelcome.com ([192.185.148.194]:36123)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <esq@HIDDEN>) id 1cyksV-0006DP-GN
 for 26470 <at> debbugs.gnu.org; Thu, 13 Apr 2017 15:58:04 -0400
Received: from cm5.websitewelcome.com (cm5.websitewelcome.com [108.167.139.22])
 by gateway34.websitewelcome.com (Postfix) with ESMTP id B02D39B068
 for <26470 <at> debbugs.gnu.org>; Thu, 13 Apr 2017 14:58:02 -0500 (CDT)
Received: from gator3053.hostgator.com ([50.87.144.69])
 by cm5.websitewelcome.com with 
 id 7vy11v0031W3Awq01vy2k0; Thu, 13 Apr 2017 14:58:02 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lawlist.com
 ; s=default;
 h=Content-Type:MIME-Version:Subject:To:From:Message-ID:Date:
 Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description:
 Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:
 In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:
 List-Post:List-Owner:List-Archive;
 bh=5coWk2mG0rU3X6vjiVaNIoM+EUii+jbq7A1zaySi8ts=; b=aKcIcOo+yhM+Om+XVjJaKYX0gy
 5J/Y6cNhIh35kdrftKoYx9laRx+yoMcaOW0I+w81thR+wbQ9sM5sqL7Kh251TE0QdIXmt2wwD+ETV
 GKpd/n2Nh3sgdqG/F5xFtL4Bojsl5/G4yTVcLJOlK+27bxfOGvmQ7c98uN1yOtJ9+God3tOGvBLlu
 Z/ZaAJAsJJ0c+tPiWbJQW7VPKRvpx1mh2T3yf69/Ctz3qvRN0M6AsIc0vknvH/FZMweFOjluilU52
 fYCzhEL8m4uO7P5V3NYnxozfzFST7FegYwyXS5I62WmcfAqzDTyvaYzxR/9sQHu2JiQ4v7b8p6YDG
 PgctG4Xw==;
Received: from cpe-45-48-239-195.socal.res.rr.com ([45.48.239.195]:51977
 helo=server.local)
 by gator3053.hostgator.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256)
 (Exim 4.87) (envelope-from <esq@HIDDEN>) id 1cyksS-000VcP-MH
 for 26470 <at> debbugs.gnu.org; Thu, 13 Apr 2017 14:58:00 -0500
Date: Thu, 13 Apr 2017 12:58:00 -0700
Message-ID: <m21ssw6px3.wl%esq@HIDDEN>
From: Keith David Bershatsky <esq@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
X-AntiAbuse: This header was added to track abuse,
 please include it with any abuse report
X-AntiAbuse: Primary Hostname - gator3053.hostgator.com
X-AntiAbuse: Original Domain - debbugs.gnu.org
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - lawlist.com
X-BWhitelist: no
X-Source-IP: 45.48.239.195
X-Exim-ID: 1cyksS-000VcP-MH
X-Source: 
X-Source-Args: 
X-Source-Dir: 
X-Source-Sender: cpe-45-48-239-195.socal.res.rr.com (server.local)
 [45.48.239.195]:51977
X-Source-Auth: lawlist
X-Email-Count: 3
X-Source-Cap: bGF3bGlzdDtsYXdsaXN0O2dhdG9yMzA1My5ob3N0Z2F0b3IuY29t
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

Here is an updated version of an example tracing function that adds some regexp to redact and colorize both flavors of byte-code output from the `backtrace` function:

(require 'help-fns)

(defun require--tracing-function (orig-fun &rest args)
"When testing with `emacs -q`, start by requiring `help-fns.el`."
  (message "`require' called with args %S" args)
  (with-current-buffer (get-buffer-create "*TRACE*")
    (let* ((standard-output (current-buffer))
           (print-escape-newlines t)
           (print-level 8)
           (print-length 50)
           beg end)
        (goto-char (point-max))
        (setq beg (point))
        (setq truncate-lines t)
        (set-buffer-multibyte t)
        (setq buffer-undo-list t)
        (backtrace)
        (insert "===============================\n")
        (setq end (point))
        (narrow-to-region beg end)
        (let ((regex
                (concat
                  "^\s+byte-code\("
                  "\\(\\(?:.\\)*?\\)"
                  "\s"
                  "\\[\\(.*\\)\\]"
                  "\s"
                  "\\([0-9]+\\)"
                  "\)"))
              (bytestr (propertize "BYTESTR" 'face '(:foreground "RoyalBlue")))
              (maxdepth (propertize "MAXDEPTH" 'face '(:foreground "RoyalBlue"))))
          (goto-char (point-max))
          (while (re-search-backward regex nil t)
            (when (match-string 1)
              (replace-match bytestr nil nil nil 1))
            (when (match-string 2)
              (let ((constants
                     (propertize (match-string 2) 'face '(:foreground "purple"))))
                (replace-match constants nil 'literal nil 2)))
            (when (match-string 3)
              (replace-match maxdepth nil nil nil 3))))
        ;;; See the Emacs Lisp manual:  Byte-Code Function Objects
        (let ((regex
                (concat
                   "#\\["
                   ;;; argdesc
                   "\\([0-9]+\\)"
                   ;;; byte-code
                   "\\(?:\s\\(.*?\\)\\)?"
                   "\s"
                   ;;; constants
                   "\\[\\(.*\\)\\]"
                   "\s"
                   ;;; stacksize
                   "\\([0-9]+\\)"
                   ;;; docstring
                   "\\(?:\s\\(.*?\\)\\)?"
                   ;;; interactive
                   "\\(?:\s\\(.*?\\)\\)?"
                   "\\]"))
              (argdesc
                (propertize "ARGDESC" 'face '(:foreground "orange")))
              (byte-code
                (propertize "BYTE-CODE" 'face '(:foreground "orange")))
              (stacksize
                (propertize "STACKSIZE" 'face '(:foreground "orange")))
              (docstring
                (propertize "DOCSTRING" 'face '(:foreground "orange")))
              (interactive
                (propertize "INTERACTIVE" 'face '(:foreground "orange"))))
          (goto-char (point-max))
          (while (re-search-backward regex nil t)
            (when (match-string 1)
              (replace-match argdesc nil nil nil 1))
            (when (match-string 2)
              (replace-match byte-code nil nil nil 2))
            (when (match-string 3)
              (let ((constants
                      (propertize
                        (match-string 3) 'face '(:foreground "ForestGreen"))))
                (replace-match constants nil 'literal nil 3)))
            (when (match-string 4)
              (replace-match stacksize nil nil nil 4))
            (when (match-string 5)
              (replace-match docstring nil nil nil 5))
            (when (match-string 6)
              (replace-match interactive nil nil nil 6))))
        (let ((regex
                (concat
                  "^\s+\(let\\*\s\(\(standard-output.*\(current-buffer\)\)\)$"
                  "\\|"
                  "^\s+\(let\s\(\(res\s.*res\)\sres\)$"
                  "\\|"
                  (concat "^\s+\(save-current-buffer\s\(set-buffer.*"
                          "\(current-buffer\)\)\)\)$")
                  "\\|"
                  "^\s+backtrace\(\)$"
                  "\\|"
                  "^\s+apply\(require--tracing-function .*\)$"
                  "\\|"
                  "^\s+require--tracing-function\(.*\)$")))
          (goto-char (point-max))
          (while (re-search-backward regex nil t)
            (delete-region (match-beginning 0) (1+ (match-end 0)))))
        (goto-char (point-min))
        ;;; A slight variation of the built-in `debugger-make-xrefs'.
        (while (progn
           (goto-char (+ (point) 2))
           (skip-syntax-forward "^w_")
           (not (eobp)))
          (let* ((beg (point))
                 (end (progn (skip-syntax-forward "w_") (point)))
                 (fn (function-called-at-point))
                 (sym (intern-soft (buffer-substring-no-properties beg end)))
                 (file
                   (if fn
                     (let* (
                          (function fn)
                          (advised (and (symbolp function)
                              (featurep 'nadvice)
                              (advice--p (advice--symbol-function function))))
                          ;; If the function is advised, use the symbol that has the
                          ;; real definition, if that symbol is already set up.
                          (real-function
                            (or (and advised
                                     (advice--cd*r
                                       (advice--symbol-function function)))
                               function))
                          ;; Get the real definition.
                         (def (if (symbolp real-function)
                                 (or (symbol-function real-function)
                                     (signal 'void-function (list real-function)))
                                 real-function))
                         (aliased (or (symbolp def)
                               ;; Advised & aliased function.
                               (and advised (symbolp real-function)
                              (not (eq 'autoload (car-safe def))))))
                         (file-name
                           (find-lisp-object-file-name
                             function (if aliased 'defun def))))
                      file-name)
                  (and sym (symbol-file sym 'defun)))))
            (when file
              (goto-char beg)
              ;; help-xref-button needs to operate on something matched
              ;; by a regexp, so set that up for it.
              (re-search-forward "\\(\\sw\\|\\s_\\)+")
              (help-xref-button 0 'help-function-def sym file)))
          (forward-line 1))
        (widen)
      (display-buffer (current-buffer))))
  (let ((res (apply orig-fun args)))
    (message "`require' returned %S" res)
    res))

(advice-add 'require :around #'require--tracing-function)





Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.