From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "H. Dieter Wilhelm" Newsgroups: gmane.emacs.bugs Subject: bug#60587: Patch for adding links to symbols' help documentation Date: Sun, 05 Feb 2023 14:54:32 +0100 Message-ID: <86a61s9q07.fsf@duenenhof-wilhelm.de> References: <86y1qgr1bf.fsf@duenenhof-wilhelm.de> <86tu13qydg.fsf@duenenhof-wilhelm.de> <83h6x2u74b.fsf@gnu.org> <863588rfos.fsf@duenenhof-wilhelm.de> <83o7qw0yjy.fsf@gnu.org> <864jskx6a8.fsf@duenenhof-wilhelm.de> <831qnomh6l.fsf@gnu.org> <86wn5anw04.fsf@duenenhof-wilhelm.de> <86h6wboe2v.fsf@duenenhof-wilhelm.de> <86edr59bua.fsf@duenenhof-wilhelm.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38325"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , "60587@debbugs.gnu.org" <60587@debbugs.gnu.org>, Drew Adams To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 05 14:55:08 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 1pOfU4-0009pf-Hg for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 05 Feb 2023 14:55:08 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pOfTz-0003wu-WA; Sun, 05 Feb 2023 08:55:04 -0500 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 1pOfTy-0003wm-VM for bug-gnu-emacs@gnu.org; Sun, 05 Feb 2023 08:55:02 -0500 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 1pOfTy-0004Ny-Mp for bug-gnu-emacs@gnu.org; Sun, 05 Feb 2023 08:55:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pOfTy-0000HL-Ce for bug-gnu-emacs@gnu.org; Sun, 05 Feb 2023 08:55:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: "H. Dieter Wilhelm" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Feb 2023 13:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60587 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 60587-submit@debbugs.gnu.org id=B60587.16756052911045 (code B ref 60587); Sun, 05 Feb 2023 13:55:02 +0000 Original-Received: (at 60587) by debbugs.gnu.org; 5 Feb 2023 13:54:51 +0000 Original-Received: from localhost ([127.0.0.1]:44422 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOfTm-0000Gn-W7 for submit@debbugs.gnu.org; Sun, 05 Feb 2023 08:54:51 -0500 Original-Received: from mout.kundenserver.de ([212.227.17.24]:52175) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOfTk-0000Ga-20 for 60587@debbugs.gnu.org; Sun, 05 Feb 2023 08:54:49 -0500 Original-Received: from ping ([109.250.147.37]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MXH3Y-1p7dvb39h8-00Yl9B; Sun, 05 Feb 2023 14:54:33 +0100 In-Reply-To: (Stefan Monnier's message of "Sat, 04 Feb 2023 22:54:00 -0500") X-Provags-ID: V03:K1:jEJcUzBNuds5cdLvhag7WksGTU+6v3pws2KSchclzSokNWY3v5a NaIh2ZUBZjuEuziSMONztWY80+wYWdforRIQWKTQfDuOLH/ooFLQ1umreKSPAE3v0PsXfQz 024jQMTciKPBT+YGQ3rDtJOFFisP/JtWJhGS8gWH5lcErFE+aioge/JT4XWX/sTzFphhh42 qGYlgSQ4bfp+XVMIMNVPA== UI-OutboundReport: notjunk:1;M01:P0:kVRC4S89OMI=;GQ0nE7Pi7UKzzuamWUkk8gj0M3A sdw9XIF7S7opzknmjVE9oB2Dk0+rtDRLpKuNRTU2hOT8o3ktObESc9otwRSIXwSdaaWWaqYhm 858qePv7HBBPNCCsfDEBTT6+ZTcocgeyQ66ryXF4unkXwxJAohIgrzKevjvXH2MpGk0ge4tgU 43OzNXoOsnhW0tzigYDAPZTZzxKtCytCFOeim7YKe+YknbGB4P8aWUQvvaN3k2jdKvAu4QgDX LY64MtONaJxWuJHA3sc4+Ej2Uadh96apAbpFaoy+kSS+8yGLtanoRYmQTjb3KBGenCn2Z6wrX +0JBn3A5iE8odaqyW01HOOJIqkiKji4WgrjWOSxrJ2l2VJmX2oDwFfub1wqA1aVCjLfFbwLjl ZoeK9eyN/SO8VTQ45FsQAgUQRAEN+qnpTWL8Q6rvy2tlKqZLRaGhoCmWisCKj2SFfrVaE3ttg f8DOzs9jB0nqQoAbWkdA8+k4KUYumRJeVMtGD8sxMHjb1eJtXnORxQmKewUtmgWkHjwy8yNFw XJKFrAHBiUY7A4w/DgEP6fdtdWlu8xY2rskLJVwXmhCMIbc9bPY/28l8Uebdz1fXN0qRsKHvC DycczcL4390gHCoiEirKxWwt7L1oKjAnSON2I3st0rpXnxZBY9YxZeCuSsZD3ryqC+JR77bnh 32tAC7uKFj8lcMs9Jkr+aRsO8XnudBysQKJyJHdOcg== 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:254856 Archived-At: Stefan Monnier writes: >> +(define-minor-mode info-button-mode >> + "The mode creates buttons on symbols linking to their help documentat= ion. >> +..." >> + :init-value nil >> + :lighter " B" >> + :group 'info >> + :version "30.1" > > Since you have not specified `:global t`, this is a buffer-local minor > mode, i.e. each buffer will have its own value of the `info-button-mode` = boolean. > > [ BTW, whether the links look like buttons or not seems rather > incidental, so I think the mode's name should talk about something more > precise than "button". > Maybe something like `info-links-to-help-mode`? ] Indeed, I've changed already the non-descriptive names, thanks. >> + (if (string=3D major-mode "Info-mode") > > `major-mode` contains a symbol, so better do (eq major-mode 'Info-mode). I see, I confused the symbol with its name. (Strange then that my version worked, anyway?) > This said, I don't know why you have that test. Any reason you're > worried about this being called from another buffer? Because this info-links-to-help-mode is useless in all buffers, except.. .. Well, I had blinkers on. Indeed, such a mode might be helpful for buffers except *info*! Thank you. Is it worthwhile to generalise the functionality (maybe later), that is the question? >> + (if info-button-mode >> + (progn >> + (add-hook 'Info-selection-hook 'info-make-button) >> + (info-make-button)) ;for the current buffer >> + (remove-hook 'Info-selection-hook 'info-make-button) > > Here, you install/remove the `info-make-button` function to the global > part of the `Info-selection-hook` so it will affect all Info buffers > rather than just the current one. I guess a user who doesn't like help linking won't appreciate it in all info buffers, cloned or not. > I don't know if this minor mode should be global or buffer-local, but > please try and make it consistent: if it's buffer-local, then it should > only affect the current buffer. Please let me rethink the approach in the light of above discussion. > BTW, the name `info-make-button` suggests it creates a single button > (and provides no info about what kind of button this might be). Yes, it's poor, I improved the name. >> + (setq inhibit-read-only t) >> + (remove-list-of-text-properties (point-min) (point-max) >> + '(button category info-args)) >> + (set-buffer-modified-p nil)) > > I think you wanted to use `with-silent-modifications` here :-) I think so, thank you. =F0=9F=98=8A Dieter --=20 Best wishes H. Dieter Wilhelm Zwingenberg, Germany