From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#60587: Patch for adding links to symbols' help documentation Date: Sat, 04 Feb 2023 22:54:00 -0500 Message-ID: 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> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13127"; 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: "H. Dieter Wilhelm" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 05 04:55:21 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 1pOW7d-0003Gl-4S for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 05 Feb 2023 04:55:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pOW7O-0007FO-Ka; Sat, 04 Feb 2023 22:55:06 -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 1pOW7L-0007FC-IB for bug-gnu-emacs@gnu.org; Sat, 04 Feb 2023 22:55:03 -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 1pOW7L-0000jh-9a for bug-gnu-emacs@gnu.org; Sat, 04 Feb 2023 22:55:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pOW7K-0007yg-Ii for bug-gnu-emacs@gnu.org; Sat, 04 Feb 2023 22:55:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Feb 2023 03: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.167556925830606 (code B ref 60587); Sun, 05 Feb 2023 03:55:02 +0000 Original-Received: (at 60587) by debbugs.gnu.org; 5 Feb 2023 03:54:18 +0000 Original-Received: from localhost ([127.0.0.1]:43734 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOW6c-0007xa-8g for submit@debbugs.gnu.org; Sat, 04 Feb 2023 22:54:18 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:59155) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOW6Z-0007xL-Cu for 60587@debbugs.gnu.org; Sat, 04 Feb 2023 22:54:16 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 2BC8F802A4; Sat, 4 Feb 2023 22:54:08 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 7897180861; Sat, 4 Feb 2023 22:54:02 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1675569242; bh=CZKukd/K66YHg+JbSGBbIUccuDxF/txdu4NKm7va9S4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=Fgb9yDGUwSnvqMgy/W2iihD04vjSuQy0J/QDsAq983LTvqJiP7Fj/XEG1v1piVQec lOi6mfHb4q3TT8pxaxEttEntaIe/Zc3PovMyTK9ZaFAjP+PnfgbMev/v3LQ3VhGz1o CaIKizGGKLSR2oR1qPQYDHeUuGZ9tx6txQQqwDl70rKWHkSoCnaCpzvkG3r85DaJPX r2cURgcMQnbC2c292pD84GQOfeHsrm1ehQfHypu+LKIGAo5V8BihmvuwgDOchppeCl qzjySemZkkxq6OPR3WClBjlE67XJMzxoamqSAkCZDM8H+EcqCZoIWnFaIVnHUPYwLu e3ABqEP8baqFw== Original-Received: from pastel (76-10-137-88.dsl.teksavvy.com [76.10.137.88]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id D7578122476; Sat, 4 Feb 2023 22:54:01 -0500 (EST) In-Reply-To: <86edr59bua.fsf@duenenhof-wilhelm.de> (H. Dieter Wilhelm's message of "Sun, 05 Feb 2023 01:48:13 +0100") 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:254811 Archived-At: > +(define-minor-mode info-button-mode > + "The mode creates buttons on symbols linking to their help documentation. > + > +" > + :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`? ] > + (if (string= major-mode "Info-mode") `major-mode` contains a symbol, so better do (eq major-mode 'Info-mode). This said, I don't know why you have that test. Any reason you're worried about this being called from another buffer? > + (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 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. BTW, the name `info-make-button` suggests it creates a single button (and provides no info about what kind of button this might be). > + (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 :-) Stefan