How to access mouse event coordinates? (conveniently)How can I simulate an arbitary key event from Elisp?Control or set the emacs mouse button event polling rate?How to get the string representation of a keymap event?Generate mouse-2 event from MacBook trackpadmouse-wheel-follow-mouse for horizontal scrolling?xterm-mouse-mode use mouse on clickable textselisp - detect line change event to trigger functionMouse wheel not working with new mouseRemap input event in all contextsUse mouse buttons as modifiers

"It is what it is" in French

Dedicated to our #1 Fan

What is "ass door"?

Why can't a country print its own money to spend it only abroad?

Can't understand how static works exactly

On the history of Haar measure

How can I show that the speed of light in vacuum is the same in all reference frames?

Ultraproduct of Dividing Lines

Are there any documented cases of extinction of a species of fungus?

Company requiring me to let them review research from before I was hired

Does Impedance Matching Imply any Practical RF Transmitter Must Waste >=50% of Energy?

Considerations when providing money to one child now, and the other later?

Why do people say "I am broke" instead of "I am broken"?

Chemistry Riddle

Can GPL and BSD licensed applications be used for government work?

Are gangsters hired to attack people at a train station classified as a terrorist attack?

Is there a way to shorten this while condition?

Why are Oscar, India, and X-Ray (O, I, and X) not used as taxiway identifiers?

How to Sow[] until I've Reap[]'d enough?

Adding gears to my grandson's 12" bike

Short story where a flexible reality hardens to an unchanging one

Why did computer video outputs go from digital to analog, then back to digital?

Was US film used in Luna 3?

Extrapolation v. Interpolation



How to access mouse event coordinates? (conveniently)


How can I simulate an arbitary key event from Elisp?Control or set the emacs mouse button event polling rate?How to get the string representation of a keymap event?Generate mouse-2 event from MacBook trackpadmouse-wheel-follow-mouse for horizontal scrolling?xterm-mouse-mode use mouse on clickable textselisp - detect line change event to trigger functionMouse wheel not working with new mouseRemap input event in all contextsUse mouse buttons as modifiers






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















When getting events from (read-event) it's possible to access only mouse events using (mouse-movement-p event).



Inspecting the events I've found I can get the Y pixel location using (cdr (nth 2 (nth 1 event)) however this seems overly cryptic.



What is a good way to access data in mouse motion events?










share|improve this question






























    1















    When getting events from (read-event) it's possible to access only mouse events using (mouse-movement-p event).



    Inspecting the events I've found I can get the Y pixel location using (cdr (nth 2 (nth 1 event)) however this seems overly cryptic.



    What is a good way to access data in mouse motion events?










    share|improve this question


























      1












      1








      1








      When getting events from (read-event) it's possible to access only mouse events using (mouse-movement-p event).



      Inspecting the events I've found I can get the Y pixel location using (cdr (nth 2 (nth 1 event)) however this seems overly cryptic.



      What is a good way to access data in mouse motion events?










      share|improve this question
















      When getting events from (read-event) it's possible to access only mouse events using (mouse-movement-p event).



      Inspecting the events I've found I can get the Y pixel location using (cdr (nth 2 (nth 1 event)) however this seems overly cryptic.



      What is a good way to access data in mouse motion events?







      mouse events






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jul 14 at 9:52







      ideasman42

















      asked Jul 14 at 7:16









      ideasman42ideasman42

      1,9277 silver badges26 bronze badges




      1,9277 silver badges26 bronze badges




















          1 Answer
          1






          active

          oldest

          votes


















          3














          There is a list of functions with the posn prefix to extract that information and more from mouse events. One caveat is that many of them require a start/end event:



          (let ((e (read-event)))
          (when (mouse-event-p e)
          (let ((x-y (posn-x-y (event-start e))))
          (message "Mouse event at: %d|%d" (car x-y) (cdr x-y)))))





          share|improve this answer























          • How to access pixel coordinates?

            – ideasman42
            Jul 14 at 11:59











          • Wasamasa answered exactly the question in your comment, no? C-h f posn-x-y.

            – Drew
            Jul 14 at 14:14













          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "583"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2femacs.stackexchange.com%2fquestions%2f51596%2fhow-to-access-mouse-event-coordinates-conveniently%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3














          There is a list of functions with the posn prefix to extract that information and more from mouse events. One caveat is that many of them require a start/end event:



          (let ((e (read-event)))
          (when (mouse-event-p e)
          (let ((x-y (posn-x-y (event-start e))))
          (message "Mouse event at: %d|%d" (car x-y) (cdr x-y)))))





          share|improve this answer























          • How to access pixel coordinates?

            – ideasman42
            Jul 14 at 11:59











          • Wasamasa answered exactly the question in your comment, no? C-h f posn-x-y.

            – Drew
            Jul 14 at 14:14















          3














          There is a list of functions with the posn prefix to extract that information and more from mouse events. One caveat is that many of them require a start/end event:



          (let ((e (read-event)))
          (when (mouse-event-p e)
          (let ((x-y (posn-x-y (event-start e))))
          (message "Mouse event at: %d|%d" (car x-y) (cdr x-y)))))





          share|improve this answer























          • How to access pixel coordinates?

            – ideasman42
            Jul 14 at 11:59











          • Wasamasa answered exactly the question in your comment, no? C-h f posn-x-y.

            – Drew
            Jul 14 at 14:14













          3












          3








          3







          There is a list of functions with the posn prefix to extract that information and more from mouse events. One caveat is that many of them require a start/end event:



          (let ((e (read-event)))
          (when (mouse-event-p e)
          (let ((x-y (posn-x-y (event-start e))))
          (message "Mouse event at: %d|%d" (car x-y) (cdr x-y)))))





          share|improve this answer













          There is a list of functions with the posn prefix to extract that information and more from mouse events. One caveat is that many of them require a start/end event:



          (let ((e (read-event)))
          (when (mouse-event-p e)
          (let ((x-y (posn-x-y (event-start e))))
          (message "Mouse event at: %d|%d" (car x-y) (cdr x-y)))))






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jul 14 at 10:01









          wasamasawasamasa

          16.2k1 gold badge40 silver badges71 bronze badges




          16.2k1 gold badge40 silver badges71 bronze badges












          • How to access pixel coordinates?

            – ideasman42
            Jul 14 at 11:59











          • Wasamasa answered exactly the question in your comment, no? C-h f posn-x-y.

            – Drew
            Jul 14 at 14:14

















          • How to access pixel coordinates?

            – ideasman42
            Jul 14 at 11:59











          • Wasamasa answered exactly the question in your comment, no? C-h f posn-x-y.

            – Drew
            Jul 14 at 14:14
















          How to access pixel coordinates?

          – ideasman42
          Jul 14 at 11:59





          How to access pixel coordinates?

          – ideasman42
          Jul 14 at 11:59













          Wasamasa answered exactly the question in your comment, no? C-h f posn-x-y.

          – Drew
          Jul 14 at 14:14





          Wasamasa answered exactly the question in your comment, no? C-h f posn-x-y.

          – Drew
          Jul 14 at 14:14

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Emacs Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2femacs.stackexchange.com%2fquestions%2f51596%2fhow-to-access-mouse-event-coordinates-conveniently%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

          Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

          Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?