unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Philip Kaludercic <philipk@posteo.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: larsi@gnus.org, 52973@debbugs.gnu.org, juri@linkov.net
Subject: bug#52973: Adding a few context-menu-mode commands
Date: Sat, 08 Jan 2022 19:39:41 +0000	[thread overview]
Message-ID: <87r19i3tky.fsf@posteo.net> (raw)
In-Reply-To: <83r19i2gcu.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 08 Jan 2022 21:10:41 +0200")

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Philip Kaludercic <philipk@posteo.net>
>> Cc: Juri Linkov <juri@linkov.net>, 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





  reply	other threads:[~2022-01-08 19:39 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-03  8:34 bug#52973: Adding a few context-menu-mode commands Philip Kaludercic
2022-01-03 12:45 ` Eli Zaretskii
2022-01-03 13:52   ` Philip Kaludercic
2022-01-03 14:32     ` Eli Zaretskii
2022-01-03 17:23       ` Philip Kaludercic
2022-01-03 17:36         ` Eli Zaretskii
2022-01-03 21:17         ` Juri Linkov
2022-01-04 12:26           ` Eli Zaretskii
2022-01-04 17:46             ` Juri Linkov
2022-01-04 20:01               ` Eli Zaretskii
2022-01-04 20:08                 ` Philip Kaludercic
2022-01-04 20:15                   ` Eli Zaretskii
2022-01-05 19:09                     ` Juri Linkov
2022-01-05 19:29                       ` Eli Zaretskii
2022-01-05 20:57                         ` Juri Linkov
2022-01-06  6:54                           ` Eli Zaretskii
2022-01-06  8:20                             ` Juri Linkov
2022-01-06  9:10                               ` Eli Zaretskii
2022-01-03 21:12 ` Juri Linkov
2022-01-04 19:39   ` Philip Kaludercic
2022-01-05 18:58     ` Juri Linkov
2022-01-05 20:14       ` Philip Kaludercic
2022-01-06  8:17         ` Juri Linkov
2022-01-06 18:59           ` Philip Kaludercic
2022-01-06 20:03             ` Juri Linkov
2022-01-06 20:32               ` Eli Zaretskii
2022-01-06 20:35                 ` Juri Linkov
2022-01-07  6:38                   ` Eli Zaretskii
2022-01-07  6:46                     ` Lars Ingebrigtsen
2022-01-07  8:20                       ` Eli Zaretskii
2022-01-07  8:29                     ` Philip Kaludercic
2022-01-07  8:37                       ` Eli Zaretskii
2022-01-08 18:30                         ` Juri Linkov
2022-01-08 18:44                           ` Eli Zaretskii
2022-01-08 19:01                             ` Philip Kaludercic
2022-01-08 19:10                               ` Eli Zaretskii
2022-01-08 19:39                                 ` Philip Kaludercic [this message]
2022-01-08 20:09                                   ` Eli Zaretskii
2022-01-12  6:16                           ` Lars Ingebrigtsen
2022-01-12 13:12                             ` Eli Zaretskii
2022-01-12 17:16                               ` Juri Linkov
2022-01-12 17:36                                 ` Eli Zaretskii
2022-01-12 18:03                                   ` Juri Linkov
2022-01-12 19:27                                     ` Eli Zaretskii
2022-01-12 19:41                                       ` Juri Linkov
2022-01-12 19:53                                         ` Eli Zaretskii
2022-01-12 20:00                                           ` Juri Linkov
2022-01-12 20:42                                             ` Eli Zaretskii
2022-01-13  8:39                                               ` Juri Linkov
2022-01-13 10:06                                                 ` Eli Zaretskii
2022-01-13  6:03                                 ` Lars Ingebrigtsen
2022-01-13  8:35                                   ` Juri Linkov
2022-01-13  8:53                                     ` Lars Ingebrigtsen
2022-01-13  9:10                                       ` Juri Linkov
2022-01-13  9:23                                         ` Lars Ingebrigtsen
2022-01-13 10:11                                         ` Eli Zaretskii
2022-01-13  8:54                                   ` Eli Zaretskii
2022-01-06 20:19             ` Lars Ingebrigtsen
2022-01-06 20:32               ` Juri Linkov
2022-01-22 19:39             ` Philip Kaludercic
2022-01-23  9:08               ` Juri Linkov
2022-01-23 12:09                 ` Philip Kaludercic
2022-01-23 12:13                   ` Lars Ingebrigtsen
2022-01-23 16:30                     ` Philip Kaludercic
2022-01-23 18:06                       ` Juri Linkov
2022-01-23 19:49                         ` Philip Kaludercic
2022-01-23 20:04                           ` Juri Linkov
2022-01-24  9:14                       ` Lars Ingebrigtsen
2022-01-25 12:06                         ` Philip Kaludercic
2022-01-25 12:24                           ` Lars Ingebrigtsen
2022-01-04 20:09   ` Philip Kaludercic
2022-01-05 19:03     ` Juri Linkov
2022-01-14  8:52 ` Lars Ingebrigtsen
2022-01-14 14:33   ` Philip Kaludercic
2022-01-15  8:07     ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r19i3tky.fsf@posteo.net \
    --to=philipk@posteo.net \
    --cc=52973@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=juri@linkov.net \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).