From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eduardo Ochs Newsgroups: gmane.emacs.help Subject: Re: How does `describe-function' know where the source code of the function is? Date: Mon, 17 Jan 2022 01:27:10 -0300 Message-ID: References: <87pmorf1p5.fsf@mbork.pl> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13003"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Help Gnu Emacs mailing list To: Marcin Borkowski Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 17 05:28:05 2022 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n9Jci-0003Da-G9 for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 17 Jan 2022 05:28:04 +0100 Original-Received: from localhost ([::1]:40594 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n9Jch-0006Kb-6H for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 16 Jan 2022 23:28:03 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:50546) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n9Jc6-0006KO-1d for help-gnu-emacs@gnu.org; Sun, 16 Jan 2022 23:27:26 -0500 Original-Received: from [2607:f8b0:4864:20::1034] (port=56004 helo=mail-pj1-x1034.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n9Jc4-0006AN-4K for help-gnu-emacs@gnu.org; Sun, 16 Jan 2022 23:27:25 -0500 Original-Received: by mail-pj1-x1034.google.com with SMTP id hv15so19491393pjb.5 for ; Sun, 16 Jan 2022 20:27:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8wb/0A2XRgsBLYbus+LJTL2+FFI7GKwcSy++7wMzPds=; b=HIRet7NfN3Ge4SUPlj/c3FxV5po1WU/K73JQROO86sKGPW/P8CyY+VOzpDZCRXYDOF Su07fxSEpHka5LaxAO/E8jOxaaJRgWcDBvnvGl3ZxWU4KTe0uWuCHd9AUNyF2/sX1n4d pSw8ogSJV+MdWK1Gd+OmZrnAp4ARu8JZZk0zLtjFvggYz7Ubu6rRH37CmGwcXeMMcwd4 7wIEtlELCWk1OhsSGZPvjq0kDaiJQfjRlU+AJvwk5EYFAYUuIpPppjaUKr5CvFcvG57N NZ4YqvYtOaoXyrIPszYEyp4kQVJT0Ptj/nq2lJQSW6KMiJkQc2lTRrY9qGyc/k1Fhd4t DTZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8wb/0A2XRgsBLYbus+LJTL2+FFI7GKwcSy++7wMzPds=; b=hnAUD1n0UWjNERuTHZ++HxMtqO4Ve5Zx5fA1YfIyGJSx+POluvJTugO8J2xwd8u7vw bYASv2Nxib8Bo6sLl2GsatsVEDbBDXO/hfESeMlDXAwdQZjsApjszPDPJ90R446sIoHn /rcbSVZIZju3ktccrV8rBlEQMbgK184PsTv8m/FcxHN0f8QITqpjKLDbHhFoiZoJqPpY BeTWL9OyCZszn3ht6Shnig19xzeadEq0iQb/hgZ576VXp8aKWRD4Jz7v5MjD6TXM9KFD wCph/lHFKbjN7f9cPxRbrRB3+Fp8Cc35ei5Ge2zoVAi9tZwJesV7toL3k9+ZJwaJyoKa Q9rg== X-Gm-Message-State: AOAM533wpSaml/4CwVb2CFJ1Eq60ShQk8stVNblItuPNWfXlv7GEjMvr YH+FT0KtKPdzUh+SAcY0OdfYVJH1zv0dG2nW8eY/W8SblbiYaQ== X-Google-Smtp-Source: ABdhPJwZS/jxHqtGgbQA7N2wQiAMjoiDcNjhxEqlMFmJnpta8EvYUXPzMiQgzg8RqHKqbgEJlIYcWTY683VLHuyeT9w= X-Received: by 2002:a17:90b:4c87:: with SMTP id my7mr13495536pjb.154.1642393642018; Sun, 16 Jan 2022 20:27:22 -0800 (PST) In-Reply-To: <87pmorf1p5.fsf@mbork.pl> X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::1034 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=eduardoochs@gmail.com; helo=mail-pj1-x1034.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:135379 Archived-At: On Mon, 17 Jan 2022 at 01:04, Marcin Borkowski wrote: > Hi all, > > If I define a function with `defun', C-h f gives me a link to the source > code of the function. I defined a macro defining a function (its > expansion contained a `defun'), and C-h f'ing that function did /not/ > give me that link. I tried saying M-: (symbol-plist 'my-function), but > I haven't seen any property that would point to the source code. So, my > question is: how does `describe-function' know where the link should > point to (and if it should be rendered at all)? I skimmed its source > code, but it seems pretty convoluted. I found > `help-fns-function-description-header', but it seems that the actual > code finding the exact position of the function definition is buried > deep down the call chain, so I'm asking here in the hope that someone > could point me to the right place faster than me trying to edebug this > or something. > > Hi Marcin, when we run `M-h M-f find-file' or this sexp in eev, (find-efunction-links 'find-file) it shows a temporary buffer with lots of sexps about `find-file', including some that are quite technical and that are mostly for people who want to understand how the higher-level functions work. I ran that now, and the contents of the temporary buffer were these: # (find-efunction-links 'find-file) # (eek "M-h M-f find-file") # (find-eev-quick-intro "4.2. `find-ekey-links' and friends") # (find-efunctiondescr 'find-file) # (find-efunction 'find-file) # (find-efunctionpp 'find-file) # (find-efunctiond 'find-file) # (Info-goto-emacs-command-node 'find-file) # (find-enode "Command Index" "* find-file:") # (find-elnode "Index" "* find-file:") # (where-is 'find-file) # (symbol-file 'find-file 'defun) # (find-fline (symbol-file 'find-file 'defun)) # (find-epp (assoc (symbol-file 'find-file 'defun) load-history)) # (find-epp (assoc "/home/edrx/bigsrc/emacs28/lisp/files.elc" load-history)) # (find-eppp (mapcar 'car load-history)) # (find-estring (mapconcat 'identity (mapcar 'car load-history) "\n")) # (find-estring (documentation 'find-file)) # (find-estring (documentation 'find-file t)) # (describe-function 'find-file) I think that the sexps in the third block contain a lot of what you want, and the eev-isms should be easy to ignore. Btw, I made a video a few weeks ago about the functions of eev that show lots of very technical sexps like the ones in the third block above. The video is here: http://angg.twu.net/2021-ffll.html Cheers & happy hacking, =) Eduardo Ochs http://angg.twu.net/#eev