# HG changeset patch # User Chong Yidong # Date 1279294935 14400 # Node ID 051595eb9b58dcb8a8c7c2092b8f39375a068274 # Parent 9e514d1076b4c8f2a58f1e7e77ad32accac5b009# Parent 0c54c271bb98b083f506edd90ff840d5abf6112b Merge changes from emacs-23 branch. diff -r 9e514d1076b4 -r 051595eb9b58 lisp/ChangeLog --- a/lisp/ChangeLog Fri Jul 16 14:09:55 2010 +0200 +++ b/lisp/ChangeLog Fri Jul 16 11:42:15 2010 -0400 @@ -1,3 +1,15 @@ +2010-07-16 Reiner Steib + + * vc.el (vc-coding-system-inherit-eol): New defvar. + (vc-coding-system-for-diff): Use it to decide whether to inherit + from the file the EOL format for reading the diffs of that file. + (Bug#4451) + +2010-07-16 Eli Zaretskii + + * mail/rmailmm.el (rmail-mime-save): Make the temp buffer + unibyte, so compressed attachments are not compressed again. + 2010-07-16 Michael Albinus * net/tramp.el (tramp-handle-shell-command): Don't use hard-wired @@ -22,6 +34,11 @@ * bookmark.el (bookmark-load-hook): Fix doc string as suggested by Drew Adams (Bug#5504). +2010-07-14 Jan Djärv + + * xt-mouse.el (xterm-mouse-event-read): Fix for characters > 127 + now that unicode is used (Bug#6594). + 2010-07-14 Chong Yidong * term/x-win.el (x-select-enable-clipboard): Default to t. @@ -120,6 +137,20 @@ * net/tramp-gvfs.el (tramp-gvfs-handle-copy-file): Do not pass empty argument to gvfs-copy. +2010-07-10 Glenn Morris + + * calendar/calendar.el (calendar-week-end-day): New function. + * calendar/cal-tex.el (cal-tex-cursor-month): Remove unused vars. + Respect calendar-week-start-day. (Bug#6606) + (cal-tex-insert-day-names, cal-tex-insert-blank-days) + (cal-tex-insert-blank-days-at-end): Respect calendar-week-start-day. + (cal-tex-first-blank-p, cal-tex-last-blank-p): Simplify, and + respect calendar-week-start-day. + +2010-07-10 Chong Yidong + + * simple.el (use-region-p): Doc fix (Bug#6607). + 2010-07-10 Aleksei Gusev (tiny change) * progmodes/compile.el (compilation-error-regexp-alist-alist): Add diff -r 9e514d1076b4 -r 051595eb9b58 lisp/calendar/cal-tex.el --- a/lisp/calendar/cal-tex.el Fri Jul 16 14:09:55 2010 +0200 +++ b/lisp/calendar/cal-tex.el Fri Jul 16 11:42:15 2010 -0400 @@ -1,7 +1,7 @@ ;;; cal-tex.el --- calendar functions for printing calendars with LaTeX -;; Copyright (C) 1995, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 1995, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, +;; 2009, 2010 Free Software Foundation, Inc. ;; Author: Steve Fisk ;; Edward M. Reingold @@ -507,6 +507,7 @@ (year (calendar-extract-year date)) (end-month month) (end-year year) + ;; FIXME -landscape sets cal-tex-which-days? (d1 (calendar-absolute-from-gregorian (list month 1 year))) (d2 (progn (calendar-increment-month end-month end-year (1- n)) @@ -515,8 +516,7 @@ (calendar-last-day-of-month end-month end-year) end-year)))) (diary-list (if cal-tex-diary (cal-tex-list-diary-entries d1 d2))) - (holidays (if cal-tex-holidays (cal-tex-list-holidays d1 d2))) - other-month other-year) + (holidays (if cal-tex-holidays (cal-tex-list-holidays d1 d2)))) (cal-tex-insert-preamble (cal-tex-number-weeks month year n) nil "12pt") (if (> n 1) (cal-tex-cmd cal-tex-cal-multi-month) @@ -526,14 +526,12 @@ (cal-tex-nl ".2cm") (cal-tex-insert-blank-days month year cal-tex-day-prefix) (dotimes (idummy n) - (setq other-month month - other-year year) (cal-tex-insert-days month year diary-list holidays cal-tex-day-prefix) - (when (= 6 (mod (calendar-absolute-from-gregorian - (list month - (calendar-last-day-of-month month year) - year)) - 7)) ; last day of month was Saturday + (when (= (calendar-week-end-day) + (calendar-day-of-week + (list month + (calendar-last-day-of-month month year) + year))) ; last day of month was last day of week (cal-tex-hfill) (cal-tex-nl)) (calendar-increment-month month year 1)) @@ -570,13 +568,14 @@ (defun cal-tex-insert-day-names () "Insert the names of the days at top of a monthly calendar." - (dotimes (i 7) - (if (memq i cal-tex-which-days) - (insert (format cal-tex-day-name-format - (cal-tex-LaTeXify-string - (aref calendar-day-name-array - (mod (+ calendar-week-start-day i) 7)))))) - (cal-tex-comment))) + (let (j) + (dotimes (i 7) + (if (memq (setq j (mod (+ calendar-week-start-day i) 7)) + cal-tex-which-days) + (insert (format cal-tex-day-name-format + (cal-tex-LaTeXify-string + (aref calendar-day-name-array j))))) + (cal-tex-comment)))) (defun cal-tex-insert-month-header (n month year end-month end-year) "Create a title for a calendar. @@ -603,7 +602,7 @@ calendar-week-start-day) 7))) (dotimes (i blank-days) - (if (memq i cal-tex-which-days) + (if (memq (mod (+ calendar-week-start-day i) 7) cal-tex-which-days) (insert (format day-format " " " ") "{}{}{}{}%\n")))))) (defun cal-tex-insert-blank-days-at-end (month year day-format) @@ -619,38 +618,37 @@ 7)) (i blank-days)) (while (<= (setq i (1+ i)) 6) - (if (memq i cal-tex-which-days) + (if (memq (mod (+ calendar-week-start-day i) 7) cal-tex-which-days) (insert (format day-format "" "") "{}{}{}{}%\n")))))) (defun cal-tex-first-blank-p (month year) "Determine if any days of the first week will be printed. Return t if there will there be any days of the first week printed in the calendar starting in MONTH YEAR." - (let (any-days the-saturday) ; the day of week of 1st Saturday - (dotimes (i 7) - (if (= 6 (calendar-day-of-week (list month (1+ i) year))) - (setq the-saturday (1+ i)))) - (dotimes (i the-saturday) - (if (memq (calendar-day-of-week (list month (1+ i) year)) - cal-tex-which-days) - (setq any-days t))) - any-days)) + ;; Check days 1-7 of the month, until we find the last day of the week. + (catch 'found + (let (dow) + (dotimes (i 7) + (if (memq (setq dow (calendar-day-of-week (list month (1+ i) year))) + cal-tex-which-days) + (throw 'found t) + (if (= dow (calendar-week-end-day)) (throw 'found nil))))))) (defun cal-tex-last-blank-p (month year) "Determine if any days of the last week will be printed. Return t if there will there be any days of the last week printed in the calendar starting in MONTH YEAR." - (let* ((last-day (calendar-last-day-of-month month year)) - (i (- last-day 7)) - any-days the-sunday) ; the day of week of last Sunday - (while (<= (setq i (1+ i)) last-day) - (if (zerop (calendar-day-of-week (list month i year))) - (setq the-sunday i))) - (setq i (1- the-sunday)) - (while (<= (setq i (1+ i)) last-day) - (if (memq (calendar-day-of-week (list month i year)) cal-tex-which-days) - (setq any-days t))) - any-days)) + ;; Check backwards from the last day of the month, until we find the + ;; start of the last week in the month. + (catch 'found + (let ((last-day (calendar-last-day-of-month month year)) + day dow) + (dotimes (i 7) + (if (memq (setq dow (calendar-day-of-week + (list month (- last-day i) year))) + cal-tex-which-days) + (throw 'found t) + (if (= dow calendar-week-start-day) (throw 'found nil))))))) (defun cal-tex-number-weeks (month year n) "Determine the number of weeks in a range of dates. @@ -1499,7 +1497,7 @@ (- (calendar-day-of-week (list month 1 year)) calendar-week-start-day) 7)) - (last (calendar-last-day-of-month month year)) + (last( calendar-last-day-of-month month year)) (str (concat "\\def\\" name "{\\hbox to" width "{%\n" "\\vbox to" height "{%\n" "\\vfil \\hbox to" width "{%\n" diff -r 9e514d1076b4 -r 051595eb9b58 lisp/calendar/calendar.el --- a/lisp/calendar/calendar.el Fri Jul 16 14:09:55 2010 +0200 +++ b/lisp/calendar/calendar.el Fri Jul 16 11:42:15 2010 -0400 @@ -2226,6 +2226,10 @@ interpreted as BC; -1 being 1 BC, and so on." (mod (calendar-absolute-from-gregorian date) 7)) +(defun calendar-week-end-day () + "Return the index (0 for Sunday, etc.) of the last day of the week." + (mod (+ calendar-week-start-day 6) 7)) + (defun calendar-unmark () "Delete all diary/holiday marks/highlighting from the calendar." (interactive) diff -r 9e514d1076b4 -r 051595eb9b58 lisp/mail/rmailmm.el --- a/lisp/mail/rmailmm.el Fri Jul 16 14:09:55 2010 +0200 +++ b/lisp/mail/rmailmm.el Fri Jul 16 11:42:15 2010 -0400 @@ -112,6 +112,10 @@ (file-name-as-directory filename)))) (with-temp-buffer (set-buffer-file-coding-system 'no-conversion) + ;; Needed e.g. by jka-compr, so if the attachment is a compressed + ;; file, the magic signature compares equal with the unibyte + ;; signature string recorded in jka-compr-compression-info-list. + (set-buffer-multibyte nil) (insert data) (write-region nil nil filename nil nil nil t)))) diff -r 9e514d1076b4 -r 051595eb9b58 lisp/simple.el --- a/lisp/simple.el Fri Jul 16 14:09:55 2010 +0200 +++ b/lisp/simple.el Fri Jul 16 11:42:15 2010 -0400 @@ -3761,10 +3761,9 @@ This is used by commands that act specially on the region under Transient Mark mode. -The return value is t provided Transient Mark mode is enabled and -the mark is active; and, when `use-empty-active-region' is -non-nil, provided the region is empty. Otherwise, the return -value is nil. +The return value is t if Transient Mark mode is enabled and the +mark is active; furthermore, if `use-empty-active-region' is nil, +the region must not be empty. Otherwise, the return value is nil. For some commands, it may be appropriate to ignore the value of `use-empty-active-region'; in that case, use `region-active-p'." diff -r 9e514d1076b4 -r 051595eb9b58 lisp/vc/vc.el --- a/lisp/vc/vc.el Fri Jul 16 14:09:55 2010 +0200 +++ b/lisp/vc/vc.el Fri Jul 16 11:42:15 2010 -0400 @@ -1437,6 +1437,16 @@ ;; (vc-call-backend ',(vc-backend f) ;; 'diff (list ',f) ',rev1 ',rev2)))))) +(defvar vc-coding-system-inherit-eol t + "When non-nil, inherit the EOL format for reading Diff output from the file. + +Used in `vc-coding-system-for-diff' to determine the EOL format to use +for reading Diff output for a file. If non-nil, the EOL format is +inherited from the file itself. +Set this variable to nil if your Diff tool might use a different +EOL. Then Emacs will auto-detect the EOL format in Diff output, which +gives better results.") ;; Cf. bug#4451. + (defun vc-coding-system-for-diff (file) "Return the coding system for reading diff output for FILE." (or coding-system-for-read @@ -1444,7 +1454,12 @@ ;; use the buffer's coding system (let ((buf (find-buffer-visiting file))) (when buf (with-current-buffer buf - buffer-file-coding-system))) + (if vc-coding-system-inherit-eol + buffer-file-coding-system + ;; Don't inherit the EOL part of the coding-system, + ;; because some Diff tools may choose to use + ;; a different one. bug#4451. + (coding-system-base buffer-file-coding-system))))) ;; otherwise, try to find one based on the file name (car (find-operation-coding-system 'insert-file-contents file)) ;; and a final fallback diff -r 9e514d1076b4 -r 051595eb9b58 lisp/xt-mouse.el --- a/lisp/xt-mouse.el Fri Jul 16 14:09:55 2010 +0200 +++ b/lisp/xt-mouse.el Fri Jul 16 11:42:15 2010 -0400 @@ -122,8 +122,8 @@ ;; read xterm sequences above ascii 127 (#x7f) (defun xterm-mouse-event-read () (let ((c (read-char))) - (if (< c 0) - (+ c #x8000000 128) + (if (> c #x3FFF80) + (+ 128 (- c #x3FFF80)) c))) (defun xterm-mouse-truncate-wrap (f) diff -r 9e514d1076b4 -r 051595eb9b58 src/ChangeLog --- a/src/ChangeLog Fri Jul 16 14:09:55 2010 +0200 +++ b/src/ChangeLog Fri Jul 16 11:42:15 2010 -0400 @@ -1,3 +1,25 @@ +2010-07-14 Jan Djärv + + * xterm.h (x_menubar_window_to_frame): Second parameter is XEvent*. + + * xterm.c (handle_one_xevent): Pass event to x_menubar_window_to_frame. + + * xmenu.c (x_activate_menubar): Revert previous fix for Bug#6499, + i.e. don't put back ButtonRelease (Bug#6608). + + * xfns.c (x_menubar_window_to_frame): Take XEvent as second parameter + instead of Window. Call xg_event_is_for_menubar when + USE_GTK (Bug#6499). + + * gtkutil.h (xg_event_is_for_menubar): Declare. + + * gtkutil.c (xg_event_is_for_menubar): New function (Bug#6499). + +2010-07-14 Eli Zaretskii + + * w32fns.c (x_set_foreground_color): Fix setting the cursor color + when it's the same as the old foreground. (Bug#6609) + 2010-07-16 Jan Djärv * xmenu.c (free_frame_menubar): Only call x_set_window_size if diff -r 9e514d1076b4 -r 051595eb9b58 src/gtkutil.c --- a/src/gtkutil.c Fri Jul 16 14:09:55 2010 +0200 +++ b/src/gtkutil.c Fri Jul 16 11:42:15 2010 -0400 @@ -2856,6 +2856,38 @@ } } +int +xg_event_is_for_menubar (FRAME_PTR f, XEvent *event) +{ + struct x_output *x = f->output_data.x; + + if (! x->menubar_widget) return 0; + + if (! (event->xbutton.x >= 0 + && event->xbutton.x < FRAME_PIXEL_WIDTH (f) + && event->xbutton.y >= 0 + && event->xbutton.y < f->output_data.x->menubar_height + && event->xbutton.same_screen)) + return 0; + + GList *list = gtk_container_get_children (GTK_CONTAINER (x->menubar_widget)); + if (! list) return 0; + GList *iter; + GdkRectangle rec; + rec.x = event->xbutton.x; + rec.y = event->xbutton.y; + rec.width = 1; + rec.height = 1; + for (iter = list ; iter; iter = g_list_next (iter)) + { + GtkWidget *w = GTK_WIDGET (iter->data); + if (GTK_WIDGET_MAPPED (w) && gtk_widget_intersect (w, &rec, NULL)) + break; + } + g_list_free (list); + return iter == 0 ? 0 : 1; +} + /*********************************************************************** diff -r 9e514d1076b4 -r 051595eb9b58 src/gtkutil.h --- a/src/gtkutil.h Fri Jul 16 14:09:55 2010 +0200 +++ b/src/gtkutil.h Fri Jul 16 11:42:15 2010 -0400 @@ -153,6 +153,8 @@ extern int xg_update_frame_menubar (FRAME_PTR f); +extern int xg_event_is_for_menubar (FRAME_PTR f, XEvent *event); + extern int xg_have_tear_offs (void); extern int xg_get_scroll_id_for_window (Display *dpy, Window wid); diff -r 9e514d1076b4 -r 051595eb9b58 src/w32fns.c --- a/src/w32fns.c Fri Jul 16 14:09:55 2010 +0200 +++ b/src/w32fns.c Fri Jul 16 11:42:15 2010 -0400 @@ -1333,7 +1333,10 @@ if (FRAME_W32_WINDOW (f) != 0) { if (x->cursor_pixel == old_fg) - x->cursor_pixel = fg; + { + x->cursor_pixel = fg; + x->cursor_gc->background = fg; + } update_face_from_frame_parameter (f, Qforeground_color, arg); if (FRAME_VISIBLE_P (f)) diff -r 9e514d1076b4 -r 051595eb9b58 src/xfns.c --- a/src/xfns.c Fri Jul 16 14:09:55 2010 +0200 +++ b/src/xfns.c Fri Jul 16 11:42:15 2010 -0400 @@ -398,8 +398,9 @@ /* Likewise, but consider only the menu bar widget. */ struct frame * -x_menubar_window_to_frame (struct x_display_info *dpyinfo, int wdesc) +x_menubar_window_to_frame (struct x_display_info *dpyinfo, XEvent *event) { + Window wdesc = event->xany.window; Lisp_Object tail, frame; struct frame *f; struct x_output *x; @@ -415,21 +416,11 @@ if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo) continue; x = f->output_data.x; +#ifdef USE_GTK + if (x->menubar_widget && xg_event_is_for_menubar (f, event)) + return f; +#else /* Match if the window is this frame's menubar. */ -#ifdef USE_GTK - if (x->menubar_widget) - { - GtkWidget *gwdesc = xg_win_to_widget (dpyinfo->display, wdesc); - - /* This gives false positives, but the rectangle check in xterm.c - where this is called takes care of that. */ - if (gwdesc != 0 - && (gwdesc == x->menubar_widget - || gtk_widget_is_ancestor (x->menubar_widget, gwdesc) - || gtk_widget_is_ancestor (gwdesc, x->menubar_widget))) - return f; - } -#else if (x->menubar_widget && lw_window_is_in_menubar (wdesc, x->menubar_widget)) return f; diff -r 9e514d1076b4 -r 051595eb9b58 src/xmenu.c --- a/src/xmenu.c Fri Jul 16 14:09:55 2010 +0200 +++ b/src/xmenu.c Fri Jul 16 11:42:15 2010 -0400 @@ -664,14 +664,6 @@ BLOCK_INPUT; popup_activated_flag = 1; #ifdef USE_GTK - /* If we click outside any menu item, the menu bar still grabs. - So we send Press and the Release. If outside, grab is released. - If on a menu item, it is popped up normally. - PutBack is like a stack, so we put back in reverse order. */ - f->output_data.x->saved_menu_event->type = ButtonRelease; - XPutBackEvent (f->output_data.x->display_info->display, - f->output_data.x->saved_menu_event); - f->output_data.x->saved_menu_event->type = ButtonPress; XPutBackEvent (f->output_data.x->display_info->display, f->output_data.x->saved_menu_event); #else diff -r 9e514d1076b4 -r 051595eb9b58 src/xterm.c --- a/src/xterm.c Fri Jul 16 14:09:55 2010 +0200 +++ b/src/xterm.c Fri Jul 16 11:42:15 2010 -0400 @@ -6743,7 +6743,7 @@ f->mouse_moved = 0; #if defined (USE_X_TOOLKIT) || defined (USE_GTK) - f = x_menubar_window_to_frame (dpyinfo, event.xbutton.window); + f = x_menubar_window_to_frame (dpyinfo, &event); /* For a down-event in the menu bar, don't pass it to Xt right now. Instead, save it away diff -r 9e514d1076b4 -r 051595eb9b58 src/xterm.h --- a/src/xterm.h Fri Jul 16 14:09:55 2010 +0200 +++ b/src/xterm.h Fri Jul 16 11:42:15 2010 -0400 @@ -381,12 +381,15 @@ #endif /* This checks to make sure we have a display. */ + extern void check_x (void); extern struct frame *x_window_to_frame (struct x_display_info *, int); extern struct frame *x_any_window_to_frame (struct x_display_info *, int); -extern struct frame *x_menubar_window_to_frame (struct x_display_info *, int); +extern struct frame *x_menubar_window_to_frame (struct x_display_info *, + XEvent *); + extern struct frame *x_top_window_to_frame (struct x_display_info *, int); #if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK)