From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Troy Brown Newsgroups: gmane.emacs.bugs Subject: bug#64143: 29.0.60; find-function-search-for-symbol truncates library path Date: Sun, 18 Jun 2023 00:45:12 -0400 Message-ID: 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="12039"; mail-complaints-to="usenet@ciao.gmane.io" To: 64143@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jun 18 06:46:20 2023 Return-path: Envelope-to: geb-bug-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 1qAkIr-0002zT-Hz for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Jun 2023 06:46:17 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qAkIe-0007uO-FJ; Sun, 18 Jun 2023 00:46:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qAkId-0007u5-4x for bug-gnu-emacs@gnu.org; Sun, 18 Jun 2023 00:46:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qAkIc-0001iV-Sa for bug-gnu-emacs@gnu.org; Sun, 18 Jun 2023 00:46:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qAkIc-0006bj-C7 for bug-gnu-emacs@gnu.org; Sun, 18 Jun 2023 00:46:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Troy Brown Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Jun 2023 04:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 64143 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.168706353425354 (code B ref -1); Sun, 18 Jun 2023 04:46:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 18 Jun 2023 04:45:34 +0000 Original-Received: from localhost ([127.0.0.1]:52930 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qAkI9-0006as-Lm for submit@debbugs.gnu.org; Sun, 18 Jun 2023 00:45:33 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:57360) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qAkI5-0006ah-FM for submit@debbugs.gnu.org; Sun, 18 Jun 2023 00:45:32 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qAkI4-0007gf-Ri for bug-gnu-emacs@gnu.org; Sun, 18 Jun 2023 00:45:28 -0400 Original-Received: from mail-ej1-f52.google.com ([209.85.218.52]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qAkI2-0001WQ-Vc for bug-gnu-emacs@gnu.org; Sun, 18 Jun 2023 00:45:28 -0400 Original-Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-98220bb31c6so356523066b.3 for ; Sat, 17 Jun 2023 21:45:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687063524; x=1689655524; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=2q4pTyhrDK91nQIU1gdB1hH3ptmM6B5NoQlRaIu7H7M=; b=HFsOEcIr4ObjrhOcUTuiJimzO0HqXfAwfxe8z8DkWsM9148zuxrd+wSCVZjm/BboNe KH3jLgs5k0FPjPtq/56FKdkJ5KWHeYX+B9FyuDcP/pgbGtHCHMvhY92RiYrdSqcLMf+I iKhtSXUp1ku/n4hg5IbQiePZJh8TA/ERFNkIfq3LQsuHB3rzR7cVfooQ0CM3ymIxe0Q9 IHcBQfXw7fgCvuVf+xUZZ/4na/XGG/BOpcTCcYcAxP0b/jjrLJ82+rxzjq1RSbw4Y+Pw j0TTjRUTHRkFgWziotV/x2SPqqJwkQocfBA8T85t71mwa9dSFhXO7ULmwR2sCxuOCuqo uN4Q== X-Gm-Message-State: AC+VfDwf1w43NYI6JsA/SnkRNlnM/o1y4AFDApu+5v3VNgswvkY94Jlv Ft8FPLvi4ojar5BxFRzBHJ1Zh+hShB4kRg== X-Google-Smtp-Source: ACHHUZ7fl8O4itPjbg5KgPfjBNv4CMgqVZEwX2TsaRxvlPscON8urRgR9a52d3WuPosRNVcl6gq9pg== X-Received: by 2002:a17:907:2689:b0:965:9602:1f07 with SMTP id bn9-20020a170907268900b0096596021f07mr6513638ejc.39.1687063524288; Sat, 17 Jun 2023 21:45:24 -0700 (PDT) Original-Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com. [209.85.208.46]) by smtp.gmail.com with ESMTPSA id p18-20020a1709061b5200b00982c9a75c14sm3642672ejg.143.2023.06.17.21.45.23 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 17 Jun 2023 21:45:24 -0700 (PDT) Original-Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-51a3e6a952aso2683401a12.3 for ; Sat, 17 Jun 2023 21:45:23 -0700 (PDT) X-Received: by 2002:aa7:c749:0:b0:51a:542b:ecdb with SMTP id c9-20020aa7c749000000b0051a542becdbmr169369eds.3.1687063523548; Sat, 17 Jun 2023 21:45:23 -0700 (PDT) X-Gmail-Original-Message-ID: Received-SPF: pass client-ip=209.85.218.52; envelope-from=troy.s.brown@gmail.com; helo=mail-ej1-f52.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:263597 Archived-At: When user-emacs-directory contains "emacs.el" in it's path (e.g., "~/.emacs.elpa"), which is much easier these days with the availability of --init-directory, the find-function-search-for-symbol truncates the library path after "emacs". I was experimenting with a different user directory (i.e., "--init-directory=~/.emacs.elpa") and was surprised to find out that the Help system was breaking when using this path. When looking up a symbol in the Help system (e.g., "C-h f company-mode RET") and then attempting to visit the source file from the help window (i.e., help-view-source), if the symbol belongs to an installed package (where the source is under the "elpa" directory beneath user-emacs-directory), it will generate the following error message: Can't find library: /home/troy/.emacs Toggling "debug-on-error" and repeating the above, I can generate a backtrace for this as follows: Debugger entered--Lisp error: (file-error "Can't find library" "/home/troy/.emacs") find-library-name("/home/troy/.emacs") #(company-mode nil "/home/troy/.emacs.elpa/elpa/company-20230416.2034/company.el") ad-Advice-find-function-search-for-symbol(# company-mode nil "/home/troy/.emacs.elpa/elpa/company-20230416.2034/company.el") apply(ad-Advice-find-function-search-for-symbol # (company-mode nil "/home/troy/.emacs.elpa/elpa/company-20230416.2034/company.el")) find-function-search-for-symbol(company-mode nil "/home/troy/.emacs.elpa/elpa/company-20230416.2034/company.el") help-function-def--button-function(company-mode "/home/troy/.emacs.elpa/elpa/company-20230416.2034/company.el" nil) help-view-source() funcall-interactively(help-view-source) call-interactively(help-view-source nil nil) command-execute(help-view-source) I believe the following snippet of code in find-function-search-for-symbol is to blame for this: (when (string-match "\\.emacs\\(.el\\)" library) (setq library (substring library 0 (match-beginning 1)))) The regex likely should be improved to only match .emacs or .emacs.el at the end of the path, not in the middle of it.