merge from trunk

This commit is contained in:
Joakim Verona 2013-09-13 08:11:34 +02:00
commit 584bb3a913
11 changed files with 224 additions and 214 deletions

View file

@ -1,3 +1,16 @@
2013-09-13 Michael Albinus <michael.albinus@gmx.de>
* net/tramp.el (tramp-check-proper-method-and-host): Rename it from
`tramp-check-proper-host'. Check for a valid method name.
* net/tramp-adb.el (tramp-adb-maybe-open-connection):
* net/tramp-gvfs.el (tramp-gvfs-maybe-open-connection):
* net/tramp-sh.el (tramp-maybe-open-connection):
* net/tramp-smb.el (tramp-smb-maybe-open-connection): Call it.
* net/tramp-cache.el (tramp-cache-print): Don't print text properties
also for hash values.
2013-09-12 Stefan Monnier <monnier@iro.umontreal.ca>
* term/ns-win.el (parameters): Don't declare as dynamic.

View file

@ -1092,7 +1092,7 @@ FMT and ARGS are passed to `error'."
"Maybe open a connection VEC.
Does not do anything if a connection is already open, but re-opens the
connection if a previous connection has died for some reason."
(tramp-check-proper-host vec)
(tramp-check-proper-method-and-host vec)
(let* ((buf (tramp-get-connection-buffer vec))
(p (get-buffer-process buf))

View file

@ -285,16 +285,18 @@ KEY identifies the connection, it is either a process or a vector."
(let (result)
(maphash
(lambda (key value)
;; Remove text properties from KEY.
(when (vectorp key)
(dotimes (i (length key))
(when (stringp (aref key i))
(aset key i
(funcall
;; `substring-no-properties' does not exist in XEmacs.
(if (functionp 'substring-no-properties)
'substring-no-properties 'identity)
(aref key i))))))
;; Remove text properties from KEY and VALUE.
;; `substring-no-properties' does not exist in XEmacs.
(when (functionp 'substring-no-properties)
(when (vectorp key)
(dotimes (i (length key))
(when (stringp (aref key i))
(aset key i (funcall 'substring-no-properties (aref key i))))))
(when (stringp key)
(setq key (funcall 'substring-no-properties key)))
(when (stringp value)
(setq value (funcall 'substring-no-properties value))))
;; Dump.
(let ((tmp (format
"(%s %s)"
(if (processp key)

View file

@ -1465,7 +1465,7 @@ It was \"a(say)\", but has changed to \"a{sv})\"."
"Maybe open a connection VEC.
Does not do anything if a connection is already open, but re-opens the
connection if a previous connection has died for some reason."
(tramp-check-proper-host vec)
(tramp-check-proper-method-and-host vec)
;; We set the file name, in case there are incoming D-Bus signals or
;; D-Bus errors.

View file

@ -4286,7 +4286,7 @@ Gateway hops are already opened."
"Maybe open a connection VEC.
Does not do anything if a connection is already open, but re-opens the
connection if a previous connection has died for some reason."
(tramp-check-proper-host vec)
(tramp-check-proper-method-and-host vec)
(let ((p (tramp-get-connection-process vec))
(process-name (tramp-get-connection-property vec "process-name" nil))

View file

@ -1566,7 +1566,7 @@ Does not do anything if a connection is already open, but re-opens the
connection if a previous connection has died for some reason.
If ARGUMENT is non-nil, use it as argument for
`tramp-smb-winexe-program', and suppress any checks."
(tramp-check-proper-host vec)
(tramp-check-proper-method-and-host vec)
(let* ((share (tramp-smb-get-share vec))
(buf (tramp-get-connection-buffer vec))

View file

@ -1265,15 +1265,19 @@ This is HOST, if non-nil. Otherwise, it is `tramp-default-host'."
lhost)
tramp-default-host))
(defun tramp-check-proper-host (vec)
"Check host name of VEC."
(defun tramp-check-proper-method-and-host (vec)
"Check method and host name of VEC."
(let ((method (tramp-file-name-method vec))
(user (tramp-file-name-user vec))
(host (tramp-file-name-host vec)))
(host (tramp-file-name-host vec))
(methods (mapcar 'car tramp-methods)))
(when (and method (not (member method methods)))
(tramp-cleanup-connection vec)
(tramp-user-error vec "Unknown method \"%s\"" method))
(when (and (equal tramp-syntax 'ftp) host
(or (null method) (get-text-property 0 'tramp-default method))
(or (null user) (get-text-property 0 'tramp-default user))
(member host (mapcar 'car tramp-methods)))
(member host methods))
(tramp-cleanup-connection vec)
(tramp-user-error vec "Host name must not match method \"%s\"" host))))

View file

@ -1,3 +1,14 @@
2013-09-13 Dmitry Antipov <dmantipov@yandex.ru>
* xterm.h (x_window_to_frame, x_any_window_to_frame)
(x_menubar_window_to_frame): Remove prototypes.
* xfns.c (x_window_to_frame, x_any_window_to_frame)
(x_menubar_window_to_frame, x_top_window_to_frame):
Move from here...
* xterm.c (x_window_to_frame, x_any_window_to_frame)
(x_menubar_window_to_frame, x_top_window_to_frame):
...to here and convert all but the last to static.
2013-09-12 Eli Zaretskii <eliz@gnu.org>
* lisp.mk (lisp): Add w32-common-fns.elc.

View file

@ -179,187 +179,6 @@ check_x_display_info (Lisp_Object object)
return dpyinfo;
}
/* Return the Emacs frame-object corresponding to an X window.
It could be the frame's main window or an icon window. */
/* This function can be called during GC, so use GC_xxx type test macros. */
struct frame *
x_window_to_frame (struct x_display_info *dpyinfo, int wdesc)
{
Lisp_Object tail, frame;
struct frame *f;
if (wdesc == None)
return NULL;
FOR_EACH_FRAME (tail, frame)
{
f = XFRAME (frame);
if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo)
continue;
if (f->output_data.x->hourglass_window == wdesc)
return f;
#ifdef USE_X_TOOLKIT
if ((f->output_data.x->edit_widget
&& XtWindow (f->output_data.x->edit_widget) == wdesc)
/* A tooltip frame? */
|| (!f->output_data.x->edit_widget
&& FRAME_X_WINDOW (f) == wdesc)
|| f->output_data.x->icon_desc == wdesc)
return f;
#else /* not USE_X_TOOLKIT */
#ifdef USE_GTK
if (f->output_data.x->edit_widget)
{
GtkWidget *gwdesc = xg_win_to_widget (dpyinfo->display, wdesc);
struct x_output *x = f->output_data.x;
if (gwdesc != 0 && gwdesc == x->edit_widget)
return f;
}
#endif /* USE_GTK */
if (FRAME_X_WINDOW (f) == wdesc
|| f->output_data.x->icon_desc == wdesc)
return f;
#endif /* not USE_X_TOOLKIT */
}
return 0;
}
#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
/* Like x_window_to_frame but also compares the window with the widget's
windows. */
struct frame *
x_any_window_to_frame (struct x_display_info *dpyinfo, int wdesc)
{
Lisp_Object tail, frame;
struct frame *f, *found = NULL;
struct x_output *x;
if (wdesc == None)
return NULL;
FOR_EACH_FRAME (tail, frame)
{
if (found)
break;
f = XFRAME (frame);
if (FRAME_X_P (f) && FRAME_X_DISPLAY_INFO (f) == dpyinfo)
{
/* This frame matches if the window is any of its widgets. */
x = f->output_data.x;
if (x->hourglass_window == wdesc)
found = f;
else if (x->widget)
{
#ifdef USE_GTK
GtkWidget *gwdesc = xg_win_to_widget (dpyinfo->display, wdesc);
if (gwdesc != 0
&& gtk_widget_get_toplevel (gwdesc) == x->widget)
found = f;
#else
if (wdesc == XtWindow (x->widget)
|| wdesc == XtWindow (x->column_widget)
|| wdesc == XtWindow (x->edit_widget))
found = f;
/* Match if the window is this frame's menubar. */
else if (lw_window_is_in_menubar (wdesc, x->menubar_widget))
found = f;
#endif
}
else if (FRAME_X_WINDOW (f) == wdesc)
/* A tooltip frame. */
found = f;
}
}
return found;
}
/* Likewise, but consider only the menu bar widget. */
struct frame *
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;
if (wdesc == None)
return NULL;
FOR_EACH_FRAME (tail, frame)
{
f = XFRAME (frame);
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. */
if (x->menubar_widget
&& lw_window_is_in_menubar (wdesc, x->menubar_widget))
return f;
#endif
}
return 0;
}
/* Return the frame whose principal (outermost) window is WDESC.
If WDESC is some other (smaller) window, we return 0. */
struct frame *
x_top_window_to_frame (struct x_display_info *dpyinfo, int wdesc)
{
Lisp_Object tail, frame;
struct frame *f;
struct x_output *x;
if (wdesc == None)
return NULL;
FOR_EACH_FRAME (tail, frame)
{
f = XFRAME (frame);
if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo)
continue;
x = f->output_data.x;
if (x->widget)
{
/* This frame matches if the window is its topmost widget. */
#ifdef USE_GTK
GtkWidget *gwdesc = xg_win_to_widget (dpyinfo->display, wdesc);
if (gwdesc == x->widget)
return f;
#else
if (wdesc == XtWindow (x->widget))
return f;
#if 0 /* I don't know why it did this,
but it seems logically wrong,
and it causes trouble for MapNotify events. */
/* Match if the window is this frame's menubar. */
if (x->menubar_widget
&& wdesc == XtWindow (x->menubar_widget))
return f;
#endif
#endif
}
else if (FRAME_X_WINDOW (f) == wdesc)
/* Tooltip frame. */
return f;
}
return 0;
}
#endif /* USE_X_TOOLKIT || USE_GTK */
/* Store the screen positions of frame F into XPTR and YPTR.
These are the positions of the containing window manager window,
not Emacs's own window. */

View file

@ -3398,6 +3398,181 @@ x_focus_changed (int type, int state, struct x_display_info *dpyinfo, struct fra
}
}
/* Return the Emacs frame-object corresponding to an X window.
It could be the frame's main window or an icon window. */
static struct frame *
x_window_to_frame (struct x_display_info *dpyinfo, int wdesc)
{
Lisp_Object tail, frame;
struct frame *f;
if (wdesc == None)
return NULL;
FOR_EACH_FRAME (tail, frame)
{
f = XFRAME (frame);
if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo)
continue;
if (f->output_data.x->hourglass_window == wdesc)
return f;
#ifdef USE_X_TOOLKIT
if ((f->output_data.x->edit_widget
&& XtWindow (f->output_data.x->edit_widget) == wdesc)
/* A tooltip frame? */
|| (!f->output_data.x->edit_widget
&& FRAME_X_WINDOW (f) == wdesc)
|| f->output_data.x->icon_desc == wdesc)
return f;
#else /* not USE_X_TOOLKIT */
#ifdef USE_GTK
if (f->output_data.x->edit_widget)
{
GtkWidget *gwdesc = xg_win_to_widget (dpyinfo->display, wdesc);
struct x_output *x = f->output_data.x;
if (gwdesc != 0 && gwdesc == x->edit_widget)
return f;
}
#endif /* USE_GTK */
if (FRAME_X_WINDOW (f) == wdesc
|| f->output_data.x->icon_desc == wdesc)
return f;
#endif /* not USE_X_TOOLKIT */
}
return 0;
}
#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
/* Like x_window_to_frame but also compares the window with the widget's
windows. */
static struct frame *
x_any_window_to_frame (struct x_display_info *dpyinfo, int wdesc)
{
Lisp_Object tail, frame;
struct frame *f, *found = NULL;
struct x_output *x;
if (wdesc == None)
return NULL;
FOR_EACH_FRAME (tail, frame)
{
if (found)
break;
f = XFRAME (frame);
if (FRAME_X_P (f) && FRAME_X_DISPLAY_INFO (f) == dpyinfo)
{
/* This frame matches if the window is any of its widgets. */
x = f->output_data.x;
if (x->hourglass_window == wdesc)
found = f;
else if (x->widget)
{
#ifdef USE_GTK
GtkWidget *gwdesc = xg_win_to_widget (dpyinfo->display, wdesc);
if (gwdesc != 0
&& gtk_widget_get_toplevel (gwdesc) == x->widget)
found = f;
#else
if (wdesc == XtWindow (x->widget)
|| wdesc == XtWindow (x->column_widget)
|| wdesc == XtWindow (x->edit_widget))
found = f;
/* Match if the window is this frame's menubar. */
else if (lw_window_is_in_menubar (wdesc, x->menubar_widget))
found = f;
#endif
}
else if (FRAME_X_WINDOW (f) == wdesc)
/* A tooltip frame. */
found = f;
}
}
return found;
}
/* Likewise, but consider only the menu bar widget. */
static struct frame *
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;
if (wdesc == None)
return NULL;
FOR_EACH_FRAME (tail, frame)
{
f = XFRAME (frame);
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. */
if (x->menubar_widget
&& lw_window_is_in_menubar (wdesc, x->menubar_widget))
return f;
#endif
}
return 0;
}
/* Return the frame whose principal (outermost) window is WDESC.
If WDESC is some other (smaller) window, we return 0. */
struct frame *
x_top_window_to_frame (struct x_display_info *dpyinfo, int wdesc)
{
Lisp_Object tail, frame;
struct frame *f;
struct x_output *x;
if (wdesc == None)
return NULL;
FOR_EACH_FRAME (tail, frame)
{
f = XFRAME (frame);
if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo)
continue;
x = f->output_data.x;
if (x->widget)
{
/* This frame matches if the window is its topmost widget. */
#ifdef USE_GTK
GtkWidget *gwdesc = xg_win_to_widget (dpyinfo->display, wdesc);
if (gwdesc == x->widget)
return f;
#else
if (wdesc == XtWindow (x->widget))
return f;
#endif
}
else if (FRAME_X_WINDOW (f) == wdesc)
/* Tooltip frame. */
return f;
}
return 0;
}
#else /* !USE_X_TOOLKIT && !USE_GTK */
#define x_any_window_to_frame(d, i) x_window_to_frame (d, i)
#define x_top_window_to_frame(d, i) x_window_to_frame (d, i)
#endif /* USE_X_TOOLKIT || USE_GTK */
/* The focus may have changed. Figure out if it is a real focus change,
by checking both FocusIn/Out and Enter/LeaveNotify events.

View file

@ -376,20 +376,6 @@ struct x_display_info
extern int use_xim;
#endif
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 *,
XEvent *);
extern struct frame *x_top_window_to_frame (struct x_display_info *, int);
extern struct frame *x_menubar_window_to_frame (struct x_display_info *,
XEvent *);
#if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK)
#define x_any_window_to_frame x_window_to_frame
#define x_top_window_to_frame x_window_to_frame
#endif
/* This is a chain of structures for all the X displays currently in use. */
extern struct x_display_info *x_display_list;
@ -400,7 +386,7 @@ extern struct x_display_info *x_display_list;
extern Lisp_Object x_display_name_list;
extern struct x_display_info *x_display_info_for_display (Display *);
extern struct frame *x_top_window_to_frame (struct x_display_info *, int);
extern struct x_display_info *x_term_init (Lisp_Object, char *, char *);
extern bool x_display_ok (const char *);