# HG changeset patch # User joakim@verona.se # Date 1282334400 -7200 # Node ID 373abedd1f026a7cc03b2e988a6c770485246250 # Parent fd080c6fcd863cf10a294ef481161753630bf6e5# Parent c15a51661b50182a7ea6f9ec06389e88cea75d26 merge from upstream diff -r fd080c6fcd86 -r 373abedd1f02 etc/NEWS --- a/etc/NEWS Fri Aug 20 21:55:21 2010 +0200 +++ b/etc/NEWS Fri Aug 20 22:00:00 2010 +0200 @@ -453,6 +453,8 @@ * Lisp changes in Emacs 24.1 +** New hook post-self-insert-hook run at the end of self-insert-command. + ** Syntax tables support a new "comment style c" additionally to style b. ** frame-local variables cannot be let-bound any more. ** prog-mode is a new major-mode meant to be the parent of programming mode. diff -r fd080c6fcd86 -r 373abedd1f02 lisp/ChangeLog --- a/lisp/ChangeLog Fri Aug 20 21:55:21 2010 +0200 +++ b/lisp/ChangeLog Fri Aug 20 22:00:00 2010 +0200 @@ -1,3 +1,15 @@ +2010-08-19 Stefan Monnier + + * files.el (locate-file-completion-table): Only list the .el and .elc + extensions if there's no other choice (bug#5955). + + * facemenu.el (facemenu-self-insert-data): New var. + (facemenu-post-self-insert-function, facemenu-set-self-insert-face): + New functions. + (facemenu-add-face): Use them. + + * simple.el (blink-matching-open): Obey forward-sexp-function. + 2010-08-18 Stefan Monnier * simple.el (prog-mode-map): New var. diff -r fd080c6fcd86 -r 373abedd1f02 lisp/facemenu.el --- a/lisp/facemenu.el Fri Aug 20 21:55:21 2010 +0200 +++ b/lisp/facemenu.el Fri Aug 20 22:00:00 2010 +0200 @@ -699,6 +699,22 @@ (cond ((equal a b) t) ((equal (color-values a) (color-values b))))) + +(defvar facemenu-self-insert-data nil) + +(defun facemenu-post-self-insert-function () + (when (and (car facemenu-self-insert-data) + (eq last-command (cdr facemenu-self-insert-data))) + (put-text-property (1- (point)) (point) + 'face (car facemenu-self-insert-data)) + (setq facemenu-self-insert-data nil)) + (remove-hook 'post-self-insert-hook 'facemenu-post-self-insert-function)) + +(defun facemenu-set-self-insert-face (face) + "Arrange for the next self-inserted char to have face `face'." + (setq facemenu-self-insert-data (cons face this-command)) + (add-hook 'post-self-insert-hook 'facemenu-post-self-insert-function)) + (defun facemenu-add-face (face &optional start end) "Add FACE to text between START and END. If START is nil or START to END is empty, add FACE to next typed character @@ -712,51 +728,52 @@ text property. Otherwise, selecting the default face would not have any effect. See `facemenu-remove-face-function'." (interactive "*xFace: \nr") - (if (and (eq face 'default) - (not (eq facemenu-remove-face-function t))) - (if facemenu-remove-face-function - (funcall facemenu-remove-face-function start end) - (if (and start (< start end)) - (remove-text-properties start end '(face default)) - (setq self-insert-face 'default - self-insert-face-command this-command))) - (if facemenu-add-face-function - (save-excursion - (if end (goto-char end)) - (save-excursion - (if start (goto-char start)) - (insert-before-markers - (funcall facemenu-add-face-function face end))) - (if facemenu-end-add-face - (insert (if (stringp facemenu-end-add-face) - facemenu-end-add-face - (funcall facemenu-end-add-face face))))) + (cond + ((and (eq face 'default) + (not (eq facemenu-remove-face-function t))) + (if facemenu-remove-face-function + (funcall facemenu-remove-face-function start end) (if (and start (< start end)) - (let ((part-start start) part-end) - (while (not (= part-start end)) - (setq part-end (next-single-property-change part-start 'face - nil end)) - (let ((prev (get-text-property part-start 'face))) - (put-text-property part-start part-end 'face - (if (null prev) - face - (facemenu-active-faces - (cons face - (if (listp prev) - prev - (list prev))) - ;; Specify the selected frame - ;; because nil would mean to use - ;; the new-frame default settings, - ;; and those are usually nil. - (selected-frame))))) - (setq part-start part-end))) - (setq self-insert-face (if (eq last-command self-insert-face-command) - (cons face (if (listp self-insert-face) - self-insert-face - (list self-insert-face))) - face) - self-insert-face-command this-command)))) + (remove-text-properties start end '(face default)) + (facemenu-set-self-insert-face 'default)))) + (facemenu-add-face-function + (save-excursion + (if end (goto-char end)) + (save-excursion + (if start (goto-char start)) + (insert-before-markers + (funcall facemenu-add-face-function face end))) + (if facemenu-end-add-face + (insert (if (stringp facemenu-end-add-face) + facemenu-end-add-face + (funcall facemenu-end-add-face face)))))) + ((and start (< start end)) + (let ((part-start start) part-end) + (while (not (= part-start end)) + (setq part-end (next-single-property-change part-start 'face + nil end)) + (let ((prev (get-text-property part-start 'face))) + (put-text-property part-start part-end 'face + (if (null prev) + face + (facemenu-active-faces + (cons face + (if (listp prev) + prev + (list prev))) + ;; Specify the selected frame + ;; because nil would mean to use + ;; the new-frame default settings, + ;; and those are usually nil. + (selected-frame))))) + (setq part-start part-end)))) + (t + (facemenu-set-self-insert-face + (if (eq last-command (cdr facemenu-self-insert-data)) + (cons face (if (listp (car facemenu-self-insert-data)) + (car facemenu-self-insert-data) + (list (car facemenu-self-insert-data)))) + face)))) (unless (facemenu-enable-faces-p) (message "Font-lock mode will override any faces you set in this buffer"))) diff -r fd080c6fcd86 -r 373abedd1f02 lisp/files.el --- a/lisp/files.el Fri Aug 20 21:55:21 2010 +0200 +++ b/lisp/files.el Fri Aug 20 22:00:00 2010 +0200 @@ -757,21 +757,44 @@ (let ((x (file-name-directory suffix))) (if x (1- (length x)) (length suffix)))))) (t - (let ((names nil) + (let ((names '()) + ;; If we have files like "foo.el" and "foo.elc", we could load one of + ;; them with "foo.el", "foo.elc", or "foo", where just "foo" is the + ;; preferred way. So if we list all 3, that gives a lot of redundant + ;; entries for the poor soul looking just for "foo". OTOH, sometimes + ;; the user does want to pay attention to the extension. We try to + ;; diffuse this tension by stripping the suffix, except when the + ;; result is a single element (i.e. usually we only list "foo" unless + ;; it's the only remaining element in the list, in which case we do + ;; list "foo", "foo.elc" and "foo.el"). + (fullnames '()) (suffix (concat (regexp-opt suffixes t) "\\'")) (string-dir (file-name-directory string)) (string-file (file-name-nondirectory string))) (dolist (dir dirs) - (unless dir - (setq dir default-directory)) - (if string-dir (setq dir (expand-file-name string-dir dir))) - (when (file-directory-p dir) - (dolist (file (file-name-all-completions - string-file dir)) - (push file names) - (when (string-match suffix file) - (setq file (substring file 0 (match-beginning 0))) - (push file names))))) + (unless dir + (setq dir default-directory)) + (if string-dir (setq dir (expand-file-name string-dir dir))) + (when (file-directory-p dir) + (dolist (file (file-name-all-completions + string-file dir)) + (if (not (string-match suffix file)) + (push file names) + (push file fullnames) + (push (substring file 0 (match-beginning 0)) names))))) + ;; Switching from names to names+fullnames creates a non-monotonicity + ;; which can cause problems with things like partial-completion. + ;; To minimize the problem, filter out completion-regexp-list, so that + ;; M-x load-library RET t/x.e TAB finds some files. + (if completion-regexp-list + (setq names (all-completions "" names))) + ;; Remove duplicates of the first element, so that we can easily check + ;; if `names' really only contains a single element. + (when (cdr names) (setcdr names (delete (car names) (cdr names)))) + (unless (cdr names) + ;; There's no more than one matching non-suffixed element, so expand + ;; the list by adding the suffixed elements as well. + (setq names (nconc names fullnames))) (completion-table-with-context string-dir names string-file pred action))))) diff -r fd080c6fcd86 -r 373abedd1f02 lisp/simple.el --- a/lisp/simple.el Fri Aug 20 21:55:21 2010 +0200 +++ b/lisp/simple.el Fri Aug 20 22:00:00 2010 +0200 @@ -5495,7 +5495,9 @@ (and parse-sexp-ignore-comments (not blink-matching-paren-dont-ignore-comments)))) (condition-case () - (scan-sexps oldpos -1) + (progn + (forward-sexp -1) + (point)) (error nil)))))) (matching-paren (and blinkpos diff -r fd080c6fcd86 -r 373abedd1f02 msdos/ChangeLog --- a/msdos/ChangeLog Fri Aug 20 21:55:21 2010 +0200 +++ b/msdos/ChangeLog Fri Aug 20 22:00:00 2010 +0200 @@ -1,3 +1,7 @@ +2010-08-15 Eli Zaretskii + + * mainmake.v2 (version): Update due to change in emacs.c. + 2010-08-05 Eli Zaretskii * sed1v2.inp (UNEXEC_OBJ): Edit to unexcoff.o, due to renaming of diff -r fd080c6fcd86 -r 373abedd1f02 msdos/mainmake.v2 --- a/msdos/mainmake.v2 Fri Aug 20 21:55:21 2010 +0200 +++ b/msdos/mainmake.v2 Fri Aug 20 22:00:00 2010 +0200 @@ -65,7 +65,7 @@ top_srcdir := $(subst \,/,$(shell cd)) # Find out which version of Emacs this is. -version := ${shell sed -n -e '/^const char emacs_version/s/^[^"]*\("[^"]*"\).*/\1/p' src/emacs.c} +version := ${shell sed -n -e '/^static const char emacs_version/s/^[^"]*\("[^"]*"\).*/\1/p' src/emacs.c} # Q: Do we need to bootstrap? # A: Only if we find admin/admin.el, i.e. we are building out of diff -r fd080c6fcd86 -r 373abedd1f02 nt/ChangeLog --- a/nt/ChangeLog Fri Aug 20 21:55:21 2010 +0200 +++ b/nt/ChangeLog Fri Aug 20 22:00:00 2010 +0200 @@ -1,3 +1,7 @@ +2010-08-19 Juanma Barranquero + + * addpm.c (add_registry): Create App Paths of type REG_EXPAND_SZ. + 2010-08-12 Jason Rumney * addpm.c (add_registry): Set path for runemacs.exe to use. diff -r fd080c6fcd86 -r 373abedd1f02 nt/addpm.c --- a/nt/addpm.c Fri Aug 20 21:55:21 2010 +0200 +++ b/nt/addpm.c Fri Aug 20 22:00:00 2010 +0200 @@ -113,7 +113,7 @@ emacs_path = (char *) alloca (len); sprintf (emacs_path, "%s\\bin\\emacs.exe", path); - RegSetValueEx (hrootkey, NULL, 0, REG_SZ, emacs_path, len); + RegSetValueEx (hrootkey, NULL, 0, REG_EXPAND_SZ, emacs_path, len); /* Look for a GTK installation. If found, add it to the library search path for Emacs so that the image libraries it provides are available @@ -135,7 +135,8 @@ len = strlen (path) + 5 + size; dll_paths = (char *) alloca (size + strlen (path) + 1); sprintf (dll_paths, "%s\\bin;%s", path, gtk_path); - RegSetValueEx (hrootkey, "Path", 0, REG_SZ, dll_paths, len); + RegSetValueEx (hrootkey, "Path", 0, REG_EXPAND_SZ, + dll_paths, len); /* Set the same path for runemacs.exe, as the Explorer shell looks this up, so the above does not take effect when @@ -145,7 +146,7 @@ KEY_WRITE, NULL, &runemacs_key, NULL) == ERROR_SUCCESS) { - RegSetValueEx (runemacs_key, "Path", 0, REG_SZ, + RegSetValueEx (runemacs_key, "Path", 0, REG_EXPAND_SZ, dll_paths, len); RegCloseKey (runemacs_key); diff -r fd080c6fcd86 -r 373abedd1f02 src/ChangeLog --- a/src/ChangeLog Fri Aug 20 21:55:21 2010 +0200 +++ b/src/ChangeLog Fri Aug 20 22:00:00 2010 +0200 @@ -1,3 +1,32 @@ +2010-08-20 Eli Zaretskii + + * emacs.c : Add a comment regarding + msdos/mainmake.v2's dependency on the syntax of this declaration. + +2010-08-20 Eli Zaretskii + + * dispnew.c (buffer_posn_from_coords): Fix calculation of buffer + position for R2L lines by mirroring the pixel position wrt the + text are box. Improve commentary. + +2010-08-20 Andreas Schwab + + * image.c (imagemagick_clear_image): Remove debugging output. + +2010-08-19 Stefan Monnier + + * cmds.c (Vself_insert_face, Vself_insert_face_command): Remove. + (Qpost_self_insert_hook, Vpost_self_insert_hook): New vars. + (internal_self_insert): Run Qpost_self_insert_hook rather than handle + self-insert-face. + (syms_of_cmds): Initialize the new vars. + +2010-08-19 Jason Rumney + + * w32menu.c (set_frame_menubar): Remove call to undefined function. + + * w32fns.c (w32_wnd_proc): Don't check context before initializing. + 2010-08-19 Jan Djärv * nsselect.m (nxatoms_of_nsselect): Use "Selection" and "Secondary". diff -r fd080c6fcd86 -r 373abedd1f02 src/cmds.c --- a/src/cmds.c Fri Aug 20 21:55:21 2010 +0200 +++ b/src/cmds.c Fri Aug 20 22:00:00 2010 +0200 @@ -37,12 +37,6 @@ /* A possible value for a buffer's overwrite-mode variable. */ Lisp_Object Qoverwrite_mode_binary; -/* Non-nil means put this face on the next self-inserting character. */ -Lisp_Object Vself_insert_face; - -/* This is the command that set up Vself_insert_face. */ -Lisp_Object Vself_insert_face_command; - static int internal_self_insert (int, int); DEFUN ("forward-point", Fforward_point, Sforward_point, 1, 1, 0, @@ -346,6 +340,7 @@ A value of 2 means this did things that call for an undo boundary. */ static Lisp_Object Qexpand_abbrev; +static Lisp_Object Qpost_self_insert_hook, Vpost_self_insert_hook; static int internal_self_insert (int c, int noautofill) @@ -451,10 +446,10 @@ && synt != Sword && NILP (current_buffer->read_only) && PT > BEGV - && (!NILP (current_buffer->enable_multibyte_characters) - ? SYNTAX (XFASTINT (Fprevious_char ())) == Sword - : (SYNTAX (UNIBYTE_TO_CHAR (XFASTINT (Fprevious_char ()))) - == Sword))) + && (SYNTAX (!NILP (current_buffer->enable_multibyte_characters) + ? XFASTINT (Fprevious_char ()) + : UNIBYTE_TO_CHAR (XFASTINT (Fprevious_char ()))) + == Sword)) { int modiff = MODIFF; Lisp_Object sym; @@ -514,15 +509,6 @@ hairy = 2; } - /* If previous command specified a face to use, use it. */ - if (!NILP (Vself_insert_face) - && EQ (current_kboard->Vlast_command, Vself_insert_face_command)) - { - Fput_text_property (make_number (PT - 1), make_number (PT), - Qface, Vself_insert_face, Qnil); - Vself_insert_face = Qnil; - } - if ((synt == Sclose || synt == Smath) && !NILP (Vblink_paren_function) && INTERACTIVE && !noautofill) @@ -530,6 +516,9 @@ call0 (Vblink_paren_function); hairy = 2; } + /* Run hooks for electric keys. */ + call1 (Vrun_hooks, Qpost_self_insert_hook); + return hairy; } @@ -550,15 +539,13 @@ Qexpand_abbrev = intern_c_string ("expand-abbrev"); staticpro (&Qexpand_abbrev); - DEFVAR_LISP ("self-insert-face", &Vself_insert_face, - doc: /* If non-nil, set the face of the next self-inserting character to this. -See also `self-insert-face-command'. */); - Vself_insert_face = Qnil; + Qpost_self_insert_hook = intern_c_string ("post-self-insert-hook"); + staticpro (&Qpost_self_insert_hook); - DEFVAR_LISP ("self-insert-face-command", &Vself_insert_face_command, - doc: /* This is the command that set up `self-insert-face'. -If `last-command' does not equal this value, we ignore `self-insert-face'. */); - Vself_insert_face_command = Qnil; + DEFVAR_LISP ("post-self-insert-hook", &Vpost_self_insert_hook, + doc: /* Hook run at the end of `self-insert-command'. +This run is run after inserting the charater. */); + Vpost_self_insert_hook = Qnil; DEFVAR_LISP ("blink-paren-function", &Vblink_paren_function, doc: /* Function called, if non-nil, whenever a close parenthesis is inserted. diff -r fd080c6fcd86 -r 373abedd1f02 src/dispnew.c --- a/src/dispnew.c Fri Aug 20 21:55:21 2010 +0200 +++ b/src/dispnew.c Fri Aug 20 22:00:00 2010 +0200 @@ -5351,9 +5351,15 @@ ***********************************************************************/ /* Determine what's under window-relative pixel position (*X, *Y). - Return the object (string or buffer) that's there. + Return the OBJECT (string or buffer) that's there. Return in *POS the position in that object. - Adjust *X and *Y to character positions. */ + Adjust *X and *Y to character positions. + Return in *DX and *DY the pixel coordinates of the click, + relative to the top left corner of OBJECT, or relative to + the top left corner of the character glyph at (*X, *Y) + if OBJECT is nil. + Return WIDTH and HEIGHT of the object at (*X, *Y), or zero + if the coordinates point to an empty area of the display. */ Lisp_Object buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *pos, Lisp_Object *object, int *dx, int *dy, int *width, int *height) @@ -5366,7 +5372,7 @@ #ifdef HAVE_WINDOW_SYSTEM struct image *img = 0; #endif - int x0, x1; + int x0, x1, to_x; /* We used to set current_buffer directly here, but that does the wrong thing with `face-remapping-alist' (bug#2044). */ @@ -5377,8 +5383,29 @@ start_display (&it, w, startp); x0 = *x - WINDOW_LEFT_MARGIN_WIDTH (w); - move_it_to (&it, -1, x0 + it.first_visible_x, *y, -1, - MOVE_TO_X | MOVE_TO_Y); + + /* First, move to the beginning of the row corresponding to *Y. We + need to be in that row to get the correct value of base paragraph + direction for the paragraph at *X. */ + move_it_to (&it, -1, 0, *y, -1, MOVE_TO_X | MOVE_TO_Y); + + /* TO_X is the pixel position that the iterator will compute for the + glyph at *X. This is because iterator positions are not offset + due to hscroll. */ + to_x = x0 + it.first_visible_x; + if (it.bidi_it.paragraph_dir == R2L) + /* For lines in an R2L paragraph, we need to mirror TO_X wrt the + text area. This is because the iterator, even in R2L + paragraphs, delivers glyphs as if they started at the left + margin of the window. (When we actually produce glyphs for + display, we reverse their order in PRODUCE_GLYPHS, but the + iterator doesn't know about that.) The following line adjusts + the pixel position to the iterator geometry, which is what + move_it_* routines use. */ + to_x = window_box_width (w, TEXT_AREA) - to_x; + + /* Now move horizontally in the row to the glyph under *X. */ + move_it_in_display_line (&it, ZV, to_x, MOVE_TO_X); Fset_buffer (old_current_buffer); diff -r fd080c6fcd86 -r 373abedd1f02 src/emacs.c --- a/src/emacs.c Fri Aug 20 21:55:21 2010 +0200 +++ b/src/emacs.c Fri Aug 20 22:00:00 2010 +0200 @@ -91,6 +91,8 @@ #endif #endif +/* If you change the following line, remember to update + msdos/mainmake.v2 which gleans the Emacs version from it! */ static const char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc."; static const char emacs_version[] = "24.0.50"; diff -r fd080c6fcd86 -r 373abedd1f02 src/image.c --- a/src/image.c Fri Aug 20 21:55:21 2010 +0200 +++ b/src/image.c Fri Aug 20 22:00:00 2010 +0200 @@ -7400,7 +7400,6 @@ imagemagick_clear_image (struct frame *f, struct image *img) { - printf("clearing imagemagick image\n"); x_clear_image (f, img); } @@ -7485,7 +7484,6 @@ image. Interface :index is same as for GIF. First we "ping" the image to see how many sub-images it contains. Pinging is faster than loading the image to find out things about it. */ - printf("im ping file %s\n", filename); image = image_spec_value (img->spec, QCindex, NULL); ino = INTEGERP (image) ? XFASTINT (image) : 0; ping_wand=NewMagickWand(); @@ -7519,7 +7517,6 @@ if (filename != NULL) { - printf("im read file %s\n", filename); image_info=CloneImageInfo((ImageInfo *) NULL); (void) strcpy(image_info->filename, filename); image_info -> number_scenes = 1; @@ -7529,7 +7526,6 @@ im_image = ReadImage (image_info, exception); CatchException(exception); - printf("im wand from image\n"); image_wand = NewMagickWandFromImage(im_image); } else @@ -7565,7 +7561,6 @@ } if(desired_width != -1 && desired_height != -1) { - printf("MagickScaleImage %d %d\n", desired_width, desired_height); status = MagickScaleImage(image_wand, desired_width, desired_height); if (status == MagickFalse) { image_error ("Imagemagick scale failed", Qnil, Qnil); @@ -7592,7 +7587,6 @@ h=XFASTINT(XCAR(XCDR(crop))); x=XFASTINT(XCAR(XCDR(XCDR(crop)))); y=XFASTINT(XCAR(XCDR(XCDR(XCDR(crop))))); - printf("MagickCropImage(image_wand, %d,%d, %d,%d)\n", w, h, x, y); MagickCropImage(image_wand, w,h, x,y); } @@ -7609,7 +7603,6 @@ PixelSetColor (background, "#ffffff");/*TODO remove hardcode*/ rotation = extract_float (value); - printf ("MagickRotateImage %f\n", rotation); status = MagickRotateImage (image_wand, background, rotation); DestroyPixelWand (background); @@ -7691,7 +7684,6 @@ int imagedepth = 24;/*MagickGetImageDepth(image_wand);*/ char* exportdepth = imagedepth <= 8 ? "I" : "BGRP";/*"RGBP";*/ /* Try to create a x pixmap to hold the imagemagick pixmap. */ - printf("imagedepth:%d exportdepth:%s\n", imagedepth, exportdepth); if (!x_create_x_image_and_pixmap (f, width, height, imagedepth, &ximg, &img->pixmap)){ image_error("Imagemagick X bitmap allocation failure", Qnil, Qnil); @@ -7758,7 +7750,6 @@ imagemagick_error: /* TODO more cleanup. */ image_error ("Error parsing IMAGEMAGICK image `%s'", img->spec, Qnil); - printf("Imagemagick error, see *Messages*\n"); return 0; } diff -r fd080c6fcd86 -r 373abedd1f02 src/w32fns.c --- a/src/w32fns.c Fri Aug 20 21:55:21 2010 +0200 +++ b/src/w32fns.c Fri Aug 20 22:00:00 2010 +0200 @@ -3109,9 +3109,6 @@ HIMC context; struct window *w; - if (!context) - break; - f = x_window_to_frame (dpyinfo, hwnd); w = XWINDOW (FRAME_SELECTED_WINDOW (f)); @@ -3129,6 +3126,10 @@ - WINDOW_MODE_LINE_HEIGHT (w)); context = get_ime_context_fn (hwnd); + + if (!context) + break; + set_ime_composition_window_fn (context, &form); release_ime_context_fn (hwnd, context); } diff -r fd080c6fcd86 -r 373abedd1f02 src/w32menu.c --- a/src/w32menu.c Fri Aug 20 21:55:21 2010 +0200 +++ b/src/w32menu.c Fri Aug 20 22:00:00 2010 +0200 @@ -420,12 +420,8 @@ set_buffer_internal_1 (XBUFFER (buffer)); - /* Run the Lucid hook. */ + /* Run the hooks. */ safe_run_hooks (Qactivate_menubar_hook); - /* If it has changed current-menubar from previous value, - really recompute the menubar from the value. */ - if (! NILP (Vlucid_menu_bar_dirty_flag)) - call0 (Qrecompute_lucid_menubar); safe_run_hooks (Qmenu_bar_update_hook); FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f)); diff -r fd080c6fcd86 -r 373abedd1f02 src/xdisp.c --- a/src/xdisp.c Fri Aug 20 21:55:21 2010 +0200 +++ b/src/xdisp.c Fri Aug 20 22:00:00 2010 +0200 @@ -217,7 +217,26 @@ glyph with suitably computed width. Both the blanks and the stretch glyph are given the face of the background of the line. This way, the terminal-specific back-end can still draw the glyphs - left to right, even for R2L lines. */ + left to right, even for R2L lines. + + Note one important detail mentioned above: that the bidi reordering + engine, driven by the iterator, produces characters in R2L rows + starting at the character that will be the rightmost on display. + As far as the iterator is concerned, the geometry of such rows is + still left to right, i.e. the iterator "thinks" the first character + is at the leftmost pixel position. The iterator does not know that + PRODUCE_GLYPHS reverses the order of the glyphs that the iterator + delivers. This is important when functions from the the move_it_* + family are used to get to certain screen position or to match + screen coordinates with buffer coordinates: these functions use the + iterator geometry, which is left to right even in R2L paragraphs. + This works well with most callers of move_it_*, because they need + to get to a specific column, and columns are still numbered in the + reading order, i.e. the rightmost character in a R2L paragraph is + still column zero. But some callers do not get well with this; a + notable example is mouse clicks that need to find the character + that corresponds to certain pixel coordinates. See + buffer_posn_from_coords in dispnew.c for how this is handled. */ #include #include