Article View: gnu.emacs.bug
Article #1609Minibuf window coordinates
From: Joe Wells
Date: Wed, 19 Apr 1989 22:25
Date: Wed, 19 Apr 1989 22:25
42 lines
1671 bytes
1671 bytes
Jeff Peck wrote this:
I don't know what the prompt string is, so we just guess... This
code from sun-fns.el, the "common cases" are `Eval: ', ie 4 char
prompts. If your prompt string is longer, the mouse will still be a
few more chars to the right.
(defun mini-move-point (window x y)
;; -6 is good for most common cases
(mouse-move-point window (- x 6) 0))
If there is a variable holding the current prompt string,
the "6" could be replaced with (length prompt-string) + 1 or + 2
for the punctuation.
Does someone out in GNU-land know the appropriate transformation?
Try this function:
(defun minibuffer-prompt-length ()
"Returns the length of the current minibuffer prompt."
(let ((window (selected-window))
length)
(select-window (minibuffer-window))
(let ((point (point)))
(goto-char (point-min))
(insert-char ?a 200)
(goto-char (point-min))
(vertical-motion 1)
(setq length (- (screen-width) (point)))
(goto-char (point-min))
(delete-char 200)
(goto-char point))
(select-window window)
length))
Enjoy!
--
Joe Wells <jbw@bucsf.bu.edu>
jbw%bucsf.bu.edu@bu-it.bu.edu
...!harvard!bu-cs!bucsf!jbw
Technical Details
Message-ID:
<8904192225.AA07251@banana6000.bu.edu>Path:
arc1-ca.pugleaf.net!utzoo!telly!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!BU-CS.BU.EDU!jbw%bucsf.BU.EDUShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!BU-CS.BU.EDU!jbw%bucsf.BU.EDU From: jbw%bucsf.BU.EDU@BU-CS.BU.EDU (Joe Wells) Newsgroups: gnu.emacs.bug Subject: Minibuf window coordinates Message-ID: <8904192225.AA07251@banana6000.bu.edu> Date: 19 Apr 89 22:25:59 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 42