File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55; ; Author: Nidish Narayanaa Balaji <nidbid@gmail.com>
66; ; Keywords: tex, mouse
77; ; Version: 0.0.1
8- ; ; Package-Requires: ((emacs "25.1") (company-auctex "20200529.1835") )
8+ ; ; Package-Requires: ((emacs "25.1"))
99; ; URL: https://github.com/Nidish96/cart.el
1010
1111; ; This program is free software; you can redistribute it and/or modify
@@ -72,6 +72,10 @@ The behavior will be identical across sessions if these are saved."
7272 (cons (cart--key " t" ) #'cart-translate-tikz )
7373 (cons (cart--key " r" ) #'cart-rotate-tikz )))
7474
75+ (defun cart--car-or (ARG )
76+ " Return car of ARG if ARG is a cons, ARG otherwise."
77+ (if (consp ARG) (car ARG) ARG))
78+
7579(defun cart--gmc (&optional prompt )
7680 " Prompt to click on frame and return the xy coordinates.
7781Two behaviors are possible: (if clicked) single point returned as a
@@ -80,7 +84,8 @@ dragged region returned as a list of two point-lists (as above).
8084
8185The optional parameter PROMPT allows one to specify a user-facing
8286prompt. The prompt defaults to 'Click anywhere' if not provided."
83- (if (string-equal (car-or (read-event (or prompt " Click anywhere" )))
87+ (if (string-equal (cart--car-or (read-event
88+ (or prompt " Click anywhere" )))
8489 " down-mouse-1" )
8590 (let* ((event (read-event )) ; ; read the mouse up/drag event
8691 (pos (event-start event))
Original file line number Diff line number Diff line change 1212 ;; Author: Nidish Narayanaa Balaji <nidbid@gmail.com>
1313 ;; Keywords: tex, mouse
1414 ;; Version: 0.0.1
15- ;; Package-Requires: ((emacs "25.1") (company-auctex "20200529.1835") )
15+ ;; Package-Requires: ((emacs "25.1"))
1616 ;; URL: https://github.com/Nidish96/cart.el
1717
1818 ;; This program is free software; you can redistribute it and/or modify
8686
8787** Define functions for getting coordinates on screen
8888#+begin_src emacs-lisp :tangle yes :results none
89+ (defun cart--car-or (ARG)
90+ "Return car of ARG if ARG is a cons, ARG otherwise."
91+ (if (consp ARG) (car ARG) ARG))
92+
8993 (defun cart--gmc (&optional prompt)
9094 "Prompt to click on frame and return the xy coordinates.
9195 Two behaviors are possible: (if clicked) single point returned as a
9498
9599 The optional parameter PROMPT allows one to specify a user-facing
96100 prompt. The prompt defaults to 'Click anywhere' if not provided."
97- (if (string-equal (car-or (read-event (or prompt "Click anywhere")))
101+ (if (string-equal (cart--car-or (read-event
102+ (or prompt "Click anywhere")))
98103 "down-mouse-1")
99104 (let* ((event (read-event)) ;; read the mouse up/drag event
100105 (pos (event-start event))
You can’t perform that action at this time.
0 commit comments