From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 29 14:00:03 2020 Received: (at submit) by debbugs.gnu.org; 29 Feb 2020 19:00:03 +0000 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 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 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 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,FREEMAIL_FROM, URIBL_BLOCKED autolearn=disabled version=3.3.2 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 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 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) 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) From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20N=C4=9Bmec?= To: bug-gnu-emacs@gnu.org Subject: [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> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::22d X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: submit Cc: monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) 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 From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 29 15:02:13 2020 Received: (at submit) by debbugs.gnu.org; 29 Feb 2020 20:02:13 +0000 Received: from localhost ([127.0.0.1]:35436 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j88JR-00067Z-Fe for submit@debbugs.gnu.org; Sat, 29 Feb 2020 15:02:13 -0500 Received: from lists.gnu.org ([209.51.188.17]:44071) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j88JQ-00067S-Qc for submit@debbugs.gnu.org; Sat, 29 Feb 2020 15:02:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46674) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j88JP-0000uU-NQ for bug-gnu-emacs@gnu.org; Sat, 29 Feb 2020 15:02:12 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_05,RCVD_IN_DNSWL_MED, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j88JO-0003Vu-4A for bug-gnu-emacs@gnu.org; Sat, 29 Feb 2020 15:02:10 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:37244) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j88JO-0003U5-0A for bug-gnu-emacs@gnu.org; Sat, 29 Feb 2020 15:02:10 -0500 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 28FA6814E0; Sat, 29 Feb 2020 15:02:09 -0500 (EST) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 76ED9810E8; Sat, 29 Feb 2020 15:02:07 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1583006527; bh=QMvu9NQcVl9NXSCSRp94VvBI51mYAC2P0yzAad5MtRM=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=Ia4/MYz+/VDf5qhxXPVzWFjMcNydgVWYz7BdEieL4DE+tAn0XBbNkLH9DkxkahM7L xHEMrKgObJtaA6JX76EFY53KDZT/STyM8oX/cgE68+eSpF6r9naSUO9ThPOQtWkWV/ BQgPGhLrZMedTw3E6UFiUYmrh6bytFTG8dVD6+ZKj94unD8cYpgavLQheP1rzeS8Mv Xfmzb4hrP2jxLLtRS1C9XVvuOY4yktBZztU8pC/gr4NdMhqJiqP8kzMo0hsNtgC39M aUmrrsoOML7KSQz4bqnktzZEx9ffCzhQhqJwwSkIok8xZJ/7urH9CxmZNeuVstoTRP XeedVttiGKJkQ== Received: from pastel (unknown [216.154.50.221]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id E21C71203B9; Sat, 29 Feb 2020 15:02:06 -0500 (EST) From: Stefan Monnier To: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= Subject: Re: [PATCH] Use help-fns-short-filename in other describe- commands Message-ID: References: <20200229190008.338460-1-stepnem@gmail.com> Date: Sat, 29 Feb 2020 15:02:05 -0500 In-Reply-To: <20200229190008.338460-1-stepnem@gmail.com> (=?utf-8?B?IsWg?= =?utf-8?B?dMSbcMOhbiBOxJttZWMiJ3M=?= message of "Sat, 29 Feb 2020 20:00:08 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 132.204.25.50 X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: submit Cc: bug-gnu-emacs@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) > Make the other help commands use it, too. Sounds good. See a few comments below. > +;;;###autoload > (defun help-fns-short-filename (filename) OK, we can live that. Maybe, moving it to help.el would be a cleaner option. > 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 The autoload cookie above should render this `declare-function` unnecessary, right? Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 29 15:18:30 2020 Received: (at 39842) by debbugs.gnu.org; 29 Feb 2020 20:18:30 +0000 Received: from localhost ([127.0.0.1]:35450 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j88ZC-0006Wn-K4 for submit@debbugs.gnu.org; Sat, 29 Feb 2020 15:18:30 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:41250) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j88Z9-0006WX-J2 for 39842@debbugs.gnu.org; Sat, 29 Feb 2020 15:18:28 -0500 Received: by mail-lf1-f68.google.com with SMTP id y17so4651842lfe.8 for <39842@debbugs.gnu.org>; Sat, 29 Feb 2020 12:18:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-transfer-encoding; bh=H/vkV9svvOMQ5FhpE27n2Bxhrjjd5nbtuuQSuhnaKMg=; b=OcFfjXRFFd0iyzBlF51QRvlVRbx6Fh+lNtZvJU29AM524FfTyqyJRA7FG7EIYtJF19 NeVPgXtzk/yMrmrOi094M+bODPx7bhlYGjJcbKaie3A5j653fvrur+EvI8myAWoUtSuk GJMjMh5EoM33Pia1pA+eJNEkjJK1jHKTKkkWVTm4ulVTfPql8D/bNLdDJ27cQzN1Co9p y424drgivEtMTwWjpIhOYbhApbmx8eWeGnA1e2Lxfbmw7MPwhqGbf8ZbaXRC9RH7LH0z yI6XStYwu5TvjoF0noJ+A8tg0Piy9r/iAI5uJhoxiKHMj1yHmy5N9KLWohgLLaYm7t0g IerQ== 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:in-reply-to:references :user-agent:date:message-id:mime-version:content-transfer-encoding; bh=H/vkV9svvOMQ5FhpE27n2Bxhrjjd5nbtuuQSuhnaKMg=; b=NJg+Eb3cl9SIxzEhDg8aVjmTw7QkXdLpnmNmKOFF8RJZ/13dbsptv16ee3EzT9HR7D uHLXkbH+kr9kbWwDSBV+9AsNLAQQvmN4Y4QfS1InQks1yf1kZb7Via1S9oDJUpFc6CZO xq3Q1QvLUeVlEXYjljRhKEek/M2EqeeGv9HDCMrjb7gz1cl69EhDiOo7JJZSRMmsmM35 5+Ydhkzynm4LEsXlNRvBnGlZW/+zBwEv/gT1JXsyQt2xVGk7oYvyKpaNiz1xBgeskwhG E2pPQwXVqCxRhrKWGXt+VdASvbEDR/Q5JqPqBrBrVCUiq8/nwRIPyIgNztd4nXJ+cc/5 9a5Q== X-Gm-Message-State: ANhLgQ0Z4N4HGoeAvoRYXuYYFuQxuQPrV11GgEVrRb+5jAZUbnSnzjGS sf7HU/qm2ueka4RYkAq+sYDl6EX5 X-Google-Smtp-Source: ADFU+vvfSfYdv8CYFXHvzGHAikbEwgPB1uX7f3WMWAVD/QG35LkkKqx8IkNXIWG5bj/1gzgYbMIBIg== X-Received: by 2002:a19:4c86:: with SMTP id z128mr6034026lfa.100.1583007501492; Sat, 29 Feb 2020 12:18:21 -0800 (PST) Received: from localhost ([185.112.167.59]) by smtp.gmail.com with ESMTPSA id s21sm8881177lfb.27.2020.02.29.12.18.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Feb 2020 12:18:20 -0800 (PST) From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= To: Stefan Monnier Subject: Re: [PATCH] Use help-fns-short-filename in other describe- commands In-Reply-To: References: <20200229190008.338460-1-stepnem@gmail.com> User-Agent: Notmuch/0.29.3 (https://notmuchmail.org) Emacs/28.0.50 (x86_64-pc-linux-gnu) Date: Sat, 29 Feb 2020 21:18:33 +0100 Message-ID: <87zhd187vq.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39842 Cc: 39842@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Sat, 29 Feb 2020 15:02:05 -0500 Stefan Monnier wrote: >> +;;;###autoload >> (defun help-fns-short-filename (filename) > > OK, we can live that. Maybe, moving it to help.el would be a cleaner opt= ion. > >> 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 > > The autoload cookie above should render this `declare-function` > unnecessary, right? R...right...? I'm somewhat unclear on the "something non-preloaded required by something preloaded" situation. :-) So, which shall it be? Move help-fns-short-filename to help.el, or just remove the declaration? Thanks, =C5=A0t=C4=9Bp=C3=A1n From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 29 15:29:17 2020 Received: (at 39842) by debbugs.gnu.org; 29 Feb 2020 20:29:17 +0000 Received: from localhost ([127.0.0.1]:35455 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j88jd-0006nO-MI for submit@debbugs.gnu.org; Sat, 29 Feb 2020 15:29:17 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:42002) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j88jc-0006n6-3P for 39842@debbugs.gnu.org; Sat, 29 Feb 2020 15:29:16 -0500 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 97A73100B6B; Sat, 29 Feb 2020 15:29:10 -0500 (EST) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 07739100925; Sat, 29 Feb 2020 15:29:09 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1583008149; bh=4PegXnCRQxYcWMDLMSUII1fNT3wDg+QDAjDGglg0xIs=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=aa0qiH9PiZiXi5QQYvy05kG2A7TJ5CDVk3NIE0ymN9IAfFFxxX/Jb/KRqpKUPfvqx Or49susnfm/bUmYl7P1CpWQx07koaxQL7xZ7lURA+U5AH7BY8JZ+Nl46N1ET4Y3Wnb YlPzMhFy4ZWwkzK8K8+ygxtaekKRwcm7pbImsxt3/kkertu7avj2pR2kmIIip3J9MM F7uRk+VLl0gEfCuujRRdB3W2CXwK2GLjcvwrTgVpJMBgVaKVr9v+x5ZNN1lVtXMYlM zpT8hwEd11eD3pjWJBnYxR2Wivw9sKUEhuKqESSopKgV4sNk2P8vSfwrkWeLgd+1kS ZecykweH08WLA== Received: from pastel (unknown [216.154.50.221]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 64D7F1207A1; Sat, 29 Feb 2020 15:29:08 -0500 (EST) From: Stefan Monnier To: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= Subject: Re: [PATCH] Use help-fns-short-filename in other describe- commands Message-ID: References: <20200229190008.338460-1-stepnem@gmail.com> <87zhd187vq.fsf@gmail.com> Date: Sat, 29 Feb 2020 15:29:01 -0500 In-Reply-To: <87zhd187vq.fsf@gmail.com> (=?utf-8?B?IsWgdMSbcMOhbiBOxJtt?= =?utf-8?B?ZWMiJ3M=?= message of "Sat, 29 Feb 2020 21:18:33 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.066 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 39842 Cc: 39842@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > So, which shall it be? Move help-fns-short-filename to help.el, or > just remove the declaration? I think the declaration can be removed in either case (either with the function autoloaded or with it moved to help.el). Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 29 15:40:14 2020 Received: (at 39842) by debbugs.gnu.org; 29 Feb 2020 20:40:14 +0000 Received: from localhost ([127.0.0.1]:35469 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j88uD-00075I-Uc for submit@debbugs.gnu.org; Sat, 29 Feb 2020 15:40:14 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:55718) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j88uC-000750-43 for 39842@debbugs.gnu.org; Sat, 29 Feb 2020 15:40:12 -0500 Received: by mail-wm1-f67.google.com with SMTP id q9so7154189wmj.5 for <39842@debbugs.gnu.org>; Sat, 29 Feb 2020 12:40:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-transfer-encoding; bh=Q5paOEVqEPhpF14ySLRN0xNGGeaabmmg4wshjNcP0VE=; b=SYmeSZ3jLGu2BrCIncoWRtyhYtApUJqN8Clz1PUY/lyG4G6EU/7qF0N+mtBqmeojS0 mObD3squuOcleZP0l0g+IQmBxHpd2wwNr4hLLmLnxy8G8ffImwRiHed/0bz1VgbTsPD3 rp9ajh6pdrNUZU02F6h8LP+B7bT845vHUXNAHdcwuSlydcMO9vr2hglQcjNe5scqlN1X 3EUhIiOno5kd6br4MgEnTbEF8fdTJPvY5w4SYBDgSXTNQJsbAS1jvUDh/4RY9jgC+PZX jM8PGQJjSolA0e9WHcHQaPaltM5VIsrq8jUa7COxGXKxw21ffotYVMfvan2yfpYyBPbd DWZQ== 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:in-reply-to:references :user-agent:date:message-id:mime-version:content-transfer-encoding; bh=Q5paOEVqEPhpF14ySLRN0xNGGeaabmmg4wshjNcP0VE=; b=DWUo7htL5c6YIPhS9krLTD9yxWYqolo1Vq2L9GogNSCIc6z736/dL92WeN++WoZeoD BuZDo0gLEBO8CjlkGmZmS69QtvfneB94AC7xwYCwNVxOkU9DLWQAPv+PKxnskFVclhVf mXyERblpG14BRSDaZZVl3ZkdUzPg726QqrWA4Pq6WuYgf/aF9eFrpT4k4kEFBz+flvPK 6QGTjJG80BgCZXRLGSsGyULF9kDv6k8jbvIqFyv2VJP7jMhe7WbBF82A26lBC4WfrgW5 daOue8W8RVPsn6LjXnsE2DMaLDggF7jwpmek8dMNkP11IZOkXOo9+glBcVZLpf7BfeBJ zBpA== X-Gm-Message-State: APjAAAXyx3Gqs41qQWYZadqJHi7FQKHB2xALDoJR/PXk8N311oIOccZ3 6wwOCAZ/3l5dRvUsL98dDi0= X-Google-Smtp-Source: APXvYqxXXpTj/GtTZ+iN3Z3VpHXacLyuHsALuP6WA7PPQt1my1r/mZhi+WksRDs1J1jh2+DmI1SYKA== X-Received: by 2002:a05:600c:291e:: with SMTP id i30mr11389989wmd.40.1583008806153; Sat, 29 Feb 2020 12:40:06 -0800 (PST) Received: from localhost ([185.112.167.59]) by smtp.gmail.com with ESMTPSA id s1sm19009153wro.66.2020.02.29.12.40.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Feb 2020 12:40:05 -0800 (PST) From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= To: Stefan Monnier Subject: Re: [PATCH] Use help-fns-short-filename in other describe- commands In-Reply-To: References: <20200229190008.338460-1-stepnem@gmail.com> <87zhd187vq.fsf@gmail.com> User-Agent: Notmuch/0.29.3 (https://notmuchmail.org) Emacs/28.0.50 (x86_64-pc-linux-gnu) Date: Sat, 29 Feb 2020 21:40:18 +0100 Message-ID: <87v9np86vh.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39842 Cc: 39842@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Sat, 29 Feb 2020 15:29:01 -0500 Stefan Monnier wrote: >> So, which shall it be? Move help-fns-short-filename to help.el, or >> just remove the declaration? > > I think the declaration can be removed in either case (either with the > function autoloaded or with it moved to help.el). That's what I understood from your previous message. Now I'm asking if I should just remove the declaration, or also move the function (and rename it to help-short-filename?). --=20 =C5=A0t=C4=9Bp=C3=A1n From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 29 16:07:58 2020 Received: (at 39842) by debbugs.gnu.org; 29 Feb 2020 21:07:59 +0000 Received: from localhost ([127.0.0.1]:35484 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j89L4-0007j7-OF for submit@debbugs.gnu.org; Sat, 29 Feb 2020 16:07:58 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:24230) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j89L3-0007it-Dp for 39842@debbugs.gnu.org; Sat, 29 Feb 2020 16:07:57 -0500 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 8FAFF100B6B; Sat, 29 Feb 2020 16:07:51 -0500 (EST) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id E680D100925; Sat, 29 Feb 2020 16:07:49 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1583010469; bh=b628tsESgrTl0yO0zLQQVZRJgu4y/hYOYoX/wUJlc7s=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=GoOcuCDkpgxK4Ydu5XKqanoovEArW8T+yyKGvyZR5UhRbP7aEfRdcunx9EjSSXof5 lmiYfgvYgGusu0AeG6Z84MqaC2g586pS+6xfvYP0xEMTCzlTzERaUjoOZc2McUBB6h CdDoAZNTyxXVnjbVzqCyvbSufMxoV+eVw+5O7aBbaKAZmjpVkMkCx0Qfmv7KTSGmTx NfjFLYsnObBfUlWHWscEt5+xQ6IAM0KNtmoD1dUap7myp1dOvWIu9vvKZ29FAGiCme 1PxeU2xY2v+41c/pXaRlbkOs9hBpYIOod1EJ+HOkBlZgZTwzi/jldydu4m8pjLwavD L4PRgJrDPItbQ== Received: from pastel (unknown [216.154.50.221]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 620CE1205D6; Sat, 29 Feb 2020 16:07:48 -0500 (EST) From: Stefan Monnier To: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= Subject: Re: [PATCH] Use help-fns-short-filename in other describe- commands Message-ID: References: <20200229190008.338460-1-stepnem@gmail.com> <87zhd187vq.fsf@gmail.com> <87v9np86vh.fsf@gmail.com> Date: Sat, 29 Feb 2020 16:07:46 -0500 In-Reply-To: <87v9np86vh.fsf@gmail.com> (=?utf-8?B?IsWgdMSbcMOhbiBOxJtt?= =?utf-8?B?ZWMiJ3M=?= message of "Sat, 29 Feb 2020 21:40:18 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.065 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 39842 Cc: 39842@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > That's what I understood from your previous message. Now I'm asking if I > should just remove the declaration, or also move the function (and > rename it to help-short-filename?). Not sure which is best either. Hmm... now that I look at it more closely, I see that `describe-mode` can't work without loading `help-fns` (e.g. because it calls `find-lisp-object-file-name`), so there's no point having `describe-mode` preloaded. I.e. I think the better answer is that `describe-mode` should move to `help-fns.el`. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 29 16:47:32 2020 Received: (at 39842) by debbugs.gnu.org; 29 Feb 2020 21:47:32 +0000 Received: from localhost ([127.0.0.1]:35494 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j89xM-0000BF-42 for submit@debbugs.gnu.org; Sat, 29 Feb 2020 16:47:32 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:39122) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j89xK-0000B2-Eu for 39842@debbugs.gnu.org; Sat, 29 Feb 2020 16:47:31 -0500 Received: by mail-wr1-f66.google.com with SMTP id y17so7739335wrn.6 for <39842@debbugs.gnu.org>; Sat, 29 Feb 2020 13:47:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version; bh=OegRcyGj7ym153SIEmLvRuFjvs4gHQdRmcDRD2qYdXU=; b=aC0mY1qs2udXoGxHkZ4SBr4pg19w1XfKbj2kGosyQ98dIoRObPHAPMSrqSvZ/somFt C2+fMdnbhQO14HdiKzE2JBU0fp6+1uppSF54J1+5+FVp40/MMWtJPZbvMA4uxT6CpW8M yESFC0Xm7OKvXrL2joIi+hysll5KEI/qMzqGrIY+TIEfmtRwnaYFSnilDQ4B60mOKNdr xuWW0Z14PxhI+tLpXldVydU8KwmP1P544DgFEMr73BnDF2VwuWP4XxTRvcphZ2XhEzC3 g8HubfD7MFTIbgq3rrOwJ2boTSPNOfh+QB1wAtUhkLFs9KBIGtcVxUM+N08MJeGwwWwX 9OGQ== 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:in-reply-to:references :user-agent:date:message-id:mime-version; bh=OegRcyGj7ym153SIEmLvRuFjvs4gHQdRmcDRD2qYdXU=; b=tuWZIFfrn1EBKV0ErvMeMK8UutNUPiWHZALz7sNAx25VY1ga4tijHk/PN6xLd4mwTe EXmErKnDJPM3O3VBdT+PkWkIJmKp1CL4Pxtj9CsxyYVguyL+bmoI+Adbn573UjFGG2le 6NY6nP+G+ZA/S3bt7yjt8kNdZAgFSCRBzu0LwsOf1TUjLvXFIakkb1By1/YSBx1BdD5x vUqJQBAMVL6QEt65aw09SFq+I3knGr7XRf0H33T0PyqPn8x6ifsS2hIzFMQK0WeNQ2my NUWl/hj0VXFPyY54/Nm8P1Mmqyt8RCqTYCtGo0Bprsdlulu2MZT8qOFy6cfQ5Cp72k8v vtxg== X-Gm-Message-State: APjAAAXuFTfuvsj2i0t2eH3vfzJ+0VSK2qeAzQOgXnOA3y3CF+lxGp8q 69ONEcriBu8uRsV9M7eIM7F2rUCW X-Google-Smtp-Source: APXvYqy7azcnrw+tPc4NlmtmOkRvt71etZbJVfcN9l97/Fl0lHnoWULT8jqRbVHNJDQnL5s//cAzxg== X-Received: by 2002:a05:6000:2:: with SMTP id h2mr6894048wrx.182.1583012844485; Sat, 29 Feb 2020 13:47:24 -0800 (PST) Received: from localhost ([185.112.167.59]) by smtp.gmail.com with ESMTPSA id d15sm15144304wrp.37.2020.02.29.13.47.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Feb 2020 13:47:23 -0800 (PST) From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= To: Stefan Monnier Subject: Re: [PATCH] Use help-fns-short-filename in other describe- commands In-Reply-To: References: <20200229190008.338460-1-stepnem@gmail.com> <87zhd187vq.fsf@gmail.com> <87v9np86vh.fsf@gmail.com> User-Agent: Notmuch/0.29.3 (https://notmuchmail.org) Emacs/28.0.50 (x86_64-pc-linux-gnu) Date: Sat, 29 Feb 2020 22:47:36 +0100 Message-ID: <87r1yd83rb.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39842 Cc: 39842@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Sat, 29 Feb 2020 16:07:46 -0500 Stefan Monnier wrote: > I.e. I think the better answer is that `describe-mode` should move to > `help-fns.el`. Patch updated to that effect attached. Thank you, =C5=A0t=C4=9Bp=C3=A1n --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Use-help-fns-short-filename-in-other-describe-comman.patch >From f9edbe36d6c56f7bf64ba687d525e48fd8762cde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20N=C4=9Bmec?= Date: Sat, 29 Feb 2020 19:43:53 +0100 Subject: [PATCH] Use help-fns-short-filename in other describe- commands 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.el (describe-mode): Move to help-fns.el. The command was already depending on 'find-lisp-object-file-name' defined there. * lisp/help-fns.el (describe-variable) (describe-face) (describe-keymap) (describe-mode): Use 'help-fns-short-filename'. --- lisp/help-fns.el | 116 +++++++++++++++++++++++++++++++++++++++++++++-- lisp/help.el | 108 ------------------------------------------- 2 files changed, 112 insertions(+), 112 deletions(-) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 36c2a8b186..ad496166f5 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -968,7 +968,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 +1350,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 +1642,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 "`\\([^`']+\\)'") @@ -1658,7 +1658,115 @@ describe-keymap ;; Cleanup. (when used-gentemp (makunbound keymap)))) - + +;;;###autoload +(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 +major mode description. This is followed by detailed +descriptions of the minor modes, each on a separate page. + +For this to work correctly for a minor mode, the mode's indicator +variable \(listed in `minor-mode-alist') must also be a function +whose documentation describes the minor mode. + +If called from Lisp with a non-nil BUFFER argument, display +documentation for the major and minor modes of that buffer." + (interactive "@") + (unless buffer (setq buffer (current-buffer))) + (help-setup-xref (list #'describe-mode buffer) + (called-interactively-p 'interactive)) + ;; For the sake of help-do-xref and help-xref-go-back, + ;; don't switch buffers before calling `help-buffer'. + (with-help-window (help-buffer) + (with-current-buffer buffer + (let (minor-modes) + ;; Older packages do not register in minor-mode-list but only in + ;; minor-mode-alist. + (dolist (x minor-mode-alist) + (setq x (car x)) + (unless (memq x minor-mode-list) + (push x minor-mode-list))) + ;; Find enabled minor mode we will want to mention. + (dolist (mode minor-mode-list) + ;; Document a minor mode if it is listed in minor-mode-alist, + ;; non-nil, and has a function definition. + (let ((fmode (or (get mode :minor-mode-function) mode))) + (and (boundp mode) (symbol-value mode) + (fboundp fmode) + (let ((pretty-minor-mode + (if (string-match "\\(\\(-minor\\)?-mode\\)?\\'" + (symbol-name fmode)) + (capitalize + (substring (symbol-name fmode) + 0 (match-beginning 0))) + fmode))) + (push (list fmode pretty-minor-mode + (format-mode-line (assq mode minor-mode-alist))) + minor-modes))))) + ;; Narrowing is not a minor mode, but its indicator is part of + ;; mode-line-modes. + (when (buffer-narrowed-p) + (push '(narrow-to-region "Narrow" " Narrow") minor-modes)) + (setq minor-modes + (sort minor-modes + (lambda (a b) (string-lessp (cadr a) (cadr b))))) + (when minor-modes + (princ "Enabled minor modes:\n") + (make-local-variable 'help-button-cache) + (with-current-buffer standard-output + (dolist (mode minor-modes) + (let ((mode-function (nth 0 mode)) + (pretty-minor-mode (nth 1 mode)) + (indicator (nth 2 mode))) + (save-excursion + (goto-char (point-max)) + (princ "\n\f\n") + (push (point-marker) help-button-cache) + ;; Document the minor modes fully. + (insert-text-button + pretty-minor-mode 'type 'help-function + 'help-args (list mode-function) + 'button '(t)) + (princ (format " minor mode (%s):\n" + (if (zerop (length indicator)) + "no indicator" + (format "indicator%s" + indicator)))) + (princ (help-split-fundoc (documentation mode-function) + nil 'doc))) + (insert-button pretty-minor-mode + 'action (car help-button-cache) + 'follow-link t + 'help-echo "mouse-2, RET: show full information") + (newline))) + (forward-line -1) + (fill-paragraph nil) + (forward-line 1)) + + (princ "\n(Information about these minor modes follows the major mode info.)\n\n")) + ;; Document the major mode. + (let ((mode mode-name)) + (with-current-buffer standard-output + (let ((start (point))) + (insert (format-mode-line mode nil nil buffer)) + (add-text-properties start (point) '(face bold))))) + (princ " mode") + (let* ((mode major-mode) + (file-name (find-lisp-object-file-name mode nil))) + (when file-name + (princ (format-message " defined in `%s'" + (help-fns-short-filename file-name))) + ;; Make a hyperlink to the library. + (with-current-buffer standard-output + (save-excursion + (re-search-backward (substitute-command-keys "`\\([^`']+\\)'") + nil t) + (help-xref-button 1 'help-function-def mode file-name))))) + (princ ":\n") + (princ (help-split-fundoc (documentation major-mode) nil 'doc))))) + ;; For the sake of IELM and maybe others + nil) ;;; Replacements for old lib-src/ programs. Don't seem especially useful. diff --git a/lisp/help.el b/lisp/help.el index 45cbaad4e8..e40ed479e0 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -879,114 +879,6 @@ describe-key (princ ", which is ") (describe-function-1 defn))))))) -(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 -major mode description. This is followed by detailed -descriptions of the minor modes, each on a separate page. - -For this to work correctly for a minor mode, the mode's indicator -variable \(listed in `minor-mode-alist') must also be a function -whose documentation describes the minor mode. - -If called from Lisp with a non-nil BUFFER argument, display -documentation for the major and minor modes of that buffer." - (interactive "@") - (unless buffer (setq buffer (current-buffer))) - (help-setup-xref (list #'describe-mode buffer) - (called-interactively-p 'interactive)) - ;; For the sake of help-do-xref and help-xref-go-back, - ;; don't switch buffers before calling `help-buffer'. - (with-help-window (help-buffer) - (with-current-buffer buffer - (let (minor-modes) - ;; Older packages do not register in minor-mode-list but only in - ;; minor-mode-alist. - (dolist (x minor-mode-alist) - (setq x (car x)) - (unless (memq x minor-mode-list) - (push x minor-mode-list))) - ;; Find enabled minor mode we will want to mention. - (dolist (mode minor-mode-list) - ;; Document a minor mode if it is listed in minor-mode-alist, - ;; non-nil, and has a function definition. - (let ((fmode (or (get mode :minor-mode-function) mode))) - (and (boundp mode) (symbol-value mode) - (fboundp fmode) - (let ((pretty-minor-mode - (if (string-match "\\(\\(-minor\\)?-mode\\)?\\'" - (symbol-name fmode)) - (capitalize - (substring (symbol-name fmode) - 0 (match-beginning 0))) - fmode))) - (push (list fmode pretty-minor-mode - (format-mode-line (assq mode minor-mode-alist))) - minor-modes))))) - ;; Narrowing is not a minor mode, but its indicator is part of - ;; mode-line-modes. - (when (buffer-narrowed-p) - (push '(narrow-to-region "Narrow" " Narrow") minor-modes)) - (setq minor-modes - (sort minor-modes - (lambda (a b) (string-lessp (cadr a) (cadr b))))) - (when minor-modes - (princ "Enabled minor modes:\n") - (make-local-variable 'help-button-cache) - (with-current-buffer standard-output - (dolist (mode minor-modes) - (let ((mode-function (nth 0 mode)) - (pretty-minor-mode (nth 1 mode)) - (indicator (nth 2 mode))) - (save-excursion - (goto-char (point-max)) - (princ "\n\f\n") - (push (point-marker) help-button-cache) - ;; Document the minor modes fully. - (insert-text-button - pretty-minor-mode 'type 'help-function - 'help-args (list mode-function) - 'button '(t)) - (princ (format " minor mode (%s):\n" - (if (zerop (length indicator)) - "no indicator" - (format "indicator%s" - indicator)))) - (princ (help-split-fundoc (documentation mode-function) - nil 'doc))) - (insert-button pretty-minor-mode - 'action (car help-button-cache) - 'follow-link t - 'help-echo "mouse-2, RET: show full information") - (newline))) - (forward-line -1) - (fill-paragraph nil) - (forward-line 1)) - - (princ "\n(Information about these minor modes follows the major mode info.)\n\n")) - ;; Document the major mode. - (let ((mode mode-name)) - (with-current-buffer standard-output - (let ((start (point))) - (insert (format-mode-line mode nil nil buffer)) - (add-text-properties start (point) '(face bold))))) - (princ " mode") - (let* ((mode major-mode) - (file-name (find-lisp-object-file-name mode nil))) - (when file-name - (princ (format-message " defined in `%s'" - (file-name-nondirectory file-name))) - ;; Make a hyperlink to the library. - (with-current-buffer standard-output - (save-excursion - (re-search-backward (substitute-command-keys "`\\([^`']+\\)'") - nil t) - (help-xref-button 1 'help-function-def mode file-name))))) - (princ ":\n") - (princ (help-split-fundoc (documentation major-mode) nil 'doc))))) - ;; For the sake of IELM and maybe others - nil) - (defun search-forward-help-for-help () "Search forward \"help window\"." (interactive) -- 2.25.1 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 03 10:53:20 2020 Received: (at 39842-done) by debbugs.gnu.org; 3 Mar 2020 15:53:20 +0000 Received: from localhost ([127.0.0.1]:39871 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j99rE-00006I-7i for submit@debbugs.gnu.org; Tue, 03 Mar 2020 10:53:20 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:29591) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j99rC-000062-J8 for 39842-done@debbugs.gnu.org; Tue, 03 Mar 2020 10:53:19 -0500 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id EDFDC44EFD1; Tue, 3 Mar 2020 10:53:12 -0500 (EST) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 1F95B44EFCF; Tue, 3 Mar 2020 10:53:11 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1583250791; bh=w9ywCHSy4ACuwtGwR5qdz+zjrpfaHeK44LBDf7Mcaeo=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=Y1qTlrugGgE1nKqhIBZDgkpKMnxc7pg9I/iM5+4i3SXdekQ067WmGePjxmq+rMhTw 4ir1smQlWc6JpvdDSkXd9hHoQT3pMMhc8Q6ofNua2+XGmnemk+QHesKqdPBWUJrmp8 Nfdx/62BvDroTx0artQiswbFhnaVhjofylvGPEWHsfVPHFMVA9XfBZ2FAt/VH146Mq jx5j31CwKMaY3V1MgudPfGApHoijSURIGG8UnQxLCXn/G/rpdegvFRZl70UI6C8g50 oWtrAB7xpkL1wGxuguaNZ+CQqNcfo0KAvYTl4Qg4TWf2WKzNIcnQyIALm8yXfzOESD Alo+CgxSdWPnQ== Received: from pastel (unknown [216.154.50.221]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id CE81D12029D; Tue, 3 Mar 2020 10:53:10 -0500 (EST) From: Stefan Monnier To: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= Subject: Re: [PATCH] Use help-fns-short-filename in other describe- commands Message-ID: References: <20200229190008.338460-1-stepnem@gmail.com> <87zhd187vq.fsf@gmail.com> <87v9np86vh.fsf@gmail.com> <87r1yd83rb.fsf@gmail.com> Date: Tue, 03 Mar 2020 10:53:09 -0500 In-Reply-To: <87r1yd83rb.fsf@gmail.com> (=?utf-8?B?IsWgdMSbcMOhbiBOxJtt?= =?utf-8?B?ZWMiJ3M=?= message of "Sat, 29 Feb 2020 22:47:36 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/x-markdown; coding=UTF-8 X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.043 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 39842-done Cc: 39842-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Patch updated to that effect attached. Thanks, installed into `master`. Stefan From unknown Sun Jun 22 04:37:17 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 01 Apr 2020 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator