comparison lisp/mouse.el @ 444:576fb035e263 r21-2-37

Import from CVS: tag r21-2-37
author cvs
date Mon, 13 Aug 2007 11:36:19 +0200
parents abe6d1db359e
children 1ccc32a20af4
comparison
equal deleted inserted replaced
443:a8296e22da4e 444:576fb035e263
117 (defun insert-selection (&optional check-cutbuffer-p move-point-event) 117 (defun insert-selection (&optional check-cutbuffer-p move-point-event)
118 "Insert the current selection into buffer at point." 118 "Insert the current selection into buffer at point."
119 (interactive "P") 119 (interactive "P")
120 ;; we fallback to the clipboard if the current selection is not existent 120 ;; we fallback to the clipboard if the current selection is not existent
121 (let ((text (if check-cutbuffer-p 121 (let ((text (if check-cutbuffer-p
122 (or (get-selection-no-error) 122 (or (get-selection-no-error)
123 (get-cutbuffer) 123 (get-cutbuffer)
124 (get-selection-no-error 'CLIPBOARD) 124 (get-selection-no-error 'CLIPBOARD)
125 (error "No selection, clipboard or cut buffer available")) 125 (error "No selection, clipboard or cut buffer available"))
126 (or (get-selection-no-error) 126 (or (get-selection-no-error)
127 (get-selection 'CLIPBOARD))))) 127 (get-selection 'CLIPBOARD)))))
220 EVENT should be the button event that initiated the drag. 220 EVENT should be the button event that initiated the drag.
221 Returns whether a drag was begun." 221 Returns whether a drag was begun."
222 ;; #### barely implemented. 222 ;; #### barely implemented.
223 (when (click-inside-selection-p event) 223 (when (click-inside-selection-p event)
224 (cond ((featurep 'offix) 224 (cond ((featurep 'offix)
225 (offix-start-drag-region 225 (offix-start-drag-region
226 event 226 event
227 (extent-start-position zmacs-region-extent) 227 (extent-start-position zmacs-region-extent)
228 (extent-end-position zmacs-region-extent)) 228 (extent-end-position zmacs-region-extent))
229 t) 229 t)
230 ((featurep 'cde) 230 ((featurep 'cde)
236 236
237 (defun mouse-eval-sexp (click force-window) 237 (defun mouse-eval-sexp (click force-window)
238 "Evaluate the sexp under the mouse. Usually, this is the last sexp before 238 "Evaluate the sexp under the mouse. Usually, this is the last sexp before
239 the click, but if you click on a left paren, then it is the sexp beginning 239 the click, but if you click on a left paren, then it is the sexp beginning
240 with the paren that is evaluated. Also, since strings evaluate to themselves, 240 with the paren that is evaluated. Also, since strings evaluate to themselves,
241 they're fed to re-search-forward and the matched region is highlighted until 241 they're fed to `re-search-forward' and the matched region is highlighted until
242 the mouse button is released. 242 the mouse button is released.
243 243
244 Perhaps the most useful thing about this function is that the evaluation of 244 Perhaps the most useful thing about this function is that the evaluation of
245 the expression which is clicked upon is relative not to the window where you 245 the expression which is clicked upon is relative not to the window where you
246 click, but to the current window and the current position of point. Thus, 246 click, but to the current window and the current position of point. Thus,
341 val))) 341 val)))
342 (setq entry (1- entry))) 342 (setq entry (1- entry)))
343 (switch-to-buffer val)))) 343 (switch-to-buffer val))))
344 344
345 (defun narrow-window-to-region (m n) 345 (defun narrow-window-to-region (m n)
346 "Narrow window to region between point and last mark" 346 "Narrow window to region between point and last mark."
347 (interactive "r") 347 (interactive "r")
348 (save-excursion 348 (save-excursion
349 (save-restriction 349 (save-restriction
350 (if (eq (selected-window) (next-window)) 350 (if (eq (selected-window) (next-window))
351 (split-window)) 351 (split-window))