Mercurial > emacs
changeset 106915:ef4635609200
from trunk
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Mon, 18 Jan 2010 09:58:15 +0900 |
parents | a6629254b6ba (current diff) 1ee66866ef44 (diff) |
children | 401176c64983 |
files | |
diffstat | 5 files changed, 134 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Fri Jan 15 14:13:05 2010 +0900 +++ b/lisp/ChangeLog Mon Jan 18 09:58:15 2010 +0900 @@ -1,3 +1,13 @@ +2010-01-15 David Abrahams <dave@boostpro.com> (tiny change) + + * net/mairix.el (mairix-widget-send-query): Send -1 instead of nil + to mairix-search to suppress threading (Bug#5342). + +2010-01-15 Kenichi Handa <handa@m17n.org> + + * international/mule-cmds.el (canonicalize-coding-system-name): + Convert "msXXX", "ibmXXX", "windows-XXX" to "cpXXX". + 2010-01-15 Glenn Morris <rgm@gnu.org> * log-view.el (top-level): Require 'wid-edit. (Bug#5311)
--- a/lisp/international/mule-cmds.el Fri Jan 15 14:13:05 2010 +0900 +++ b/lisp/international/mule-cmds.el Mon Jan 18 09:58:15 2010 +0900 @@ -226,19 +226,22 @@ ;; and delimiter characters. Support function of ;; coding-system-from-name. (defun canonicalize-coding-system-name (name) - (if (string-match "^iso[-_ ]?[0-9]" name) - ;; "iso-8859-1" -> "8859-1", "iso-2022-jp" ->"2022-jp" - (setq name (substring name (1- (match-end 0))))) - (let ((idx (string-match "[-_ /]" name))) - ;; Delete "-", "_", " ", "/" but do distinguish "16-be" and "16be". - (while idx - (if (and (>= idx 2) - (eq (string-match "16-[lb]e$" name (- idx 2)) - (- idx 2))) - (setq idx (string-match "[-_ /]" name (match-end 0))) - (setq name (concat (substring name 0 idx) (substring name (1+ idx))) - idx (string-match "[-_ /]" name idx)))) - name)) + (if (string-match "^\\(ms\\|ibm\\|windows-\\)\\([0-9]+\\)$" name) + ;; "ms950", "ibm950", "windows-950" -> "cp950" + (concat "cp" (match-string 2 name)) + (if (string-match "^iso[-_ ]?[0-9]" name) + ;; "iso-8859-1" -> "8859-1", "iso-2022-jp" ->"2022-jp" + (setq name (substring name (1- (match-end 0))))) + (let ((idx (string-match "[-_ /]" name))) + ;; Delete "-", "_", " ", "/" but do distinguish "16-be" and "16be". + (while idx + (if (and (>= idx 2) + (eq (string-match "16-[lb]e$" name (- idx 2)) + (- idx 2))) + (setq idx (string-match "[-_ /]" name (match-end 0))) + (setq name (concat (substring name 0 idx) (substring name (1+ idx))) + idx (string-match "[-_ /]" name idx)))) + name))) (defun coding-system-from-name (name) "Return a coding system whose name matches with NAME (string or symbol)."
--- a/lisp/net/mairix.el Fri Jan 15 14:13:05 2010 +0900 +++ b/lisp/net/mairix.el Mon Jan 18 09:58:15 2010 +0900 @@ -341,7 +341,7 @@ (defun mairix-search (search threads) "Call Mairix with SEARCH. -If THREADS is t, also display whole threads of found +If THREADS is non-nil, also display whole threads of found messages. Results will be put into the default search file." (interactive (list @@ -595,9 +595,7 @@ "Send query from WIDGETS to mairix binary." (mairix-search (mairix-widget-make-query-from-widgets widgets) - (if (widget-value (cadr (assoc "Threads" widgets))) - t - -1)) + (if (widget-value (cadr (assoc "Threads" widgets))) t)) (kill-buffer mairix-customize-query-buffer)) (defun mairix-widget-save-search (widgets)
--- a/src/ChangeLog Fri Jan 15 14:13:05 2010 +0900 +++ b/src/ChangeLog Mon Jan 18 09:58:15 2010 +0900 @@ -1,3 +1,10 @@ +2010-01-15 Jan Djärv <jan.h.d@swipnet.se> + + * xfns.c (x_get_current_desktop, x_get_desktop_workarea): New functions. + (Fx_create_frame): Call x_get_current_desktop and x_get_desktop_workarea + to find out usable size of the desktop. Don't make frames larger than + this. Bug #3643. + 2010-01-15 Kenichi Handa <handa@m17n.org> * xdisp.c (CHAR_COMPOSED_P): New arg END_CHARPOS. Callers changed.
--- a/src/xfns.c Fri Jan 15 14:13:05 2010 +0900 +++ b/src/xfns.c Mon Jan 18 09:58:15 2010 +0900 @@ -3145,6 +3145,91 @@ return Qnil; } +/* Return current desktop index for the display where frame F is. + If we can't find out the current desktop, return 0. */ + +static int +x_get_current_desktop (f) + struct frame *f; +{ + Atom actual_type; + unsigned long actual_size, bytes_remaining; + int rc, actual_format; + struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + long max_len = 10; + Display *dpy = FRAME_X_DISPLAY (f); + long *data = NULL; + int current_desktop; + + BLOCK_INPUT; + x_catch_errors (dpy); + rc = XGetWindowProperty (dpy, dpyinfo->root_window, + XInternAtom (dpy, "_NET_CURRENT_DESKTOP", False), + 0, max_len, False, XA_CARDINAL, + &actual_type, &actual_format, &actual_size, + &bytes_remaining, (unsigned char **)&data); + + if (rc != Success || actual_type != XA_CARDINAL || x_had_errors_p (dpy) + || actual_size == 0 || actual_format != 32) + current_desktop = 0; + else + current_desktop = (int)*data; + + if (data) XFree (data); + x_uncatch_errors (); + UNBLOCK_INPUT; + return current_desktop; +} + +/* Return current size for DESKTOP_INDEX on the display where frame F is. + If we can't find out the size, return 0, otherwise 1. */ + +static int +x_get_desktop_workarea (f, desktop_index, deskw, deskh) + struct frame *f; + int desktop_index; + int *deskw, *deskh; +{ + Atom actual_type; + unsigned long actual_size, bytes_remaining; + int rc, actual_format; + struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + long max_len = 1000; /* This handles 250 desktops, who has that many? */ + Display *dpy = FRAME_X_DISPLAY (f); + long *data = NULL; + int retval; + + BLOCK_INPUT; + x_catch_errors (dpy); + rc = XGetWindowProperty (dpy, dpyinfo->root_window, + XInternAtom (dpy, "_NET_WORKAREA", False), + 0, max_len, False, XA_CARDINAL, + &actual_type, &actual_format, &actual_size, + &bytes_remaining, (unsigned char **)&data); + + if (rc != Success || actual_type != XA_CARDINAL || x_had_errors_p (dpy) + || actual_size < 3 || actual_format != 32) + retval = 0; + else + { + int idx; + + if (actual_size == 4 /* Only one info for all desktops. */ + || desktop_index*4 > actual_size) /* destop_index out of range. */ + desktop_index = 0; + + idx = desktop_index*4; + *deskw = data[idx+2] - data[idx]; + *deskh = data[idx+3] - data[idx+1]; + retval = 1; + } + + if (data) XFree (data); + x_uncatch_errors (); + UNBLOCK_INPUT; + return retval; +} + DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, 1, 1, 0, doc: /* Make a new X window, which is called a "frame" in Emacs terms. @@ -3164,7 +3249,7 @@ Lisp_Object name; int minibuffer_only = 0; long window_prompting = 0; - int width, height; + int width, height, deskw = -1, deskh = -1, current_desktop = -1; int count = SPECPDL_INDEX (); struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; Lisp_Object display; @@ -3440,6 +3525,12 @@ { int ph = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, FRAME_LINES (f)); int dph = DisplayHeight (FRAME_X_DISPLAY (f), FRAME_X_SCREEN_NUMBER (f)); + /* Some desktops have fixed menus above and/or panels below. Try to + figure out the usable size we have for emacs. */ + current_desktop = x_get_current_desktop (f); + x_get_desktop_workarea (f, current_desktop, &deskw, &deskh); + if (deskh > 0 && deskh < dph) dph = deskh; + if (ph > dph) { height = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, dph) - @@ -3459,6 +3550,13 @@ { int pw = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, FRAME_COLS (f)); int dpw = DisplayWidth (FRAME_X_DISPLAY (f), FRAME_X_SCREEN_NUMBER (f)); + if (deskw == -1) + { + current_desktop = x_get_current_desktop (f); + x_get_desktop_workarea (f, current_desktop, &deskw, &deskh); + } + if (deskw > 0 && deskw < dpw) dpw = deskw; + if (pw > dpw) width = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, dpw); }