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

          Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

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

          Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form