merge from upstream

This commit is contained in:
Joakim Verona 2010-08-20 22:00:00 +02:00
commit 38f9163d62
17 changed files with 227 additions and 110 deletions

View file

@ -453,6 +453,8 @@ has now been removed.
* 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.

View file

@ -1,3 +1,15 @@
2010-08-19 Stefan Monnier <monnier@iro.umontreal.ca>
* 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 <monnier@iro.umontreal.ca>
* simple.el (prog-mode-map): New var.

View file

@ -699,6 +699,22 @@ determine the correct answer."
(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 @@ As a special case, if FACE is `default', then the region is left with NO face
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")))

View file

@ -757,21 +757,44 @@ one or more of those symbols."
(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)))))

View file

@ -5495,7 +5495,9 @@ it skips the contents of comments that end before point."
(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

View file

@ -1,3 +1,7 @@
2010-08-15 Eli Zaretskii <eliz@gnu.org>
* mainmake.v2 (version): Update due to change in emacs.c.
2010-08-05 Eli Zaretskii <eliz@gnu.org>
* sed1v2.inp (UNEXEC_OBJ): Edit to unexcoff.o, due to renaming of

View file

@ -65,7 +65,7 @@ MAKESHELL=/xyzzy/command
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

View file

@ -1,3 +1,7 @@
2010-08-19 Juanma Barranquero <lekktu@gmail.com>
* addpm.c (add_registry): Create App Paths of type REG_EXPAND_SZ.
2010-08-12 Jason Rumney <jasonr@gnu.org>
* addpm.c (add_registry): Set path for runemacs.exe to use.

View file

@ -113,7 +113,7 @@ add_registry (char *path)
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 @@ add_registry (char *path)
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 @@ add_registry (char *path)
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);

View file

@ -1,3 +1,32 @@
2010-08-20 Eli Zaretskii <eliz@gnu.org>
* emacs.c <emacs_version>: Add a comment regarding
msdos/mainmake.v2's dependency on the syntax of this declaration.
2010-08-20 Eli Zaretskii <eliz@gnu.org>
* 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 <schwab@linux-m68k.org>
* image.c (imagemagick_clear_image): Remove debugging output.
2010-08-19 Stefan Monnier <monnier@iro.umontreal.ca>
* 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 <jasonr@gnu.org>
* 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 <jan.h.d@swipnet.se>
* nsselect.m (nxatoms_of_nsselect): Use "Selection" and "Secondary".

View file

@ -37,12 +37,6 @@ Lisp_Object Qkill_forward_chars, Qkill_backward_chars, Vblink_paren_function;
/* 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 @@ After insertion, the value of `auto-fill-function' is called if the
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 @@ internal_self_insert (int c, int noautofill)
&& 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 @@ internal_self_insert (int c, int noautofill)
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 @@ internal_self_insert (int c, int noautofill)
call0 (Vblink_paren_function);
hairy = 2;
}
/* Run hooks for electric keys. */
call1 (Vrun_hooks, Qpost_self_insert_hook);
return hairy;
}
@ -550,15 +539,13 @@ syms_of_cmds (void)
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.

View file

@ -5351,9 +5351,15 @@ update_frame_line (struct frame *f, int vpos)
***********************************************************************/
/* 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 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p
#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 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p
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);

View file

@ -91,6 +91,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#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";

View file

@ -7400,7 +7400,6 @@ static void
imagemagick_clear_image (struct frame *f,
struct image *img)
{
printf("clearing imagemagick image\n");
x_clear_image (f, img);
}
@ -7485,7 +7484,6 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */
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 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */
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 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */
im_image = ReadImage (image_info, exception);
CatchException(exception);
printf("im wand from image\n");
image_wand = NewMagickWandFromImage(im_image);
}
else
@ -7565,7 +7561,6 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */
}
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 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */
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 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */
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 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */
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_load_image (/* Pointer to emacs frame structure. */
imagemagick_error:
/* TODO more cleanup. */
image_error ("Error parsing IMAGEMAGICK image `%s'", img->spec, Qnil);
printf("Imagemagick error, see *Messages*\n");
return 0;
}

View file

@ -3109,9 +3109,6 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
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 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
- 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);
}

View file

@ -420,12 +420,8 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
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));

View file

@ -217,7 +217,26 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
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 <config.h>
#include <stdio.h>