GNU bug report logs -
#16333
24.3.50; Info manuals: link defined terms to their glossary entries
Previous Next
Reported by: Drew Adams <drew.adams <at> oracle.com>
Date: Fri, 3 Jan 2014 21:51:02 UTC
Severity: wishlist
Tags: wontfix
Found in version 24.3.50
Done: Stefan Kangas <stefan <at> marxist.se>
Bug is archived. No further changes may be made.
Full log
Message #38 received at 16333 <at> debbugs.gnu.org (full text, mbox):
> 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.
Actually, the following is much better. It lets code
use different patterns in different contexts, by binding
the variable.
Should I submit this as a separate bug report, or can it
be considered in the context of this one?
(defvar mouse-fixup-help-replace-regexp
'("\\(?:\\|[[:space:]]\\)\\(mouse-2\\)" . 1)
"Regexp to match \"mouse-2\" in MSG.
The value is a cons (REGEXP . N). Function `mouse-fixup-help-message'
replaces the match of subexpression N, of the text that matches
REGEXP, with \"mouse-1\".")
(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
(car mouse-fixup-help-replace-regexp)
(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 nil nil (cdr mouse-fixup-help-replace-regexp)))))))
msg)
This bug report was last modified 3 years and 223 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.