From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#52973: Adding a few context-menu-mode commands Date: Sat, 08 Jan 2022 19:39:41 +0000 Message-ID: <87r19i3tky.fsf@posteo.net> References: <87o84tp69h.fsf@posteo.net> <868rvwsezi.fsf@mail.linkov.net> <87czl75lyz.fsf@posteo.net> <86czl6au29.fsf@mail.linkov.net> <874k6idjod.fsf@posteo.net> <86o84pthgp.fsf@mail.linkov.net> <87pmp4lmfz.fsf@posteo.net> <86pmp41vby.fsf@mail.linkov.net> <83czl47ghd.fsf@gnu.org> <86ee5kzjo2.fsf@mail.linkov.net> <83bl0o6oei.fsf@gnu.org> <87iluwkkyn.fsf@posteo.net> <83k0fc54bd.fsf@gnu.org> <86bl0m13o1.fsf@mail.linkov.net> <83v8yu2hkq.fsf@gnu.org> <875yqu59wl.fsf@posteo.net> <83r19i2gcu.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4474"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, 52973@debbugs.gnu.org, juri@linkov.net To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 08 20:41:24 2022 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 1n6Had-0000z7-8Y for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 08 Jan 2022 20:41:23 +0100 Original-Received: from localhost ([::1]:46552 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n6Hac-00022D-8h for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 08 Jan 2022 14:41:22 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:41700) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n6HaJ-00021l-KF for bug-gnu-emacs@gnu.org; Sat, 08 Jan 2022 14:41:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55840) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n6HZJ-00084N-Ld for bug-gnu-emacs@gnu.org; Sat, 08 Jan 2022 14:40:43 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n6HZJ-0003XY-J1 for bug-gnu-emacs@gnu.org; Sat, 08 Jan 2022 14:40:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 08 Jan 2022 19:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52973 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 52973-submit@debbugs.gnu.org id=B52973.164167079213585 (code B ref 52973); Sat, 08 Jan 2022 19:40:01 +0000 Original-Received: (at 52973) by debbugs.gnu.org; 8 Jan 2022 19:39:52 +0000 Original-Received: from localhost ([127.0.0.1]:48743 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n6HZA-0003X3-7P for submit@debbugs.gnu.org; Sat, 08 Jan 2022 14:39:52 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]:34017) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n6HZ7-0003Wj-PK for 52973@debbugs.gnu.org; Sat, 08 Jan 2022 14:39:50 -0500 Original-Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id DC9F324002A for <52973@debbugs.gnu.org>; Sat, 8 Jan 2022 20:39:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1641670783; bh=A66HNQiyk0s5xO3uEnlgPULIGMCn4nAL7BnVMpwwYrU=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=F0azN4CZAPyiZ7vwdGciOSLHCTrfSUnytz9C94erVcmb+PldVGVepRCOOly4tkjJP Voua28jDdP8YUKQxxlmZgmG4CqA/Pk0IksAZErBKh6TWFL/SUPe5E7mBuheqTe8c/P L7X15D6BfhVrwSXW/Di4VHBXQIcX/SKJi4wQevbhnobkgFsfnURn4wKqcHCtwaogW6 tAKIpIMqyI6J6i0zy6jwZzbegYBJWzba9qK8L4U/rCHzP1uxYJqwpfJj1zSCNNkHEu rwM0GW2gqxMj+OHJ/CcnwsgXliQwuoUZyoGnsDJc1WZplbrzXHk7bVj9klEQvm16s5 Xn8TJP31vcYgA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4JWVly3PjMz6tp9; Sat, 8 Jan 2022 20:39:42 +0100 (CET) Autocrypt: addr=philipk@posteo.net; prefer-encrypt=nopreference; keydata= mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB In-Reply-To: <83r19i2gcu.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 08 Jan 2022 21:10:41 +0200") 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" Xref: news.gmane.io gmane.emacs.bugs:223825 Archived-At: Eli Zaretskii writes: >> From: Philip Kaludercic >> Cc: Juri Linkov , larsi@gnus.org, >> 52973@debbugs.gnu.org >> Date: Sat, 08 Jan 2022 19:01:46 +0000 >> >> > The way I see it, the functions in man.el are for Man-mode, and those >> > in hi-lock.el are for hi-lock-mode. >> >> No, the Man functions can be used anywhere you want to read a man page. >> It checks if the user clicked on something like "emacs(1)", then inserts >> a entry into the context menu to open the man page at point. > > So it will suggest to show a man page when text like this one from the > ELisp manual is displayed: > > To conserve memory, Emacs does not hold fixed-length 22-bit numbers > that are codepoints of text characters within buffers and strings. > Rather, Emacs uses a variable-length internal representation of > characters, that stores each character as a sequence of 1 to 5 8-bit > bytes, depending on the magnitude of its codepoint(1). > > When the user displays a man page, the probability that "foo(1)" > references a man page is very high. Yes, but in that case Man-mode should have already inserted a link that you can just click on, without the need for a context-menu. > In any other major mode, it is likely to be a false positive. For > example, it could be an array reference in Fortran or Matlab, or a > function call in C or C++. I fail to see how this kind of guesswork > can be a good idea if it mostly fails. True, that could be improved, either by actually additionally checking if a man pages exists or by restricting the context menu to only operate on comments. Either way, my intention was to provide context menu entries outside of Man-mode. >> The hi-lock functions can be used to highlight a symbol, just like with >> `M-s h .'. Requiring hi-lock-mode to be enabled beforehand would be >> counterproductive. > > Why is it counterproductive, if you are going to activate it anyway, > the first time the user clicks? (It might be that we are misunderstanding one another right now, so I will be verbose.) If you have nothing highlighted, hi-lock-mode is disabled. By clicking on a symbol, an entry is added to the context menu to highlight the symbol. If this were only to be done if hi-lock-mode is enabled, you couldn't highlight anything, unless you had previously already highlighted something without use of the context menu. The reasoning is basically the same as why highlight-symbol-at-point is bound to the global map and not to hi-lock-map. >> >> When the global value of context-menu-functions >> >> contains one of the proposed functions, right-clicking anywhere >> >> will autoload every package where such context functions are defined. >> > >> > This is over-engineered, IMO. There should be no need for such >> > complexity. >> >> What would you suggest to simplify this? > > See above. -- Philip Kaludercic