unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Eli Zaretskii <eliz@gnu.org>, Drew Adams <drew.adams@oracle.com>
Cc: 16333@debbugs.gnu.org, stefan@marxist.se
Subject: bug#16333: 24.3.50; Info manuals: link defined terms to their glossary entries
Date: Thu, 29 Oct 2020 10:51:59 -0700 (PDT)	[thread overview]
Message-ID: <1f8767bb-1912-42ea-abba-dd666bea48b0@default> (raw)
In-Reply-To: <<83tuudaz1y.fsf@gnu.org>>

> > It turns out that the text need not exactly start with
> > "mouse-2".
> 
> Yes.
> 
> > Dunno where that text transformation is implemented
> > (in C?) - I didn't find it in the Lisp.
> 
> It's in mouse-fixup-help-message.

Ah, very good.  Thanks.  I grepped and searched a fair
amount, but I missed that.

But I think that shows (what I think I've seen - see
my correction to what I wrote that you replied to)
that the text _does_ need to start with "mouse-2":

  (string-match-p "\\`mouse-2" msg)

BTW, that doc string is not great.  It should mention
`help-echo', I think.  Grep `mouse-fixup-help-message'
finds no uses of it in Lisp.  So it's not clear, but
I'm guessing that it ends up being used indirectly(?)
only(?) by `help-echo'.
___

In any case, could this behavior (if not that function)
please be pointed out in the Elisp manual?  Users
writing help-echo text should be aware of the behavior.
___

Here's a suggestion, to make this less rigid/fragile:
Substitute for "mouse-2" everywhere in the help text,
as follows.

(defun mouse-fixup-help-message (msg)
  "Fix help message MSG for `mouse-1-click-follows-link'."
  (let (mp pos)
    (when (and mouse-1-click-follows-link
               (stringp msg)
               (string-match-p "mouse-2" msg)
               (setq mp  (mouse-pixel-position))
               (consp (setq pos (cdr mp)))
               (car pos) (>= (car pos) 0)
               (cdr pos) (>= (cdr pos) 0)
               (setq pos  (posn-at-x-y (car pos) (cdr pos) (car mp)))
               (windowp (posn-window pos)))
      (with-current-buffer (window-buffer (posn-window pos))
        (when (mouse-on-link-p pos)
          (setq msg  (replace-regexp-in-string
                      "mouse-2"
                      (concat
                       (cond ((eq mouse-1-click-follows-link 'double)
                              "double-")
                             ((and (integerp mouse-1-click-follows-link)
                                   (< mouse-1-click-follows-link 0))
                              "Long ")
                             (t ""))
                       "mouse-1")
                      msg))))))
  msg)
___

Or if you think it's more appropriate for some reason,
then substitute only the first occurrence of "mouse-2".

Of if you think we should let users specify exactly
which occurrences of "mouse-2" to substitute, then
define a formatting escape for that (e.g. "%m"), so
only "mouse-2" occurrences preceded by that escape get
substituted.  E.g., "xxx%mmouse-2" would substitute
the "mouse-2", but "xxxmouse-2" would not.





  parent reply	other threads:[~2020-10-29 17:51 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <<bc491f1f-4a8d-4953-a4aa-fd7c0121c1e6@default>
     [not found] ` <<87pnfk1ozm.fsf@marxist.se>
     [not found]   ` <<835zhc4hor.fsf@gnu.org>
2020-01-15 20:30     ` bug#16333: 24.3.50; Info manuals: link defined terms to their glossary entries Drew Adams
     [not found]   ` <<44a24b90-adf8-41f1-8d06-b35f55f1850c@default>
     [not found]     ` <<cbdf8d05-8ce5-4bc5-a04f-44c1e9b380db@default>
     [not found]       ` <<83tuudaz1y.fsf@gnu.org>
2020-10-29 17:51         ` Drew Adams [this message]
2020-10-30 21:14           ` Drew Adams
2020-10-31  7:03             ` Eli Zaretskii
     [not found] <<<bc491f1f-4a8d-4953-a4aa-fd7c0121c1e6@default>
     [not found] ` <<<87pnfk1ozm.fsf@marxist.se>
     [not found]   ` <<<44a24b90-adf8-41f1-8d06-b35f55f1850c@default>
     [not found]     ` <<<cbdf8d05-8ce5-4bc5-a04f-44c1e9b380db@default>
     [not found]       ` <<<83tuudaz1y.fsf@gnu.org>
     [not found]         ` <<1f8767bb-1912-42ea-abba-dd666bea48b0@default>
     [not found]           ` <<3b9fabae-fbe4-4c4a-b11b-8aad73016ace@default>
     [not found]             ` <<83wnz698rr.fsf@gnu.org>
2020-10-31 17:04               ` Drew Adams
2014-01-03 21:50 Drew Adams
2020-01-15 19:47 ` Stefan Kangas
2020-01-15 19:56   ` Eli Zaretskii
2020-01-15 20:22   ` Drew Adams
2020-10-29  6:52     ` Drew Adams
2020-10-29  6:59       ` Drew Adams
2020-10-29 14:26       ` Eli Zaretskii
2020-10-29 14:40       ` Stefan Kangas
2020-10-29 18:13         ` Drew Adams
2021-10-11 14:02           ` Stefan Kangas
2021-10-11 14:05             ` Lars Ingebrigtsen
2021-10-11 14:32               ` Stefan Kangas
2021-10-11 14:34                 ` Lars Ingebrigtsen
2021-10-11 14:55                   ` Stefan Kangas

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=1f8767bb-1912-42ea-abba-dd666bea48b0@default \
    --to=drew.adams@oracle.com \
    --cc=16333@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=stefan@marxist.se \
    /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).