Understanding CUA Emacs Mode for Click Selection

I am new to Emacs and figuring out how to enable click-change selection. On the EmacsWiki page for CUA Mode , the following code snippet describes how to do this:

;; shift + click select region (define-key global-map (kbd "<S-down-mouse-1>") 'ignore) ; turn off font dialog (define-key global-map (kbd "<S-mouse-1>") 'mouse-set-point) (put 'mouse-set-point 'CUA 'move) 

I do not understand how the last line allows you to choose. I reviewed the definition of put :

 put is a built-in function in `C source code'. (put SYMBOL PROPNAME VALUE) Store SYMBOL PROPNAME property with value VALUE. It can be retrieved with `(get SYMBOL PROPNAME)'. 

and mouse pointer definition:

 mouse-set-point is an interactive compiled Lisp function in `mouse.el'. It is bound to <S-mouse-1>, <triple-mouse-1>, <double-mouse-1>, <mouse-1>. (mouse-set-point EVENT) Move point to the position clicked on with the mouse. This should be bound to a mouse click event type. 

but not one of them gives any clues. I cannot find any variable or function called move , and I also studied the source code of mouse.el, cua-base.el, cua-gmrk.el and cua-rect. email

Can someone explain how the last line works, and how can I find more information myself? Thanks.

+4
source share
1 answer

I did not dig too much in CUA mode, but I understand what you are looking for. "put" is a function for character property lists. In this case, the character is the specified mouse point, and you set the "CUA" property of this character to "move". To read the value of a symbol property, you can use the get function. More detailed documentation can be found in the Elisp reference manual on the GNU web page.

I was looking for references to the CUA property in cua - *. el and of course found it in cua-base.el: (I am using Emacs 23.3.1)

  (defun cua--pre-command-handler-1 () ;; Cancel prefix key timeout if user enters another key. (when cua--prefix-override-timer (if (timerp cua--prefix-override-timer) (cancel-timer cua--prefix-override-timer)) (setq cua--prefix-override-timer nil)) (cond ;; Only symbol commands can have necessary properties ((not (symbolp this-command)) nil) ;; Handle delete-selection property on non-movement commands ((not (eq (get this-command 'CUA) 'move)) 

I think you can understand, from here, what the property is used for. Hope this helps.

+3
source

All Articles