bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#9054: [External] : bug#9054: 24.0.50; show source in other window


From: Drew Adams
Subject: bug#9054: [External] : bug#9054: 24.0.50; show source in other window
Date: Wed, 22 Sep 2021 15:17:02 +0000

>> I've no special comment on this.  In general, in my
>> case if a particular kind of thing under the pointer
>> isn't defined then the menu item is inactive for
>> that thing kind.
> 
> With context menus we have to find a compromise: Searching manuals or
> the code base at the time of displaying the menu might take too long.

Sorry, I don't understand.  I probably can't help you
with what you're trying to do.  I don't know what
searching you're talking about.

All I do is check whether there is such a thing-at-point.
If not, I don't enable the menu item for acting on that
kind of thing-at-point.

When I say "thing-at-point" here, a given test could use
the thingatpt.el code (or similar), or it could use other
code, such as ffap tests.  E.g., for a file or dir I use
this (wrapped in `ignore-errors'):

 (defun mouse3-file-or-dir ()
  "Return file or dir name at point.  Raise error if none."
  (let ((guess  (ffap-guesser)))
    (unless (and guess
                 (or (ffap-file-remote-p guess)
                     (file-directory-p
                       (abbreviate-file-name
                         (expand-file-name guess)))
                     (file-regular-p guess)))
      (error "No file or dir name under mouse pointer"))
    guess))

For Describe Function I use this for :enable:
(or (fboundp (symbol-at-point))  (function-called-at-point))

For Show Code Defining Function I use this:
(function-called-at-point)

And so on.  Are you worried that such :enable tests
"search manuals or the code base"?  I don't see how
they do.  But in any case, I don't see any delay in
displaying the menu.

>  > Whether, for a name such as `x' you want to try to
>  > look it up as a variable and a function etc. and
>  > then activate relevant items, do so.  I'm not sure
>  > it's worth such lookups, and of course there's the
>  > question of which context/environment to look up
>  > such things in.
> 
> If I evaluate (setq x 3) and then I'm told that x was "Probably
> introduced at or before Emacs version 1.4" something went wrong.

Sorry, I don't follow you.  It doesn't matter whether
I do.  Do whatever you intend to do.  I just wanted
to share what I do, in case it helps.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]