From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?UTF-8?Q?=C5=A0t=C4=9Bp=C3=A1n_?= =?UTF-8?Q?N=C4=9Bmec?= Newsgroups: gmane.emacs.bugs Subject: bug#39842: [PATCH] Use help-fns-short-filename in other describe- commands Date: Sat, 29 Feb 2020 20:00:08 +0100 Message-ID: <20200229190008.338460-1-stepnem@gmail.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="17055"; mail-complaints-to="usenet@ciao.gmane.io" Cc: monnier@iro.umontreal.ca To: 39842@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Feb 29 20:01:12 2020 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 1j87MO-0004Lp-C1 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 29 Feb 2020 20:01:12 +0100 Original-Received: from localhost ([::1]:35008 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j87MN-0003hn-DK for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 29 Feb 2020 14:01:11 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40406) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j87MF-0003hB-53 for bug-gnu-emacs@gnu.org; Sat, 29 Feb 2020 14:01:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j87ME-000686-0s for bug-gnu-emacs@gnu.org; Sat, 29 Feb 2020 14:01:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57640) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j87MD-00067z-UI for bug-gnu-emacs@gnu.org; Sat, 29 Feb 2020 14:01:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1j87MD-0004Y0-Su for bug-gnu-emacs@gnu.org; Sat, 29 Feb 2020 14:01:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?=C5=A0t=C4=9Bp=C3=A1n_?= =?UTF-8?Q?N=C4=9Bmec?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 29 Feb 2020 19:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 39842 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.158300280317327 (code B ref -1); Sat, 29 Feb 2020 19:01:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 29 Feb 2020 19:00:03 +0000 Original-Received: from localhost ([127.0.0.1]:35376 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j87LH-0004VP-FM for submit@debbugs.gnu.org; Sat, 29 Feb 2020 14:00:03 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:59805) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j87LF-0004V0-QO for submit@debbugs.gnu.org; Sat, 29 Feb 2020 14:00:02 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40259) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j87LE-0003V0-Dd for bug-gnu-emacs@gnu.org; Sat, 29 Feb 2020 14:00:01 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j87LD-0005b5-9s for bug-gnu-emacs@gnu.org; Sat, 29 Feb 2020 14:00:00 -0500 Original-Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]:43508) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j87LD-0005ae-0O for bug-gnu-emacs@gnu.org; Sat, 29 Feb 2020 13:59:59 -0500 Original-Received: by mail-lj1-x22d.google.com with SMTP id e3so7065494lja.10 for ; Sat, 29 Feb 2020 10:59:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=3Oji1A5H1e2fFh3r8FTrKY8QSVrq1SXnQhk2kYpl4oY=; b=Kei20oUcGjaExGYqr7E0K46A4MX37Z6QKIOkDw9u+Ij9/htz8QTSalbBElAXji6qcJ DwU9XGj7BOxzD+DSouzc+cl6+ncHdAhjyPMWdKkgzmdpIq1ybkfjlOAZroxvjK8/KtR4 xNfDX6200h3BL6jq3kRoHqIHtaDiEF5mVjN5k4fC/cra0oVmqVpk928iA4TXIGG/Zi1H aEKfnL2+5ZpIh8L+FWBqwLTLB+huPf3fvGvhcxO4OOd4B8rwoA5FClY+8ktgB4jSWNbB TJzaAbJQn+/NIPT3jn4/C60/iptgv1U1e7QsWc/NENe+VjsCYgvY8Kh9jKmo7/7z8EMI mkkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=3Oji1A5H1e2fFh3r8FTrKY8QSVrq1SXnQhk2kYpl4oY=; b=tfGdjAwI575YlQm2Ek84YXP3gTbQPHR35U4Wixm40DnDScXbENXu7J1UqXfWrAXTAh uOQbuvDNldPOAg653L76+LB/RXbkDC3XQflnHi75duFvWV3BpUZ/j+yTSVkfBcNERh04 S8Y3grBcB+RPCB5qTNmJc5ylZV14vutMJVMRUTo9a+Dt5hpKJlq/2gMZ8fZUYrXZWi3o cciYkb8K6cvgTjw/IdQEBEw865t8vKuVIsf8Tw5+tob/9foK0pnnMrFcmsxy9cm6j5a4 GTKEYQ4PnzPlEr95kAWfroQV/WBEGw6PLbuMRmo2rd2ey7PjYZgd6wLidyKaEObr1XnI x9yg== X-Gm-Message-State: ANhLgQ2SxMwpOEY9bFbtfuQUR0QZQIQ0tB+ahmWKKoatwg9RkP01ZJem hSzzEx2Svy8l8PNH33lPQf4a/EIC X-Google-Smtp-Source: ADFU+vuj18zN2vWD1Z25QF7I5ktWhlE0k33/boHPZZtLxlydlXUpFPbowT6l3670TcBcTE0g6J1cNQ== X-Received: by 2002:a2e:3608:: with SMTP id d8mr6621623lja.152.1583002796373; Sat, 29 Feb 2020 10:59:56 -0800 (PST) Original-Received: from localhost ([185.112.167.59]) by smtp.gmail.com with ESMTPSA id b15sm1800406ljj.100.2020.02.29.10.59.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Feb 2020 10:59:55 -0800 (PST) X-Mailer: git-send-email 2.25.1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:176688 Archived-At: The commit 2015-01-16T22:52:15-05:00!monnier@iro.umontreal.ca 24b7f77581 (Improve handling of doc-strings and describe-function for cl-generic) added 'help-fns-short-filename', which provides file name shortening smarter than a simple 'file-name-nondirectory' call, but besides the generic/eieio functions ('cl--generic-describe', 'cl--describe-class', 'eieio-help-constructor'), it is currently only used by 'describe-function' (via 'help-fns-function-description-header'). Make the other help commands use it, too. (Other than the obvious consistency/maintenance argument, my immediate motivation for this change is the possibility to customize the file name abbreviation by advising the function.) * lisp/help-fns.el (help-fns-short-filename): Autoload. (describe-variable) (describe-face) (describe-keymap): Use 'help-fns-short-filename'. * lisp/help.el (describe-mode): Declare and use 'help-fns-short-filename'. --- lisp/help-fns.el | 7 ++++--- lisp/help.el | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 36c2a8b186..e204be72ad 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -661,6 +661,7 @@ help-fns--mention-first-release (insert (format " Probably introduced at or before Emacs version %s.\n" first)))))) +;;;###autoload (defun help-fns-short-filename (filename) (let* ((abbrev (abbreviate-file-name filename)) (short abbrev)) @@ -968,7 +969,7 @@ describe-variable " is a variable defined in `%s'.\n" (if (eq file-name 'C-source) "C source code" - (file-name-nondirectory file-name)))) + (help-fns-short-filename file-name)))) (with-current-buffer standard-output (save-excursion (re-search-backward (substitute-command-keys @@ -1350,7 +1351,7 @@ describe-face (setq file-name (find-lisp-object-file-name f 'defface)) (when file-name (princ (substitute-command-keys "Defined in `")) - (princ (file-name-nondirectory file-name)) + (princ (help-fns-short-filename file-name)) (princ (substitute-command-keys "'")) ;; Make a hyperlink to the library. (save-excursion @@ -1642,7 +1643,7 @@ describe-keymap " defined in `%s'.\n\n" (if (eq file-name 'C-source) "C source code" - (file-name-nondirectory file-name)))) + (help-fns-short-filename file-name)))) (save-excursion (re-search-backward (substitute-command-keys "`\\([^`']+\\)'") diff --git a/lisp/help.el b/lisp/help.el index 45cbaad4e8..32204d04e3 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -879,6 +879,7 @@ describe-key (princ ", which is ") (describe-function-1 defn))))))) +(declare-function help-fns-short-filename "help-fns" (filename)) (defun describe-mode (&optional buffer) "Display documentation of current major mode and minor modes. A brief summary of the minor modes comes first, followed by the @@ -975,7 +976,7 @@ describe-mode (file-name (find-lisp-object-file-name mode nil))) (when file-name (princ (format-message " defined in `%s'" - (file-name-nondirectory file-name))) + (help-fns-short-filename file-name))) ;; Make a hyperlink to the library. (with-current-buffer standard-output (save-excursion -- 2.25.1