Commit fea9cabd authored by Chong Yidong's avatar Chong Yidong

Merge changes from emacs-23 branch.

parents 7e4289ad f253ef6a
2010-07-16 Reiner Steib <Reiner.Steib@gmx.de>
* 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 <eliz@gnu.org>
* mail/rmailmm.el (rmail-mime-save): Make the temp buffer
unibyte, so compressed attachments are not compressed again.
2010-07-16 Michael Albinus <michael.albinus@gmx.de>
* 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 <jan.h.d@swipnet.se>
* xt-mouse.el (xterm-mouse-event-read): Fix for characters > 127
now that unicode is used (Bug#6594).
2010-07-14 Chong Yidong <cyd@stupidchicken.com>
* 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 <rgm@gnu.org>
* 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 <cyd@stupidchicken.com>
* simple.el (use-region-p): Doc fix (Bug#6607).
2010-07-10 Aleksei Gusev <aleksei.gusev@gmail.com> (tiny change)
* progmodes/compile.el (compilation-error-regexp-alist-alist): Add
......
;;; 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 <fisk@bowdoin.edu>
;; Edward M. Reingold <reingold@cs.uiuc.edu>
......@@ -507,6 +507,7 @@ indicates a buffer position to use instead of point."
(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 @@ indicates a buffer position to use instead of point."
(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 @@ indicates a buffer position to use instead of point."
(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 @@ are included. Each day is formatted using format DAY-FORMAT."
(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 @@ blank, no days are inserted."
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 @@ The entry is formatted using DAY-FORMAT."
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 @@ Optional string COLSEP gives the column separation (default \"1mm\")."
(- (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"
......
......@@ -2226,6 +2226,10 @@ DATE is a list of the form (month day year). A negative year is
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)
......
......@@ -112,6 +112,10 @@ automatically display the image in the buffer."
(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))))
......
......@@ -3761,10 +3761,9 @@ point otherwise."
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'."
......
......@@ -1437,6 +1437,16 @@ Runs the normal hooks `vc-before-checkin-hook' and `vc-checkin-hook'."
;; (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 @@ Runs the normal hooks `vc-before-checkin-hook' and `vc-checkin-hook'."
;; 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
......
......@@ -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)
......
2010-07-14 Jan Djärv <jan.h.d@swipnet.se>
* 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 <eliz@gnu.org>
* 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 <jan.h.d@swipnet.se>
* xmenu.c (free_frame_menubar): Only call x_set_window_size if
......
......@@ -2856,6 +2856,38 @@ free_frame_menubar (FRAME_PTR f)
}
}
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;
}
/***********************************************************************
......
......@@ -153,6 +153,8 @@ extern void xg_modify_menubar_widgets (GtkWidget *menubar,
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);
......
......@@ -1333,7 +1333,10 @@ x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
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))
......
......@@ -398,8 +398,9 @@ x_any_window_to_frame (struct x_display_info *dpyinfo, int wdesc)
/* 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 @@ x_menubar_window_to_frame (struct x_display_info *dpyinfo, int wdesc)
if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo)
continue;
x = f->output_data.x;
/* 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;
}
if (x->menubar_widget && xg_event_is_for_menubar (f, event))
return f;
#else
/* Match if the window is this frame's menubar. */
if (x->menubar_widget
&& lw_window_is_in_menubar (wdesc, x->menubar_widget))
return f;
......
......@@ -664,14 +664,6 @@ x_activate_menubar (FRAME_PTR f)
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
......
......@@ -6743,7 +6743,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
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
......
......@@ -381,12 +381,15 @@ extern int use_xim;
#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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment