comparison lisp/subr.el @ 112330:56d3e9c28eb0

Merge from mainline.
author Paul Eggert <eggert@cs.ucla.edu>
date Mon, 17 Jan 2011 11:01:01 -0800
parents cc0887b67703
children aa1e27e3a554
comparison
equal deleted inserted replaced
112329:e36b2f5d36cd 112330:56d3e9c28eb0
851 ;; is this really correct? maybe remove mouse-movement? 851 ;; is this really correct? maybe remove mouse-movement?
852 (memq (event-basic-type object) '(mouse-1 mouse-2 mouse-3 mouse-movement))) 852 (memq (event-basic-type object) '(mouse-1 mouse-2 mouse-3 mouse-movement)))
853 853
854 (defsubst event-start (event) 854 (defsubst event-start (event)
855 "Return the starting position of EVENT. 855 "Return the starting position of EVENT.
856 If EVENT is a mouse or key press or a mouse click, this returns the location 856 EVENT should be a click, drag, or key press event.
857 of the event. 857 If it is a key press event, the return value has the form
858 If EVENT is a drag, this returns the drag's starting position. 858 (WINDOW POS (0 . 0) 0)
859 The return value is of the form 859 If it is a click or drag event, it has the form
860 (WINDOW AREA-OR-POS (X . Y) TIMESTAMP OBJECT POS (COL . ROW) 860 (WINDOW AREA-OR-POS (X . Y) TIMESTAMP OBJECT POS (COL . ROW)
861 IMAGE (DX . DY) (WIDTH . HEIGHT)) 861 IMAGE (DX . DY) (WIDTH . HEIGHT))
862 The `posn-' functions access elements of such lists." 862 The `posn-' functions access elements of such lists.
863 For more information, see Info node `(elisp)Click Events'.
864
865 If EVENT is a mouse or key press or a mouse click, this is the
866 position of the event. If EVENT is a drag, this is the starting
867 position of the drag."
863 (if (consp event) (nth 1 event) 868 (if (consp event) (nth 1 event)
864 (list (selected-window) (point) '(0 . 0) 0))) 869 (list (selected-window) (point) '(0 . 0) 0)))
865 870
866 (defsubst event-end (event) 871 (defsubst event-end (event)
867 "Return the ending location of EVENT. 872 "Return the ending location of EVENT.
868 EVENT should be a click, drag, or key press event. 873 EVENT should be a click, drag, or key press event.
869 If EVENT is a click event, this function is the same as `event-start'. 874 If EVENT is a key press event, the return value has the form
870 The return value is of the form 875 (WINDOW POS (0 . 0) 0)
876 If EVENT is a click event, this function is the same as
877 `event-start'. For click and drag events, the return value has
878 the form
871 (WINDOW AREA-OR-POS (X . Y) TIMESTAMP OBJECT POS (COL . ROW) 879 (WINDOW AREA-OR-POS (X . Y) TIMESTAMP OBJECT POS (COL . ROW)
872 IMAGE (DX . DY) (WIDTH . HEIGHT)) 880 IMAGE (DX . DY) (WIDTH . HEIGHT))
873 The `posn-' functions access elements of such lists." 881 The `posn-' functions access elements of such lists.
882 For more information, see Info node `(elisp)Click Events'.
883
884 If EVENT is a mouse or key press or a mouse click, this is the
885 position of the event. If EVENT is a drag, this is the starting
886 position of the drag."
874 (if (consp event) (nth (if (consp (nth 2 event)) 2 1) event) 887 (if (consp event) (nth (if (consp (nth 2 event)) 2 1) event)
875 (list (selected-window) (point) '(0 . 0) 0))) 888 (list (selected-window) (point) '(0 . 0) 0)))
876 889
877 (defsubst event-click-count (event) 890 (defsubst event-click-count (event)
878 "Return the multi-click count of EVENT, a click or drag event. 891 "Return the multi-click count of EVENT, a click or drag event.
2362 at-home 2375 at-home
2363 ;; Make sure `user-emacs-directory' exists, 2376 ;; Make sure `user-emacs-directory' exists,
2364 ;; unless we're in batch mode or dumping Emacs 2377 ;; unless we're in batch mode or dumping Emacs
2365 (or noninteractive 2378 (or noninteractive
2366 purify-flag 2379 purify-flag
2367 (file-accessible-directory-p (directory-file-name user-emacs-directory)) 2380 (file-accessible-directory-p
2368 (make-directory user-emacs-directory)) 2381 (directory-file-name user-emacs-directory))
2382 (let ((umask (default-file-modes)))
2383 (unwind-protect
2384 (progn
2385 (set-default-file-modes ?\700)
2386 (make-directory user-emacs-directory))
2387 (set-default-file-modes umask))))
2369 (abbreviate-file-name 2388 (abbreviate-file-name
2370 (expand-file-name new-name user-emacs-directory)))))) 2389 (expand-file-name new-name user-emacs-directory))))))
2371
2372 2390
2373 ;;;; Misc. useful functions. 2391 ;;;; Misc. useful functions.
2374 2392
2375 (defun find-tag-default () 2393 (defun find-tag-default ()
2376 "Determine default tag to search for, based on text at point. 2394 "Determine default tag to search for, based on text at point.