------------------------------------------------------------ revno: 118155 committer: Paul Eggert branch nick: trunk timestamp: Sat 2014-10-18 23:33:40 -0700 message: Merge from gnulib. This incorporates: 2014-10-18 readlinkat: port to AIX 7.1 2014-10-07 fcntl: fix error reporting by dupfd * lib/fcntl.c, lib/readlinkat.c, lib/unistd.in.h, m4/readlinkat.m4: * m4/unistd_h.m4: Update from gnulib. * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. diff: === modified file 'ChangeLog' --- ChangeLog 2014-10-17 18:05:48 +0000 +++ ChangeLog 2014-10-19 06:33:40 +0000 @@ -1,3 +1,12 @@ +2014-10-19 Paul Eggert + + Merge from gnulib, incorporating: + 2014-10-18 readlinkat: port to AIX 7.1 + 2014-10-07 fcntl: fix error reporting by dupfd + * lib/fcntl.c, lib/readlinkat.c, lib/unistd.in.h, m4/readlinkat.m4: + * m4/unistd_h.m4: Update from gnulib. + * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. + 2014-10-17 Glenn Morris * configure.ac: Simplify OS X $canonical tests. === modified file 'lib/fcntl.c' --- lib/fcntl.c 2014-01-01 07:43:34 +0000 +++ lib/fcntl.c 2014-10-19 06:33:40 +0000 @@ -89,8 +89,25 @@ inherit, /* InheritHandle */ DUPLICATE_SAME_ACCESS)) /* Options */ { - /* TODO: Translate GetLastError () into errno. */ - errno = EMFILE; + switch (GetLastError ()) + { + case ERROR_TOO_MANY_OPEN_FILES: + errno = EMFILE; + break; + case ERROR_INVALID_HANDLE: + case ERROR_INVALID_TARGET_HANDLE: + case ERROR_DIRECT_ACCESS_HANDLE: + errno = EBADF; + break; + case ERROR_INVALID_PARAMETER: + case ERROR_INVALID_FUNCTION: + case ERROR_INVALID_ACCESS: + errno = EINVAL; + break; + default: + errno = EACCES; + break; + } result = -1; break; } @@ -98,7 +115,6 @@ if (duplicated_fd < 0) { CloseHandle (new_handle); - errno = EMFILE; result = -1; break; } === modified file 'lib/gnulib.mk' --- lib/gnulib.mk 2014-08-30 22:59:39 +0000 +++ lib/gnulib.mk 2014-10-19 06:33:40 +0000 @@ -21,7 +21,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=close --avoid=dup --avoid=fchdir --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=open --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=sigprocmask --avoid=stdarg --avoid=stdbool --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt binary-io byteswap c-ctype c-strcase careadlinkat close-stream count-one-bits count-trailing-zeros crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl fcntl-h fdatasync fdopendir filemode fstatat fsync getloadavg getopt-gnu gettime gettimeofday intprops largefile lstat manywarnings memrchr mkostemp mktime pipe2 pselect pthread_sigmask putenv qacl readlink readlinkat sig2str socklen stat-time stdalign stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timer-time timespec-add timespec-sub unsetenv update-copyright utimens vla warnings +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=close --avoid=dup --avoid=fchdir --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=open --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=sigprocmask --avoid=stdarg --avoid=stdbool --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt binary-io byteswap c-ctype c-strcase careadlinkat close-stream count-one-bits count-trailing-zeros crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl fcntl-h fdatasync fdopendir filemode fstatat fsync getloadavg getopt-gnu gettime gettimeofday intprops largefile lstat manywarnings memrchr mkostemp mktime pipe2 pselect pthread_sigmask putenv qacl readlink readlinkat sig2str socklen stat-time stdalign stdio strftime strtoimax strtoumax symlink sys_stat sys_time time time_r timer-time timespec-add timespec-sub unsetenv update-copyright utimens vla warnings MOSTLYCLEANFILES += core *.stackdump @@ -1748,9 +1748,11 @@ -e 's|@''REPLACE_PWRITE''@|$(REPLACE_PWRITE)|g' \ -e 's|@''REPLACE_READ''@|$(REPLACE_READ)|g' \ -e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \ + -e 's|@''REPLACE_READLINKAT''@|$(REPLACE_READLINKAT)|g' \ -e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \ -e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \ -e 's|@''REPLACE_SYMLINK''@|$(REPLACE_SYMLINK)|g' \ + -e 's|@''REPLACE_SYMLINKAT''@|$(REPLACE_SYMLINKAT)|g' \ -e 's|@''REPLACE_TTYNAME_R''@|$(REPLACE_TTYNAME_R)|g' \ -e 's|@''REPLACE_UNLINK''@|$(REPLACE_UNLINK)|g' \ -e 's|@''REPLACE_UNLINKAT''@|$(REPLACE_UNLINKAT)|g' \ === modified file 'lib/readlinkat.c' --- lib/readlinkat.c 2014-01-01 07:43:34 +0000 +++ lib/readlinkat.c 2014-10-19 06:33:40 +0000 @@ -20,6 +20,18 @@ #include +#if HAVE_READLINKAT + +# undef readlinkat + +ssize_t +rpl_readlinkat (int fd, char const *file, char *buf, size_t len) +{ + return readlinkat (fd, file, buf, len); +} + +#else + /* Gnulib provides a readlink stub for mingw; use it for distinction between EINVAL and ENOENT, rather than always failing with ENOSYS. */ @@ -34,14 +46,16 @@ then readlink/restore_cwd. If either the save_cwd or the restore_cwd fails, then give a diagnostic and exit nonzero. */ -#define AT_FUNC_NAME readlinkat -#define AT_FUNC_F1 readlink -#define AT_FUNC_POST_FILE_PARAM_DECLS , char *buf, size_t len -#define AT_FUNC_POST_FILE_ARGS , buf, len -#define AT_FUNC_RESULT ssize_t -#include "at-func.c" -#undef AT_FUNC_NAME -#undef AT_FUNC_F1 -#undef AT_FUNC_POST_FILE_PARAM_DECLS -#undef AT_FUNC_POST_FILE_ARGS -#undef AT_FUNC_RESULT +# define AT_FUNC_NAME readlinkat +# define AT_FUNC_F1 readlink +# define AT_FUNC_POST_FILE_PARAM_DECLS , char *buf, size_t len +# define AT_FUNC_POST_FILE_ARGS , buf, len +# define AT_FUNC_RESULT ssize_t +# include "at-func.c" +# undef AT_FUNC_NAME +# undef AT_FUNC_F1 +# undef AT_FUNC_POST_FILE_PARAM_DECLS +# undef AT_FUNC_POST_FILE_ARGS +# undef AT_FUNC_RESULT + +#endif === modified file 'lib/unistd.in.h' --- lib/unistd.in.h 2014-02-25 19:21:05 +0000 +++ lib/unistd.in.h 2014-10-19 06:33:40 +0000 @@ -1287,13 +1287,24 @@ #if @GNULIB_READLINKAT@ -# if !@HAVE_READLINKAT@ +# if @REPLACE_READLINKAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define readlinkat rpl_readlinkat +# endif +_GL_FUNCDECL_RPL (readlinkat, ssize_t, + (int fd, char const *file, char *buf, size_t len) + _GL_ARG_NONNULL ((2, 3))); +_GL_CXXALIAS_RPL (readlinkat, ssize_t, + (int fd, char const *file, char *buf, size_t len)); +# else +# if !@HAVE_READLINKAT@ _GL_FUNCDECL_SYS (readlinkat, ssize_t, (int fd, char const *file, char *buf, size_t len) _GL_ARG_NONNULL ((2, 3))); -# endif +# endif _GL_CXXALIAS_SYS (readlinkat, ssize_t, (int fd, char const *file, char *buf, size_t len)); +# endif _GL_CXXALIASWARN (readlinkat); #elif defined GNULIB_POSIXCHECK # undef readlinkat @@ -1407,13 +1418,25 @@ #if @GNULIB_SYMLINKAT@ -# if !@HAVE_SYMLINKAT@ +# if @REPLACE_SYMLINKAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef symlinkat +# define symlinkat rpl_symlinkat +# endif +_GL_FUNCDECL_RPL (symlinkat, int, + (char const *contents, int fd, char const *file) + _GL_ARG_NONNULL ((1, 3))); +_GL_CXXALIAS_RPL (symlinkat, int, + (char const *contents, int fd, char const *file)); +# else +# if !@HAVE_SYMLINKAT@ _GL_FUNCDECL_SYS (symlinkat, int, (char const *contents, int fd, char const *file) _GL_ARG_NONNULL ((1, 3))); -# endif +# endif _GL_CXXALIAS_SYS (symlinkat, int, (char const *contents, int fd, char const *file)); +# endif _GL_CXXALIASWARN (symlinkat); #elif defined GNULIB_POSIXCHECK # undef symlinkat === modified file 'm4/gnulib-comp.m4' --- m4/gnulib-comp.m4 2014-08-30 22:59:39 +0000 +++ m4/gnulib-comp.m4 2014-10-19 06:33:40 +0000 @@ -322,7 +322,7 @@ fi gl_UNISTD_MODULE_INDICATOR([readlink]) gl_FUNC_READLINKAT - if test $HAVE_READLINKAT = 0; then + if test $HAVE_READLINKAT = 0 || test $REPLACE_READLINKAT = 1; then AC_LIBOBJ([readlinkat]) fi gl_UNISTD_MODULE_INDICATOR([readlinkat]) === modified file 'm4/readlinkat.m4' --- m4/readlinkat.m4 2014-01-01 07:43:34 +0000 +++ m4/readlinkat.m4 2014-10-19 06:33:40 +0000 @@ -1,4 +1,4 @@ -# serial 3 +# serial 4 # See if we need to provide readlinkat replacement. dnl Copyright (C) 2009-2014 Free Software Foundation, Inc. @@ -15,5 +15,18 @@ AC_CHECK_FUNCS_ONCE([readlinkat]) if test $ac_cv_func_readlinkat = no; then HAVE_READLINKAT=0 + else + AC_CACHE_CHECK([whether readlinkat signature is correct], + [gl_cv_decl_readlinkat_works], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + /* Check whether original declaration has correct type. */ + ssize_t readlinkat (int, char const *, char *, size_t);]])], + [gl_cv_decl_readlinkat_works=yes], + [gl_cv_decl_readlinkat_works=no])]) + if test "$gl_cv_decl_readlink_works" != yes; then + REPLACE_READLINKAT=1 + fi fi ]) === modified file 'm4/unistd_h.m4' --- m4/unistd_h.m4 2014-01-01 07:43:34 +0000 +++ m4/unistd_h.m4 2014-10-19 06:33:40 +0000 @@ -1,4 +1,4 @@ -# unistd_h.m4 serial 67 +# unistd_h.m4 serial 68 dnl Copyright (C) 2006-2014 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -173,9 +173,11 @@ REPLACE_PWRITE=0; AC_SUBST([REPLACE_PWRITE]) REPLACE_READ=0; AC_SUBST([REPLACE_READ]) REPLACE_READLINK=0; AC_SUBST([REPLACE_READLINK]) + REPLACE_READLINKAT=0; AC_SUBST([REPLACE_READLINKAT]) REPLACE_RMDIR=0; AC_SUBST([REPLACE_RMDIR]) REPLACE_SLEEP=0; AC_SUBST([REPLACE_SLEEP]) REPLACE_SYMLINK=0; AC_SUBST([REPLACE_SYMLINK]) + REPLACE_SYMLINKAT=0; AC_SUBST([REPLACE_SYMLINKAT]) REPLACE_TTYNAME_R=0; AC_SUBST([REPLACE_TTYNAME_R]) REPLACE_UNLINK=0; AC_SUBST([REPLACE_UNLINK]) REPLACE_UNLINKAT=0; AC_SUBST([REPLACE_UNLINKAT]) ------------------------------------------------------------ revno: 118154 committer: Stefan Monnier branch nick: trunk timestamp: Sat 2014-10-18 22:14:58 -0400 message: * lisp/emacs-lisp/eieio: A bit more cleanup, removing compat code. * lisp/emacs-lisp/eieio-core.el (eieio-compiled-function-arglist): Remove. (eieio--with-scoped-class): Use `declare'. (eieio-defclass): Remove compatibility code. (no-method-definition, no-next-method, inconsistent-class-hierarchy) (invalid-slot-type, unbound-slot, invalid-slot-name): Use define-error. * lisp/emacs-lisp/eieio-opt.el (eieio-lambda-arglist): Remove. Use help-function-arglist instead. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-10-18 16:26:47 +0000 +++ lisp/ChangeLog 2014-10-19 02:14:58 +0000 @@ -1,3 +1,14 @@ +2014-10-19 Stefan Monnier + + * emacs-lisp/eieio-opt.el (eieio-lambda-arglist): Remove. + Use help-function-arglist instead. + + * emacs-lisp/eieio-core.el (eieio-compiled-function-arglist): Remove. + (eieio--with-scoped-class): Use `declare'. + (eieio-defclass): Remove compatibility code. + (no-method-definition, no-next-method, inconsistent-class-hierarchy) + (invalid-slot-type, unbound-slot, invalid-slot-name): Use define-error. + 2014-10-18 Jan Djärv * cus-start.el (x-gtk-whole-detached-tool-bar): Remove. @@ -33,7 +44,7 @@ 2014-10-17 Michal Nazarewicz - * textmodes/tildify.el (tildify--pick-alist-entry): rename from + * textmodes/tildify.el (tildify--pick-alist-entry): Rename from tildify-mode-alist. 2014-10-17 Stefan Monnier === modified file 'lisp/emacs-lisp/eieio-core.el' --- lisp/emacs-lisp/eieio-core.el 2014-10-17 05:09:24 +0000 +++ lisp/emacs-lisp/eieio-core.el 2014-10-19 02:14:58 +0000 @@ -33,20 +33,6 @@ (require 'cl-lib) -;; Compatibility -(if (fboundp 'compiled-function-arglist) - - ;; XEmacs can only access a compiled functions arglist like this: - (defalias 'eieio-compiled-function-arglist 'compiled-function-arglist) - - ;; Emacs doesn't have this function, but since FUNC is a vector, we can just - ;; grab the appropriate element. - (defun eieio-compiled-function-arglist (func) - "Return the argument list for the compiled function FUNC." - (aref func 0)) - - ) - (put 'eieio--defalias 'byte-hunk-handler #'byte-compile-file-form-defalias) ;;(get 'defalias 'byte-hunk-handler) (defun eieio--defalias (name body) @@ -117,12 +103,12 @@ (defmacro eieio--with-scoped-class (class &rest forms) "Set CLASS as the currently scoped class while executing FORMS." + (declare (indent 1)) `(unwind-protect (progn (push ,class eieio--scoped-class-stack) ,@forms) (pop eieio--scoped-class-stack))) -(put 'eieio--with-scoped-class 'lisp-indent-function 1) ;;; ;; Field Accessors @@ -678,26 +664,12 @@ ;; Else - Some error? nil? nil))) - (if (fboundp 'gv-define-setter) - ;; FIXME: We should move more of eieio-defclass into the - ;; defclass macro so we don't have to use `eval' and require - ;; `gv' at run-time. - (eval `(gv-define-setter ,acces (eieio--store eieio--object) - (list 'eieio-oset eieio--object '',name - eieio--store))) - ;; Provide a setf method. It would be cleaner to use - ;; defsetf, but that would require CL at runtime. - (put acces 'setf-method - `(lambda (widget) - (let* ((--widget-sym-- (make-symbol "--widget--")) - (--store-sym-- (make-symbol "--store--"))) - (list - (list --widget-sym--) - (list widget) - (list --store-sym--) - (list 'eieio-oset --widget-sym-- '',name - --store-sym--) - (list 'getfoo --widget-sym--)))))))) + ;; FIXME: We should move more of eieio-defclass into the + ;; defclass macro so we don't have to use `eval' and require + ;; `gv' at run-time. + (eval `(gv-define-setter ,acces (eieio--store eieio--object) + (list 'eieio-oset eieio--object '',name + eieio--store))))) ;; If a writer is defined, then create a generic method of that ;; name whose purpose is to set the value of the slot. @@ -2099,30 +2071,12 @@ ;;; Here are some special types of errors ;; -(intern "no-method-definition") -(put 'no-method-definition 'error-conditions '(no-method-definition error)) -(put 'no-method-definition 'error-message "No method definition") - -(intern "no-next-method") -(put 'no-next-method 'error-conditions '(no-next-method error)) -(put 'no-next-method 'error-message "No next method") - -(intern "invalid-slot-name") -(put 'invalid-slot-name 'error-conditions '(invalid-slot-name error)) -(put 'invalid-slot-name 'error-message "Invalid slot name") - -(intern "invalid-slot-type") -(put 'invalid-slot-type 'error-conditions '(invalid-slot-type error nil)) -(put 'invalid-slot-type 'error-message "Invalid slot type") - -(intern "unbound-slot") -(put 'unbound-slot 'error-conditions '(unbound-slot error nil)) -(put 'unbound-slot 'error-message "Unbound slot") - -(intern "inconsistent-class-hierarchy") -(put 'inconsistent-class-hierarchy 'error-conditions - '(inconsistent-class-hierarchy error nil)) -(put 'inconsistent-class-hierarchy 'error-message "Inconsistent class hierarchy") +(define-error 'no-method-definition "No method definition") +(define-error 'no-next-method "No next method") +(define-error 'invalid-slot-name "Invalid slot name") +(define-error 'invalid-slot-type "Invalid slot type") +(define-error 'unbound-slot "Unbound slot") +(define-error 'inconsistent-class-hierarchy "Inconsistent class hierarchy") ;;; Obsolete backward compatibility functions. ;; Needed to run byte-code compiled with the EIEIO of Emacs-23. === modified file 'lisp/emacs-lisp/eieio-opt.el' --- lisp/emacs-lisp/eieio-opt.el 2014-05-14 20:41:53 +0000 +++ lisp/emacs-lisp/eieio-opt.el 2014-10-19 02:14:58 +0000 @@ -356,7 +356,7 @@ (insert "' " (aref prefix i) " ") ;; argument list (let* ((func (cdr (car gm))) - (arglst (eieio-lambda-arglist func))) + (arglst (help-function-arglist func))) (prin1 arglst (current-buffer))) (insert "\n" (or (documentation (cdr (car gm))) @@ -374,13 +374,6 @@ (insert "\n"))) (setq i (1+ i))))))) -(defun eieio-lambda-arglist (func) - "Return the argument list of FUNC, a function body." - (if (symbolp func) (setq func (symbol-function func))) - (if (byte-code-function-p func) - (eieio-compiled-function-arglist func) - (car (cdr func)))) - (defun eieio-all-generic-functions (&optional class) "Return a list of all generic functions. Optional CLASS argument returns only those functions that contain @@ -419,15 +412,15 @@ (fboundp after))) nil (list (if (fboundp before) - (cons (eieio-lambda-arglist before) + (cons (help-function-arglist before) (documentation before)) nil) (if (fboundp primary) - (cons (eieio-lambda-arglist primary) + (cons (help-function-arglist primary) (documentation primary)) nil) (if (fboundp after) - (cons (eieio-lambda-arglist after) + (cons (help-function-arglist after) (documentation after)) nil)))))) === modified file 'lisp/emacs-lisp/eieio.el' --- lisp/emacs-lisp/eieio.el 2014-10-17 05:09:24 +0000 +++ lisp/emacs-lisp/eieio.el 2014-10-19 02:14:58 +0000 @@ -910,7 +910,7 @@ ;;;*** -;;;### (autoloads nil "eieio-opt" "eieio-opt.el" "99b94c63a73593402e3c825178a44f4f") +;;;### (autoloads nil "eieio-opt" "eieio-opt.el" "889c0a935dddf758dbb65488470ffa06") ;;; Generated autoloads from eieio-opt.el (autoload 'eieio-browse "eieio-opt" "\ ------------------------------------------------------------ revno: 118153 committer: Paul Eggert branch nick: trunk timestamp: Sat 2014-10-18 12:07:17 -0700 message: * gtkutil.c: Remove no-longer-used code. (xg_update_menubar): Remove unused local and unnecessary call to gtk_menu_item_get_submenu. (XG_TOOL_BAR_PROXY_BUTTON, xg_tool_bar_proxy_callback) (xg_get_tool_bar_widgets, xg_tool_bar_proxy_help_callback) (TOOLBAR_TOP_WIDGET): Remove; no longer used. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-10-18 16:25:24 +0000 +++ src/ChangeLog 2014-10-18 19:07:17 +0000 @@ -1,3 +1,12 @@ +2014-10-18 Paul Eggert + + * gtkutil.c: Remove no-longer-used code. + (xg_update_menubar): Remove unused local and unnecessary call to + gtk_menu_item_get_submenu. + (XG_TOOL_BAR_PROXY_BUTTON, xg_tool_bar_proxy_callback) + (xg_get_tool_bar_widgets, xg_tool_bar_proxy_help_callback) + (TOOLBAR_TOP_WIDGET): Remove; no longer used. + 2014-10-18 Jan Djärv * xfns.c (syms_of_xfns): Remove x-gtk-whole-detached-tool-bar. === modified file 'src/gtkutil.c' --- src/gtkutil.c 2014-10-18 16:19:53 +0000 +++ src/gtkutil.c 2014-10-18 19:07:17 +0000 @@ -2789,7 +2789,6 @@ is up to date when leaving the minibuffer. */ GtkLabel *wlabel = GTK_LABEL (XG_BIN_CHILD (witem)); char *utf8_label = get_utf8_string (val->name); - GtkWidget *submenu = gtk_menu_item_get_submenu (witem); /* GTK menu items don't notice when their labels have been changed from underneath them, so we have to explicitly @@ -3981,9 +3980,6 @@ get them. */ #define XG_TOOL_BAR_LAST_MODIFIER "emacs-tool-bar-modifier" -/* The key for storing the button widget in its proxy menu item. */ -#define XG_TOOL_BAR_PROXY_BUTTON "emacs-tool-bar-proxy-button" - /* The key for the data we put in the GtkImage widgets. The data is the stock name used by Emacs. We use this to see if we need to update the GtkImage with a new image. */ @@ -4056,41 +4052,6 @@ x_focus_frame (f); } -/* Callback function invoked when a tool bar item is pressed in a detached - tool bar or the overflow drop down menu. - We just call xg_tool_bar_callback. - W is the menu item widget that got pressed, - CLIENT_DATA is an integer that is the index of the button in the - tool bar. 0 is the first button. */ - -static void -xg_tool_bar_proxy_callback (GtkWidget *w, gpointer client_data) -{ - GtkWidget *wbutton = GTK_WIDGET (g_object_get_data (G_OBJECT (w), - XG_TOOL_BAR_PROXY_BUTTON)); - xg_tool_bar_callback (wbutton, client_data); -} - - -static gboolean -xg_tool_bar_help_callback (GtkWidget *w, - GdkEventCrossing *event, - gpointer client_data); - -/* This callback is called when a help is to be shown for an item in - the detached tool bar when the detached tool bar it is not expanded. */ - -static gboolean -xg_tool_bar_proxy_help_callback (GtkWidget *w, - GdkEventCrossing *event, - gpointer client_data) -{ - GtkWidget *wbutton = GTK_WIDGET (g_object_get_data (G_OBJECT (w), - XG_TOOL_BAR_PROXY_BUTTON)); - - return xg_tool_bar_help_callback (wbutton, event, client_data); -} - static GtkWidget * xg_get_tool_bar_widgets (GtkWidget *vb, GtkWidget **wimage) { @@ -4183,8 +4144,6 @@ gtk_toolbar_set_orientation (GTK_TOOLBAR (w), o) #endif -#define TOOLBAR_TOP_WIDGET(x) ((x)->toolbar_widget) - /* Attach a tool bar to frame F. */ static void @@ -4696,7 +4655,7 @@ if (!NILP (specified_file) && !NILP (Ffboundp (Qx_gtk_map_stock))) stock = call1 (Qx_gtk_map_stock, specified_file); - if (CONSP (stock)) + if (CONSP (stock)) { Lisp_Object tem; for (tem = stock; CONSP (tem); tem = XCDR (tem)) ------------------------------------------------------------ revno: 118152 committer: Jan D. branch nick: trunk timestamp: Sat 2014-10-18 18:26:47 +0200 message: * cus-start.el (x-gtk-whole-detached-tool-bar): Remove. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-10-18 16:19:53 +0000 +++ lisp/ChangeLog 2014-10-18 16:26:47 +0000 @@ -1,5 +1,7 @@ 2014-10-18 Jan Djärv + * cus-start.el (x-gtk-whole-detached-tool-bar): Remove. + * term/x-win.el (x-gtk-stock-map): Add icon names suggested as replacements to stock names before stock names in a list. Cdr may be a list, each name is tried in turn until one is found. === modified file 'lisp/cus-start.el' --- lisp/cus-start.el 2014-10-11 20:00:59 +0000 +++ lisp/cus-start.el 2014-10-18 16:26:47 +0000 @@ -522,7 +522,6 @@ (x-gtk-use-old-file-dialog menu boolean "22.1") (x-gtk-show-hidden-files menu boolean "22.1") (x-gtk-file-dialog-help-text menu boolean "22.1") - (x-gtk-whole-detached-tool-bar x boolean "22.1") (x-gtk-use-system-tooltips tooltip boolean "23.3") ;; xterm.c (x-use-underline-position-properties display boolean "22.1") ------------------------------------------------------------ revno: 118151 committer: Jan D. branch nick: trunk timestamp: Sat 2014-10-18 18:25:24 +0200 message: * xfns.c (syms_of_xfns): Remove x-gtk-whole-detached-tool-bar. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-10-18 16:19:53 +0000 +++ src/ChangeLog 2014-10-18 16:25:24 +0000 @@ -1,5 +1,7 @@ 2014-10-18 Jan Djärv + * xfns.c (syms_of_xfns): Remove x-gtk-whole-detached-tool-bar. + * xterm.h (handlebox_widget): Remove. * xmenu.c (set_frame_menubar): Remove GTK block that calls === modified file 'src/xfns.c' --- src/xfns.c 2014-10-14 12:45:41 +0000 +++ src/xfns.c 2014-10-18 16:25:24 +0000 @@ -6162,12 +6162,6 @@ to turn the additional text off. */); x_gtk_file_dialog_help_text = 1; - DEFVAR_BOOL ("x-gtk-whole-detached-tool-bar", x_gtk_whole_detached_tool_bar, - doc: /* If non-nil, a detached tool bar is shown in full. -The default is to just show an arrow and pressing on that arrow shows -the tool bar buttons. */); - x_gtk_whole_detached_tool_bar = 0; - DEFVAR_BOOL ("x-gtk-use-system-tooltips", x_gtk_use_system_tooltips, doc: /* If non-nil with a Gtk+ built Emacs, the Gtk+ tooltip is used. Otherwise use Emacs own tooltip implementation. ------------------------------------------------------------ revno: 118150 committer: Jan D. branch nick: trunk timestamp: Sat 2014-10-18 18:19:53 +0200 message: Handle deprecated Gtk+ stuff for version <= 3.10 * lisp/term/x-win.el (x-gtk-stock-map): Add icon names suggested as replacements to stock names before stock names in a list. Cdr may be a list, each name is tried in turn until one is found. * src/gtkutil.c (XG_TEXT_CANCEL, XG_TEXT_OPEN, XG_TEXT_OK): New defines to handle Gtk versions. (xg_get_file_with_chooser): Use them. (xg_have_tear_offs, tearoff_remove, tearoff_activate): Remove (create_menus): Remove teroff argument and code. Remove call to gtk_menu_set_title. (xg_update_menubar, xg_update_submenu): Remove tearoff code. Adjust args to create_menus. (xg_tool_bar_menu_proxy, xg_tool_bar_detach_callback) (xg_tool_bar_attach_callback, TOOLBAR_TOP_WIDGET): Remove. (xg_pack_tool_bar): Replace TOOLBAR_TOP_WIDGET, remove detach code. (xg_make_tool_item): Remove detach code. (xg_update_tool_bar_sizes): Replace TOOLBAR_TOP_WIDGET. (find_icon_from_name): New function. (update_frame_tool_bar): Remove GtkStockItem code, move to find_icon_from_name. Let stock be a list of icon names to try. Only use gtk_image_new_from_stock on Gtk+ < 3.10. Replace TOOLBAR_TOP_WIDGET. (free_frame_tool_bar, xg_change_toolbar_position ): Replace TOOLBAR_TOP_WIDGET. (xg_initialize): Remove tearoff code. * src/gtkutil.h (xg_have_tear_offs): Remove declaration. * src/xmenu.c (set_frame_menubar): Remove GTK block that calls xg_have_tear_offs. * src/xterm.h (handlebox_widget): Remove. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-10-18 10:02:59 +0000 +++ lisp/ChangeLog 2014-10-18 16:19:53 +0000 @@ -1,3 +1,9 @@ +2014-10-18 Jan Djärv + + * term/x-win.el (x-gtk-stock-map): Add icon names suggested as + replacements to stock names before stock names in a list. + Cdr may be a list, each name is tried in turn until one is found. + 2014-10-18 Alan Mackenzie Check that a "macro" found near point-min isn't a ## operator. === modified file 'lisp/term/x-win.el' --- lisp/term/x-win.el 2014-10-10 03:28:24 +0000 +++ lisp/term/x-win.el 2014-10-18 16:19:53 +0000 @@ -1484,47 +1484,47 @@ (mapcar (lambda (arg) (cons (purecopy (car arg)) (purecopy (cdr arg)))) '( - ("etc/images/new" . "gtk-new") - ("etc/images/open" . "gtk-open") + ("etc/images/new" . ("document-new" "gtk-new")) + ("etc/images/open" . ("document-open" "gtk-open")) ("etc/images/diropen" . "n:system-file-manager") - ("etc/images/close" . "gtk-close") - ("etc/images/save" . "gtk-save") - ("etc/images/saveas" . "gtk-save-as") - ("etc/images/undo" . "gtk-undo") - ("etc/images/cut" . "gtk-cut") - ("etc/images/copy" . "gtk-copy") - ("etc/images/paste" . "gtk-paste") - ("etc/images/search" . "gtk-find") - ("etc/images/print" . "gtk-print") - ("etc/images/preferences" . "gtk-preferences") - ("etc/images/help" . "gtk-help") - ("etc/images/left-arrow" . "gtk-go-back") - ("etc/images/right-arrow" . "gtk-go-forward") - ("etc/images/home" . "gtk-home") - ("etc/images/jump-to" . "gtk-jump-to") + ("etc/images/close" . ("window-close" "gtk-close")) + ("etc/images/save" . ("document-save" "gtk-save")) + ("etc/images/saveas" . ("document-save-as" "gtk-save-as")) + ("etc/images/undo" . ("edit-undo" "gtk-undo")) + ("etc/images/cut" . ("edit-cut" "gtk-cut")) + ("etc/images/copy" . ("edit-copy" "gtk-copy")) + ("etc/images/paste" . ("edit-paste" "gtk-paste")) + ("etc/images/search" . ("edit-find" "gtk-find")) + ("etc/images/print" . ("document-print" "gtk-print")) + ("etc/images/preferences" . ("preferences-system" "gtk-preferences")) + ("etc/images/help" . ("help-browser" "gtk-help")) + ("etc/images/left-arrow" . ("go-previous" "gtk-go-back")) + ("etc/images/right-arrow" . ("go-next" "gtk-go-forward")) + ("etc/images/home" . ("go-home" "gtk-home")) + ("etc/images/jump-to" . ("go-jump" "gtk-jump-to")) ("etc/images/index" . "gtk-index") - ("etc/images/search" . "gtk-find") - ("etc/images/exit" . "gtk-quit") + ("etc/images/exit" . ("application-exit" "gtk-quit")) ("etc/images/cancel" . "gtk-cancel") - ("etc/images/info" . "gtk-info") + ("etc/images/info" . ("dialog-information" "gtk-info")) ("etc/images/bookmark_add" . "n:bookmark_add") ;; Used in Gnus and/or MH-E: ("etc/images/attach" . "gtk-attach") ("etc/images/connect" . "gtk-connect") ("etc/images/contact" . "gtk-contact") - ("etc/images/delete" . "gtk-delete") - ("etc/images/describe" . "gtk-properties") + ("etc/images/delete" . ("edit-delete" "gtk-delete")) + ("etc/images/describe" . ("ocument-properties" "gtk-properties")) ("etc/images/disconnect" . "gtk-disconnect") ;; ("etc/images/exit" . "gtk-exit") ("etc/images/lock-broken" . "gtk-lock_broken") ("etc/images/lock-ok" . "gtk-lock_ok") ("etc/images/lock" . "gtk-lock") ("etc/images/next-page" . "gtk-next-page") - ("etc/images/refresh" . "gtk-refresh") - ("etc/images/sort-ascending" . "gtk-sort-ascending") + ("etc/images/refresh" . ("view-refresh" "gtk-refresh")) + ("etc/images/sort-ascending" . ("view-sort-ascending" "gtk-sort-ascending")) ("etc/images/sort-column-ascending" . "gtk-sort-column-ascending") ("etc/images/sort-criteria" . "gtk-sort-criteria") - ("etc/images/sort-descending" . "gtk-sort-descending") + ("etc/images/sort-descending" . ("view-sort-descending" + "gtk-sort-descending")) ("etc/images/sort-row-ascending" . "gtk-sort-row-ascending") ("images/gnus/toggle-subscription" . "gtk-task-recurring") ("images/mail/compose" . "gtk-mail-compose") @@ -1541,8 +1541,8 @@ ("images/mail/spam" . "gtk-spam") ;; Used for GDB Graphical Interface ("images/gud/break" . "gtk-no") - ("images/gud/recstart" . "gtk-media-record") - ("images/gud/recstop" . "gtk-media-stop") + ("images/gud/recstart" . ("media-record" "gtk-media-record")) + ("images/gud/recstop" . ("media-playback-stop" "gtk-media-stop")) ;; No themed versions available: ;; mail/preview (combining stock_mail and stock_zoom) ;; mail/save (combining stock_mail, stock_save and stock_convert) @@ -1551,9 +1551,12 @@ Emacs must be compiled with the Gtk+ toolkit for this to have any effect. A value that begins with n: denotes a named icon instead of a stock icon." :version "22.2" - :type '(choice (repeat (choice symbol - (cons (string :tag "Emacs icon") - (string :tag "Stock/named"))))) + :type '(choice (repeat + (choice symbol + (cons (string :tag "Emacs icon") + (choice (group (string :tag "Named") + (string :tag "Stock")) + (string :tag "Stock/named")))))) :group 'x) (defcustom icon-map-list '(x-gtk-stock-map) === modified file 'src/ChangeLog' --- src/ChangeLog 2014-10-18 13:09:18 +0000 +++ src/ChangeLog 2014-10-18 16:19:53 +0000 @@ -1,3 +1,34 @@ +2014-10-18 Jan Djärv + + * xterm.h (handlebox_widget): Remove. + + * xmenu.c (set_frame_menubar): Remove GTK block that calls + xg_have_tear_offs. + + * gtkutil.h (xg_have_tear_offs): Remove declaration. + + * gtkutil.c (XG_TEXT_CANCEL, XG_TEXT_OPEN, XG_TEXT_OK): New defines + to handle Gtk versions. + (xg_get_file_with_chooser): Use them. + (xg_have_tear_offs, tearoff_remove, tearoff_activate): Remove + (create_menus): Remove teroff argument and code. + Remove call to gtk_menu_set_title. + (xg_update_menubar, xg_update_submenu): Remove tearoff code. Adjust + args to create_menus. + (xg_tool_bar_menu_proxy, xg_tool_bar_detach_callback) + (xg_tool_bar_attach_callback, TOOLBAR_TOP_WIDGET): Remove. + (xg_pack_tool_bar): Replace TOOLBAR_TOP_WIDGET, remove detach code. + (xg_make_tool_item): Remove detach code. + (xg_update_tool_bar_sizes): Replace TOOLBAR_TOP_WIDGET. + (find_icon_from_name): New function. + (update_frame_tool_bar): Remove GtkStockItem code, move to + find_icon_from_name. Let stock be a list of icon names to try. + Only use gtk_image_new_from_stock on Gtk+ < 3.10. + Replace TOOLBAR_TOP_WIDGET. + (free_frame_tool_bar, xg_change_toolbar_position ): Replace + TOOLBAR_TOP_WIDGET. + (xg_initialize): Remove tearoff code. + 2014-10-18 Eli Zaretskii * xterm.c (x_draw_bar_cursor, x_draw_hollow_cursor): Subtract 1 === modified file 'src/gtkutil.c' --- src/gtkutil.c 2014-10-04 12:28:41 +0000 +++ src/gtkutil.c 2014-10-18 16:19:53 +0000 @@ -93,6 +93,16 @@ #endif #endif /* HAVE_FREETYPE */ +#if GTK_CHECK_VERSION (3, 10, 0) +#define XG_TEXT_CANCEL "Cancel" +#define XG_TEXT_OK "OK" +#define XG_TEXT_OPEN "Open" +#else +#define XG_TEXT_CANCEL GTK_STOCK_CANCEL +#define XG_TEXT_OK GTK_STOCK_OK +#define XG_TEXT_OPEN GTK_STOCK_OPEN +#endif + #ifndef HAVE_GTK3 #ifdef USE_GTK_TOOLTIP #define gdk_window_get_screen(w) gdk_drawable_get_screen (w) @@ -1774,9 +1784,9 @@ action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER; filewin = gtk_file_chooser_dialog_new (prompt, gwin, action, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + XG_TEXT_CANCEL, GTK_RESPONSE_CANCEL, (mustmatch_p || only_dir_p ? - GTK_STOCK_OPEN : GTK_STOCK_OK), + XG_TEXT_OPEN : XG_TEXT_OK), GTK_RESPONSE_OK, NULL); gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (filewin), TRUE); @@ -2356,57 +2366,6 @@ return w; } -#ifdef HAVE_GTK_TEAROFF_MENU_ITEM_NEW - -static int xg_detached_menus; - -/* Return true if there are detached menus. */ - -bool -xg_have_tear_offs (struct frame *f) -{ - /* If the frame's menubar height is zero, the menu bar is probably - being redirected outside the window to some kind of global menu; - this situation is the moral equivalent of a tear-off. */ - return FRAME_MENUBAR_HEIGHT (f) == 0 || xg_detached_menus > 0; -} - -/* Callback invoked when a detached menu window is removed. Here we - decrease the xg_detached_menus count. - WIDGET is the top level window that is removed (the parent of the menu). - CLIENT_DATA is not used. */ - -static void -tearoff_remove (GtkWidget *widget, gpointer client_data) -{ - if (xg_detached_menus > 0) --xg_detached_menus; -} - -/* Callback invoked when a menu is detached. It increases the - xg_detached_menus count. - WIDGET is the GtkTearoffMenuItem. - CLIENT_DATA is not used. */ - -static void -tearoff_activate (GtkWidget *widget, gpointer client_data) -{ - GtkWidget *menu = gtk_widget_get_parent (widget); - if (gtk_menu_get_tearoff_state (GTK_MENU (menu))) - { - ++xg_detached_menus; - g_signal_connect (G_OBJECT (gtk_widget_get_toplevel (widget)), - "destroy", - G_CALLBACK (tearoff_remove), 0); - } -} -#else /* ! HAVE_GTK_TEAROFF_MENU_ITEM_NEW */ -bool -xg_have_tear_offs (struct frame *f) -{ - return FRAME_MENUBAR_HEIGHT (f) == 0; -} -#endif /* ! HAVE_GTK_TEAROFF_MENU_ITEM_NEW */ - /* Create a menu item widget, and connect the callbacks. ITEM describes the menu item. F is the frame the created menu belongs to. @@ -2477,8 +2436,6 @@ HIGHLIGHT_CB is the callback to call when entering/leaving menu items. If POP_UP_P, create a popup menu. If MENU_BAR_P, create a menu bar. - If ADD_TEAROFF_P, add a tearoff menu item. Ignored if MENU_BAR_P or - the Gtk+ version used does not have tearoffs. TOPMENU is the topmost GtkWidget that others shall be placed under. It may be NULL, in that case we create the appropriate widget (menu bar or menu item depending on POP_UP_P and MENU_BAR_P) @@ -2500,7 +2457,6 @@ GCallback highlight_cb, bool pop_up_p, bool menu_bar_p, - bool add_tearoff_p, GtkWidget *topmenu, xg_menu_cb_data *cl_data, const char *name) @@ -2551,24 +2507,6 @@ "selection-done", deactivate_cb, 0); } -#ifdef HAVE_GTK_TEAROFF_MENU_ITEM_NEW - if (! menu_bar_p && add_tearoff_p) - { - // Only add tearoff if menu is empty. - GList *list = gtk_container_get_children (GTK_CONTAINER (wmenu)); - if (! list) - { - GtkWidget *tearoff = gtk_tearoff_menu_item_new (); - gtk_menu_shell_append (GTK_MENU_SHELL (wmenu), tearoff); - - g_signal_connect (G_OBJECT (tearoff), "activate", - G_CALLBACK (tearoff_activate), 0); - } - else - g_list_free (list); - } -#endif - for (item = data; item; item = item->next) { GtkWidget *w; @@ -2582,7 +2520,6 @@ group = NULL; utf8_label = get_utf8_string (item->name); - gtk_menu_set_title (GTK_MENU (wmenu), utf8_label); w = gtk_menu_item_new_with_label (utf8_label); gtk_widget_set_sensitive (w, FALSE); if (utf8_label) g_free (utf8_label); @@ -2613,7 +2550,6 @@ highlight_cb, 0, 0, - add_tearoff_p, 0, cl_data, 0); @@ -2671,7 +2607,6 @@ highlight_cb, pop_up_p, menu_bar_p, - menu_bar_p, 0, 0, name); @@ -2781,7 +2716,7 @@ { /* Item(s) added. Add all new items in one call. */ create_menus (val, f, select_cb, deactivate_cb, highlight_cb, - 0, 1, 0, menubar, cl_data, 0); + 0, 1, menubar, cl_data, 0); /* All updated. */ val = 0; @@ -2864,14 +2799,6 @@ gtk_label_set_text (wlabel, utf8_label); g_object_notify (G_OBJECT (witem), "label"); -#ifdef HAVE_GTK_TEAROFF_MENU_ITEM_NEW - /* If this item has a submenu that has been detached, change - the title in the WM decorations also. */ - if (submenu && gtk_menu_get_tearoff_state (GTK_MENU (submenu))) - /* Set the title of the detached window. */ - gtk_menu_set_title (GTK_MENU (submenu), utf8_label); -#endif - if (utf8_label) g_free (utf8_label); iter = g_list_next (iter); val = val->next; @@ -2898,7 +2825,7 @@ GtkWidget *submenu = create_menus (NULL, f, select_cb, deactivate_cb, highlight_cb, - 0, 0, 0, 0, cl_data, 0); + 0, 0, 0, cl_data, 0); gtk_widget_set_name (w, MENU_ITEM_NAME); gtk_menu_shell_insert (GTK_MENU_SHELL (menubar), w, pos); @@ -3106,16 +3033,6 @@ { GtkWidget *w = GTK_WIDGET (iter->data); -#ifdef HAVE_GTK_TEAROFF_MENU_ITEM_NEW - /* Skip tearoff items, they have no counterpart in val. */ - if (GTK_IS_TEAROFF_MENU_ITEM (w)) - { - iter = g_list_next (iter); - if (iter) w = GTK_WIDGET (iter->data); - else break; - } -#endif - /* Remember first radio button in a group. If we get a mismatch in a radio group we must rebuild the whole group so that the connections in GTK becomes correct. */ @@ -3203,7 +3120,6 @@ highlight_cb, 0, 0, - 1, submenu, cl_data, 0); @@ -4188,187 +4104,6 @@ } -/* This callback is called when a tool item should create a proxy item, - such as for the overflow menu. Also called when the tool bar is detached. - If we don't create a proxy menu item, the detached tool bar will be - blank. */ - -static gboolean -xg_tool_bar_menu_proxy (GtkToolItem *toolitem, gpointer user_data) -{ - GtkButton *wbutton = GTK_BUTTON (XG_BIN_CHILD (XG_BIN_CHILD (toolitem))); - GtkWidget *vb = XG_BIN_CHILD (wbutton); - GtkWidget *c1; - GtkLabel *wlbl = GTK_LABEL (xg_get_tool_bar_widgets (vb, &c1)); - GtkImage *wimage = GTK_IMAGE (c1); - GtkWidget *wmenuitem = gtk_image_menu_item_new_with_label - (wlbl ? gtk_label_get_text (wlbl) : ""); - GtkWidget *wmenuimage; - - - if (gtk_button_get_use_stock (wbutton)) - wmenuimage = gtk_image_new_from_stock (gtk_button_get_label (wbutton), - GTK_ICON_SIZE_MENU); - else - { - GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (wbutton)); - GtkImageType store_type = gtk_image_get_storage_type (wimage); - - g_object_set (G_OBJECT (settings), "gtk-menu-images", TRUE, NULL); - - if (store_type == GTK_IMAGE_STOCK) - { - gchar *stock_id; - gtk_image_get_stock (wimage, &stock_id, NULL); - wmenuimage = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_MENU); - } - else if (store_type == GTK_IMAGE_ICON_SET) - { - GtkIconSet *icon_set; - gtk_image_get_icon_set (wimage, &icon_set, NULL); - wmenuimage = gtk_image_new_from_icon_set (icon_set, - GTK_ICON_SIZE_MENU); - } - else if (store_type == GTK_IMAGE_PIXBUF) - { - gint width, height; - - if (settings && - gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_MENU, - &width, &height)) - { - GdkPixbuf *src_pixbuf, *dest_pixbuf; - - src_pixbuf = gtk_image_get_pixbuf (wimage); - dest_pixbuf = gdk_pixbuf_scale_simple (src_pixbuf, width, height, - GDK_INTERP_BILINEAR); - - wmenuimage = gtk_image_new_from_pixbuf (dest_pixbuf); - } - else - { - fprintf (stderr, "internal error: GTK_IMAGE_PIXBUF failed\n"); - emacs_abort (); - } - } - else if (store_type == GTK_IMAGE_ICON_NAME) - { - const gchar *icon_name; - GtkIconSize icon_size; - - gtk_image_get_icon_name (wimage, &icon_name, &icon_size); - wmenuimage = gtk_image_new_from_icon_name (icon_name, - GTK_ICON_SIZE_MENU); - } - else - { - fprintf (stderr, "internal error: store_type is %d\n", store_type); - emacs_abort (); - } - } - if (wmenuimage) - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (wmenuitem), wmenuimage); - - g_signal_connect (G_OBJECT (wmenuitem), - "activate", - G_CALLBACK (xg_tool_bar_proxy_callback), - user_data); - - - g_object_set_data (G_OBJECT (wmenuitem), XG_TOOL_BAR_PROXY_BUTTON, - (gpointer) wbutton); - gtk_tool_item_set_proxy_menu_item (toolitem, "Emacs toolbar item", wmenuitem); - gtk_widget_set_sensitive (wmenuitem, - gtk_widget_get_sensitive (GTK_WIDGET (wbutton))); - - /* Use enter/leave notify to show help. We use the events - rather than the GtkButton specific signals "enter" and - "leave", so we can have only one callback. The event - will tell us what kind of event it is. */ - g_signal_connect (G_OBJECT (wmenuitem), - "enter-notify-event", - G_CALLBACK (xg_tool_bar_proxy_help_callback), - user_data); - g_signal_connect (G_OBJECT (wmenuitem), - "leave-notify-event", - G_CALLBACK (xg_tool_bar_proxy_help_callback), - user_data); - - return TRUE; -} - -/* This callback is called when a tool bar is detached. We must set - the height of the tool bar to zero when this happens so frame sizes - are correctly calculated. - WBOX is the handle box widget that enables detach/attach of the tool bar. - W is the tool bar widget. - CLIENT_DATA is a pointer to the frame the tool bar belongs to. */ - -static void -xg_tool_bar_detach_callback (GtkHandleBox *wbox, - GtkWidget *w, - gpointer client_data) -{ - struct frame *f = client_data; - - g_object_set (G_OBJECT (w), "show-arrow", !x_gtk_whole_detached_tool_bar, - NULL); - - if (f) - { - GtkRequisition req, req2; - - gtk_widget_get_preferred_size (GTK_WIDGET (wbox), NULL, &req); - gtk_widget_get_preferred_size (w, NULL, &req2); - req.width -= req2.width; - req.height -= req2.height; - if (FRAME_TOOLBAR_TOP_HEIGHT (f) != 0) - FRAME_TOOLBAR_TOP_HEIGHT (f) = req.height; - else if (FRAME_TOOLBAR_BOTTOM_HEIGHT (f) != 0) - FRAME_TOOLBAR_BOTTOM_HEIGHT (f) = req.height; - else if (FRAME_TOOLBAR_RIGHT_WIDTH (f) != 0) - FRAME_TOOLBAR_RIGHT_WIDTH (f) = req.width; - else if (FRAME_TOOLBAR_LEFT_WIDTH (f) != 0) - FRAME_TOOLBAR_LEFT_WIDTH (f) = req.width; - xg_height_or_width_changed (f); - } -} - -/* This callback is called when a tool bar is reattached. We must set - the height of the tool bar when this happens so frame sizes - are correctly calculated. - WBOX is the handle box widget that enables detach/attach of the tool bar. - W is the tool bar widget. - CLIENT_DATA is a pointer to the frame the tool bar belongs to. */ - -static void -xg_tool_bar_attach_callback (GtkHandleBox *wbox, - GtkWidget *w, - gpointer client_data) -{ - struct frame *f = client_data; - g_object_set (G_OBJECT (w), "show-arrow", TRUE, NULL); - - if (f) - { - GtkRequisition req, req2; - - gtk_widget_get_preferred_size (GTK_WIDGET (wbox), NULL, &req); - gtk_widget_get_preferred_size (w, NULL, &req2); - req.width += req2.width; - req.height += req2.height; - if (FRAME_TOOLBAR_TOP_HEIGHT (f) != 0) - FRAME_TOOLBAR_TOP_HEIGHT (f) = req.height; - else if (FRAME_TOOLBAR_BOTTOM_HEIGHT (f) != 0) - FRAME_TOOLBAR_BOTTOM_HEIGHT (f) = req.height; - else if (FRAME_TOOLBAR_RIGHT_WIDTH (f) != 0) - FRAME_TOOLBAR_RIGHT_WIDTH (f) = req.width; - else if (FRAME_TOOLBAR_LEFT_WIDTH (f) != 0) - FRAME_TOOLBAR_LEFT_WIDTH (f) = req.width; - xg_height_or_width_changed (f); - } -} - /* This callback is called when the mouse enters or leaves a tool bar item. It is used for displaying and hiding the help text. W is the tool bar item, a button. @@ -4448,11 +4183,7 @@ gtk_toolbar_set_orientation (GTK_TOOLBAR (w), o) #endif -#ifdef HAVE_GTK_HANDLE_BOX_NEW -#define TOOLBAR_TOP_WIDGET(x) ((x)->handlebox_widget) -#else #define TOOLBAR_TOP_WIDGET(x) ((x)->toolbar_widget) -#endif /* Attach a tool bar to frame F. */ @@ -4461,31 +4192,15 @@ { struct x_output *x = f->output_data.x; bool into_hbox = EQ (pos, Qleft) || EQ (pos, Qright); - GtkWidget *top_widget = TOOLBAR_TOP_WIDGET (x); + GtkWidget *top_widget = x->toolbar_widget; toolbar_set_orientation (x->toolbar_widget, into_hbox ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL); -#ifdef HAVE_GTK_HANDLE_BOX_NEW - if (!x->handlebox_widget) - { - top_widget = x->handlebox_widget = gtk_handle_box_new (); - g_signal_connect (G_OBJECT (x->handlebox_widget), "child-detached", - G_CALLBACK (xg_tool_bar_detach_callback), f); - g_signal_connect (G_OBJECT (x->handlebox_widget), "child-attached", - G_CALLBACK (xg_tool_bar_attach_callback), f); - gtk_container_add (GTK_CONTAINER (x->handlebox_widget), - x->toolbar_widget); - } -#endif if (into_hbox) { -#ifdef HAVE_GTK_HANDLE_BOX_NEW - gtk_handle_box_set_handle_position (GTK_HANDLE_BOX (x->handlebox_widget), - GTK_POS_TOP); -#endif gtk_box_pack_start (GTK_BOX (x->hbox_widget), top_widget, FALSE, FALSE, 0); @@ -4498,10 +4213,6 @@ else { bool vbox_pos = x->menubar_widget != 0; -#ifdef HAVE_GTK_HANDLE_BOX_NEW - gtk_handle_box_set_handle_position (GTK_HANDLE_BOX (x->handlebox_widget), - GTK_POS_LEFT); -#endif gtk_box_pack_start (GTK_BOX (x->vbox_widget), top_widget, FALSE, FALSE, 0); @@ -4654,10 +4365,6 @@ intptr_t ii = i; gpointer gi = (gpointer) ii; - g_signal_connect (G_OBJECT (ti), "create-menu-proxy", - G_CALLBACK (xg_tool_bar_menu_proxy), - gi); - g_signal_connect (G_OBJECT (wb), "clicked", G_CALLBACK (xg_tool_bar_callback), gi); @@ -4771,7 +4478,7 @@ struct x_output *x = f->output_data.x; GtkRequisition req; int nl = 0, nr = 0, nt = 0, nb = 0; - GtkWidget *top_widget = TOOLBAR_TOP_WIDGET (x); + GtkWidget *top_widget = x->toolbar_widget; gtk_widget_get_preferred_size (GTK_WIDGET (top_widget), NULL, &req); if (x->toolbar_in_hbox) @@ -4810,6 +4517,42 @@ return 0; } +static char * +find_icon_from_name (char *name, + GtkIconTheme *icon_theme, + char **icon_name) +{ +#if ! GTK_CHECK_VERSION (3, 10, 0) + GtkStockItem stock_item; +#endif + + if (name[0] == 'n' && name[1] == ':') + { + *icon_name = name + 2; + name = NULL; + + if (! gtk_icon_theme_has_icon (icon_theme, *icon_name)) + *icon_name = NULL; + } + +#if ! GTK_CHECK_VERSION (3, 10, 0) + else if (gtk_stock_lookup (name, &stock_item)) + *icon_name = NULL; +#endif + else if (gtk_icon_theme_has_icon (icon_theme, name)) + { + *icon_name = name; + name = NULL; + } + else + { + name = NULL; + *icon_name = NULL; + } + + return name; +} + /* Update the tool bar for frame F. Add new buttons and remove old. */ @@ -4825,6 +4568,9 @@ Lisp_Object style; bool text_image, horiz; struct xg_frame_tb_info *tbinfo; + GdkScreen *screen; + GtkIconTheme *icon_theme; + if (! FRAME_GTK_WIDGET (f)) return; @@ -4859,6 +4605,8 @@ dir = gtk_widget_get_direction (GTK_WIDGET (wtoolbar)); style = Ftool_bar_get_system_style (); + screen = gtk_widget_get_screen (GTK_WIDGET (wtoolbar)); + icon_theme = gtk_icon_theme_get_for_screen (screen); /* Are we up to date? */ tbinfo = g_object_get_data (G_OBJECT (FRAME_GTK_OUTER_WIDGET (f)), @@ -4895,7 +4643,6 @@ struct image *img = NULL; Lisp_Object image; Lisp_Object stock = Qnil; - GtkStockItem stock_item; char *stock_name = NULL; char *icon_name = NULL; Lisp_Object rtl; @@ -4949,31 +4696,27 @@ if (!NILP (specified_file) && !NILP (Ffboundp (Qx_gtk_map_stock))) stock = call1 (Qx_gtk_map_stock, specified_file); - if (STRINGP (stock)) - { - stock_name = SSDATA (stock); - if (stock_name[0] == 'n' && stock_name[1] == ':') - { - GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (wtoolbar)); - GtkIconTheme *icon_theme = gtk_icon_theme_get_for_screen (screen); - - icon_name = stock_name + 2; - stock_name = NULL; - stock = Qnil; - - if (! gtk_icon_theme_has_icon (icon_theme, icon_name)) - icon_name = NULL; - else - icon_size = gtk_toolbar_get_icon_size (wtoolbar); - } - else if (gtk_stock_lookup (SSDATA (stock), &stock_item)) - icon_size = gtk_toolbar_get_icon_size (wtoolbar); - else - { - stock = Qnil; - stock_name = NULL; - } - } + if (CONSP (stock)) + { + Lisp_Object tem; + for (tem = stock; CONSP (tem); tem = XCDR (tem)) + if (! NILP (tem) && STRINGP (XCAR (tem))) + { + stock_name = find_icon_from_name (SSDATA (XCAR (tem)), + icon_theme, + &icon_name); + if (stock_name || icon_name) break; + } + } + else if (STRINGP (stock)) + { + stock_name = find_icon_from_name (SSDATA (stock), + icon_theme, + &icon_name); + } + + if (stock_name || icon_name) + icon_size = gtk_toolbar_get_icon_size (wtoolbar); if (stock_name == NULL && icon_name == NULL) { @@ -5035,7 +4778,12 @@ w = NULL; else if (stock_name) { + +#if GTK_CHECK_VERSION (3, 10, 0) + w = gtk_image_new_from_icon_name (stock_name, icon_size); +#else w = gtk_image_new_from_stock (stock_name, icon_size); +#endif g_object_set_data_full (G_OBJECT (w), XG_TOOL_BAR_STOCK_NAME, (gpointer) xstrdup (stock_name), (GDestroyNotify) xfree); @@ -5077,7 +4825,7 @@ { if (! x->toolbar_is_packed) xg_pack_tool_bar (f, FRAME_TOOL_BAR_POSITION (f)); - gtk_widget_show_all (TOOLBAR_TOP_WIDGET (x)); + gtk_widget_show_all (x->toolbar_widget); if (xg_update_tool_bar_sizes (f)) xg_height_or_width_changed (f); } @@ -5096,11 +4844,9 @@ if (x->toolbar_widget) { struct xg_frame_tb_info *tbinfo; - GtkWidget *top_widget = TOOLBAR_TOP_WIDGET (x); + GtkWidget *top_widget = x->toolbar_widget; block_input (); - /* We may have created the toolbar_widget in xg_create_tool_bar, but - not the x->handlebox_widget which is created in xg_pack_tool_bar. */ if (x->toolbar_is_packed) { if (x->toolbar_in_hbox) @@ -5114,7 +4860,7 @@ gtk_widget_destroy (x->toolbar_widget); x->toolbar_widget = 0; - TOOLBAR_TOP_WIDGET (x) = 0; + x->toolbar_widget = 0; x->toolbar_is_packed = false; FRAME_TOOLBAR_TOP_HEIGHT (f) = FRAME_TOOLBAR_BOTTOM_HEIGHT (f) = 0; FRAME_TOOLBAR_LEFT_WIDTH (f) = FRAME_TOOLBAR_RIGHT_WIDTH (f) = 0; @@ -5139,7 +4885,7 @@ xg_change_toolbar_position (struct frame *f, Lisp_Object pos) { struct x_output *x = f->output_data.x; - GtkWidget *top_widget = TOOLBAR_TOP_WIDGET (x); + GtkWidget *top_widget = x->toolbar_widget; if (! x->toolbar_widget || ! top_widget) return; @@ -5183,9 +4929,6 @@ gdpy_def = NULL; xg_ignore_gtk_scrollbar = 0; -#ifdef HAVE_GTK_TEAROFF_MENU_ITEM_NEW - xg_detached_menus = 0; -#endif xg_menu_cb_list.prev = xg_menu_cb_list.next = xg_menu_item_cb_list.prev = xg_menu_item_cb_list.next = 0; === modified file 'src/gtkutil.h' --- src/gtkutil.h 2014-07-27 13:21:30 +0000 +++ src/gtkutil.h 2014-10-18 16:19:53 +0000 @@ -108,8 +108,6 @@ extern bool xg_event_is_for_menubar (struct frame *, const XEvent *); -extern bool xg_have_tear_offs (struct frame *f); - extern ptrdiff_t xg_get_scroll_id_for_window (Display *dpy, Window wid); extern void xg_create_scroll_bar (struct frame *f, === modified file 'src/xmenu.c' --- src/xmenu.c 2014-09-25 07:01:35 +0000 +++ src/xmenu.c 2014-10-18 16:19:53 +0000 @@ -733,12 +733,6 @@ f->output_data.x->saved_menu_event->type = 0; } -#ifdef USE_GTK - /* If we have detached menus, we must update deep so detached menus - also gets updated. */ - deep_p = deep_p || xg_have_tear_offs (f); -#endif - if (deep_p) { /* Make a widget-value tree representing the entire menu trees. */ === modified file 'src/xterm.h' --- src/xterm.h 2014-10-03 02:20:52 +0000 +++ src/xterm.h 2014-10-18 16:19:53 +0000 @@ -499,10 +499,6 @@ GtkWidget *menubar_widget; /* The tool bar in this frame */ GtkWidget *toolbar_widget; -#ifdef HAVE_GTK_HANDLE_BOX_NEW -/* The handle box that makes the tool bar detachable. */ - GtkWidget *handlebox_widget; -#endif /* True if tool bar is packed into the hbox widget (i.e. vertical). */ bool_bf toolbar_in_hbox : 1; bool_bf toolbar_is_packed : 1; ------------------------------------------------------------ revno: 118149 committer: Eli Zaretskii branch nick: trunk timestamp: Sat 2014-10-18 16:09:18 +0300 message: A better fix for drawing hollow cursor on X on 1-pixel thin space characters. src/xterm.c (x_draw_bar_cursor, x_draw_hollow_cursor): Subtract 1 pixel from the window's cursor glyph width, since X renders hollow blocks 1 pixel wider than the 'width' parameter. src/xdisp.c (get_phys_cursor_geometry): Don't subtract 1 pixel from glyph->pixel_width; this is now done in xterm.c. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-10-18 12:47:57 +0000 +++ src/ChangeLog 2014-10-18 13:09:18 +0000 @@ -1,5 +1,12 @@ 2014-10-18 Eli Zaretskii + * xterm.c (x_draw_bar_cursor, x_draw_hollow_cursor): Subtract 1 + pixel from the window's cursor glyph width, since X renders hollow + blocks 1 pixel wider than the 'width' parameter. + + * xdisp.c (get_phys_cursor_geometry): Don't subtract 1 pixel from + glyph->pixel_width; this is now done in xterm.c. + Fix reordering of bracket characters in isolates. * bidi.c (bidi_cache_find): Rename the argument NEUTRALS_OK to RESOLVED_ONLY; when non-zero, return from the cache only fully === modified file 'src/xdisp.c' --- src/xdisp.c 2014-10-14 18:10:37 +0000 +++ src/xdisp.c 2014-10-18 13:09:18 +0000 @@ -2302,10 +2302,7 @@ glyph, and `x-stretch-block-cursor' is nil, don't draw a rectangle as wide as the glyph, but use a canonical character width instead. */ - wd = glyph->pixel_width - 1; -#if defined (HAVE_NTGUI) || defined (HAVE_NS) - wd++; /* Why? */ -#endif + wd = glyph->pixel_width; x = w->phys_cursor.x; if (x < 0) === modified file 'src/xterm.c' --- src/xterm.c 2014-10-17 16:14:37 +0000 +++ src/xterm.c 2014-10-18 13:09:18 +0000 @@ -7965,7 +7965,7 @@ /* Compute frame-relative coordinates for phys cursor. */ get_phys_cursor_geometry (w, row, cursor_glyph, &x, &y, &h); - wd = w->phys_cursor_width; + wd = w->phys_cursor_width - 1; /* The foreground of cursor_gc is typically the same as the normal background color, which can cause the cursor box to be invisible. */ @@ -7981,9 +7981,9 @@ glyph, unless the cursor box is as wide as the glyph or wider (the latter happens when x-stretch-cursor is non-nil). */ if ((cursor_glyph->resolved_level & 1) != 0 - && cursor_glyph->pixel_width > w->phys_cursor_width) + && cursor_glyph->pixel_width > wd) { - x += cursor_glyph->pixel_width - w->phys_cursor_width; + x += cursor_glyph->pixel_width - wd; if (wd > 0) wd -= 1; } @@ -8086,12 +8086,12 @@ &dummy_y, &dummy_h); if ((cursor_glyph->resolved_level & 1) != 0 - && cursor_glyph->pixel_width > w->phys_cursor_width) - x += cursor_glyph->pixel_width - w->phys_cursor_width; + && cursor_glyph->pixel_width > w->phys_cursor_width - 1) + x += cursor_glyph->pixel_width - w->phys_cursor_width + 1; XFillRectangle (dpy, window, gc, x, WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y + row->height - width), - w->phys_cursor_width, width); + w->phys_cursor_width - 1, width); } XSetClipMask (dpy, gc, None); ------------------------------------------------------------ revno: 118148 [merge] committer: Eli Zaretskii branch nick: trunk timestamp: Sat 2014-10-18 15:47:57 +0300 message: Fix bidi reordering of bracket characters in isolates. src/bidi.c (bidi_cache_find): Rename the argument NEUTRALS_OK to RESOLVED_ONLY; when non-zero, return from the cache only fully resolved states. All callers changed. (CANONICAL_EQU): New macro. (PUSH_BPA_STACK): Use it to push onto the BPA stack the canonical equivalent of the paired closing bracket character. (bidi_find_bracket_pairs): Set the bracket_pairing_pos member to the default non-negative value, to be checked later in bidi_resolve_brackets. Use CANONICAL_EQU to test candidate characters against those pushed onto the BPA stack. (bidi_record_type_for_neutral): New function. (bidi_resolve_brackets): Record next_for_neutral and prev_for_neutral when embedding level gets pushed. Force resolution of bracket pairs when entering a level run that was not yet BPA-resolved. (bidi_resolve_neutral): Add assertions before calling bidi_resolve_neutral_1. (bidi_level_of_next_char): Remove the code that attempted to resolve unresolved neutrals; that is now done by bidi_resolve_neutral. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-10-18 06:40:04 +0000 +++ src/ChangeLog 2014-10-18 12:47:57 +0000 @@ -1,5 +1,27 @@ 2014-10-18 Eli Zaretskii + Fix reordering of bracket characters in isolates. + * bidi.c (bidi_cache_find): Rename the argument NEUTRALS_OK to + RESOLVED_ONLY; when non-zero, return from the cache only fully + resolved states. All callers changed. + (CANONICAL_EQU): New macro. + (PUSH_BPA_STACK): Use it to push onto the BPA stack the canonical + equivalent of the paired closing bracket character. + (bidi_find_bracket_pairs): Set the bracket_pairing_pos member to + the default non-negative value, to be checked later in + bidi_resolve_brackets. Use CANONICAL_EQU to test candidate + characters against those pushed onto the BPA stack. + (bidi_record_type_for_neutral): New function. + (bidi_resolve_brackets): Record next_for_neutral and + prev_for_neutral when embedding level gets pushed. Force + resolution of bracket pairs when entering a level run that was not + yet BPA-resolved. + (bidi_resolve_neutral): Add assertions before calling + bidi_resolve_neutral_1. + (bidi_level_of_next_char): Remove the code that attempted to + resolve unresolved neutrals; that is now done by + bidi_resolve_neutral. + * w32select.c (owner_callback): Mark with ALIGN_STACK attribute. 2014-10-17 Eli Zaretskii === modified file 'src/bidi.c' --- src/bidi.c 2014-10-16 06:55:34 +0000 +++ src/bidi.c 2014-10-18 12:47:57 +0000 @@ -800,26 +800,22 @@ /* Look for a cached iterator state that corresponds to CHARPOS. If found, copy the cached state into BIDI_IT and return the type of - the cached entry. If not found, return UNKNOWN_BT. NEUTRALS_OK - non-zero means it is OK to return cached state for neutral - characters that have no valid next_for_neutral member, and - therefore cannot be resolved. This can happen if the state was - cached before it was resolved in bidi_resolve_neutral. */ + the cached entry. If not found, return UNKNOWN_BT. RESOLVED_ONLY + zero means it is OK to return cached states tyhat were not fully + resolved yet. This can happen if the state was cached before it + was resolved in bidi_resolve_neutral. */ static bidi_type_t -bidi_cache_find (ptrdiff_t charpos, bool neutrals_ok, struct bidi_it *bidi_it) +bidi_cache_find (ptrdiff_t charpos, bool resolved_only, struct bidi_it *bidi_it) { ptrdiff_t i = bidi_cache_search (charpos, -1, bidi_it->scan_dir); if (i >= bidi_cache_start - && (neutrals_ok - /* Callers that don't want to resolve neutrals (and set - neutrals_ok = false) need to be sure that there's enough - info in the cached state to resolve the neutrals and - isolates, and if not, they don't want the cached state. */ - || !(bidi_cache[i].resolved_level == -1 - && (bidi_get_category (bidi_cache[i].type) == NEUTRAL - || bidi_isolate_fmt_char (bidi_cache[i].type)) - && bidi_cache[i].next_for_neutral.type == UNKNOWN_BT))) + && (!resolved_only + /* Callers that want only fully resolved states (and set + resolved_only = true) need to be sure that there's enough + info in the cached state to return the state as final, + and if not, they don't want the cached state. */ + || bidi_cache[i].resolved_level >= 0)) { bidi_dir_t current_scan_dir = bidi_it->scan_dir; @@ -2342,6 +2338,41 @@ BPA stack, which should be more than enough for actual bidi text. */ #define MAX_BPA_STACK (max (MAX_ALLOCA / sizeof (bpa_stack_entry), 1)) +/* UAX#9 says to match opening brackets with the matching closing + brackets or their canonical equivalents. As of Unicode 7.0, there + are only 2 bracket characters that have canonical equivalence + decompositions: u+2329 and u+232A. So instead of accessing the + table in uni-decomposition.el, we just handle these 2 characters + with this simple macro. Note that ASCII characters don't have + canonical equivalents by definition. */ + +/* To find all the characters that need to be processed by + CANONICAL_EQU, first find all the characters which have + decompositions in UnicodeData.txt, with this Awk script: + + awk -F ";" " {if ($6 != \"\") print $1, $6}" UnicodeData.txt + + Then produce a list of all the bracket characters in BidiBrackets.txt: + + awk -F "[ ;]" " {if ($1 != \"#\" && $1 != \"\") print $1}" BidiBrackets.txt + + And finally, cross-reference these two: + + fgrep -w -f brackets.txt decompositions.txt + + where "decompositions.txt" was produced by the 1st script, and + "brackets.txt" by the 2nd script. In the output of fgrep, look + only for decompositions that don't begin with some compatibility + formatting tag, such as "". Only decompositions that + consist solely of character codepoints are relevant to bidi + brackets processing. */ + +#define CANONICAL_EQU(c) \ + ( ASCII_CHAR_P (c) ? c \ + : (c) == 0x2329 ? 0x3008 \ + : (c) == 0x232a ? 0x3009 \ + : c ) + #ifdef ENABLE_CHECKING # define STORE_BRACKET_CHARPOS \ bpa_stack[bpa_sp].open_bracket_pos = bidi_it->charpos @@ -2351,16 +2382,18 @@ #define PUSH_BPA_STACK \ do { \ - bpa_sp++; \ - if (bpa_sp >= MAX_BPA_STACK) \ - { \ - bpa_sp = MAX_BPA_STACK - 1; \ - goto bpa_give_up; \ - } \ - bpa_stack[bpa_sp].close_bracket_char = bidi_mirror_char (bidi_it->ch); \ - bpa_stack[bpa_sp].open_bracket_idx = bidi_cache_last_idx; \ - bpa_stack[bpa_sp].flags = 0; \ - STORE_BRACKET_CHARPOS; \ + int ch; \ + bpa_sp++; \ + if (bpa_sp >= MAX_BPA_STACK) \ + { \ + bpa_sp = MAX_BPA_STACK - 1; \ + goto bpa_give_up; \ + } \ + ch = CANONICAL_EQU (bidi_it->ch); \ + bpa_stack[bpa_sp].close_bracket_char = bidi_mirror_char (ch); \ + bpa_stack[bpa_sp].open_bracket_idx = bidi_cache_last_idx; \ + bpa_stack[bpa_sp].flags = 0; \ + STORE_BRACKET_CHARPOS; \ } while (0) @@ -2405,13 +2438,22 @@ int old_sidx, new_sidx; int current_level = bidi_it->level_stack[bidi_it->stack_idx].level; + /* Mark every opening bracket character we've traversed by + putting its own position into bracket_pairing_pos. This + is examined in bidi_resolve_brackets to distinguish + brackets that were already resolved to stay NEUTRAL_ON, + and those that were not yet processed by this function + (because they were skipped when we skip higher embedding + levels below). */ + if (btype == BIDI_BRACKET_OPEN && bidi_it->bracket_pairing_pos == -1) + bidi_it->bracket_pairing_pos = bidi_it->charpos; bidi_cache_iterator_state (bidi_it, type == NEUTRAL_B, 0); if (btype == BIDI_BRACKET_OPEN) PUSH_BPA_STACK; else if (btype == BIDI_BRACKET_CLOSE) { int sp = bpa_sp; - int curchar = bidi_it->ch; + int curchar = CANONICAL_EQU (bidi_it->ch); eassert (sp >= 0); while (sp >= 0 && bpa_stack[sp].close_bracket_char != curchar) @@ -2513,13 +2555,35 @@ /* Restore bidi_it from the cache, which should have the bracket resolution members set as determined by the above loop. */ - type = bidi_cache_find (saved_it.charpos, 1, bidi_it); + type = bidi_cache_find (saved_it.charpos, 0, bidi_it); eassert (type == NEUTRAL_ON); } return retval; } +static void +bidi_record_type_for_neutral (struct bidi_saved_info *info, int level, + bool nextp) +{ + int idx; + + for (idx = bidi_cache_last_idx + 1; idx < bidi_cache_idx; idx++) + { + int lev = bidi_cache[idx].level_stack[bidi_cache[idx].stack_idx].level; + + if (lev <= level) + { + eassert (lev == level); + if (nextp) + bidi_cache[idx].next_for_neutral = *info; + else + bidi_cache[idx].prev_for_neutral = *info; + break; + } + } +} + static bidi_type_t bidi_resolve_brackets (struct bidi_it *bidi_it) { @@ -2527,12 +2591,24 @@ bool resolve_bracket = false; bidi_type_t type = UNKNOWN_BT; int ch; - struct bidi_saved_info tem_info; + struct bidi_saved_info prev_for_neutral, next_for_neutral; - bidi_remember_char (&tem_info, bidi_it, 1); + /* Record the prev_for_neutral type either from the previous + character, if it was a strong or AN/EN, or from the + prev_for_neutral information recorded previously. */ + if (bidi_it->type == STRONG_L || bidi_it->type == STRONG_R + || bidi_it->type == WEAK_AN || bidi_it->type == WEAK_EN) + bidi_remember_char (&prev_for_neutral, bidi_it, 1); + else + prev_for_neutral = bidi_it->prev_for_neutral; + /* Record the next_for_neutral type information. */ + if (bidi_it->next_for_neutral.charpos > bidi_it->charpos) + next_for_neutral = bidi_it->next_for_neutral; + else + next_for_neutral.charpos = -1; if (!bidi_it->first_elt) { - type = bidi_cache_find (bidi_it->charpos + bidi_it->nchars, 1, bidi_it); + type = bidi_cache_find (bidi_it->charpos + bidi_it->nchars, 0, bidi_it); ch = bidi_it->ch; } if (type == UNKNOWN_BT) @@ -2543,36 +2619,45 @@ } else { + eassert (bidi_it->resolved_level == -1); + /* If the cached state shows an increase of embedding level due + to an isolate initiator, we need to update the 1st cached + state of the next run of the current isolating sequence with + the prev_for_neutral and next_for_neutral information, so + that it will be picked up when we advance to that next run. */ + if (bidi_it->level_stack[bidi_it->stack_idx].level > prev_level + && bidi_it->level_stack[bidi_it->stack_idx].isolate_status) + { + bidi_record_type_for_neutral (&prev_for_neutral, prev_level, 0); + bidi_record_type_for_neutral (&next_for_neutral, prev_level, 1); + } if (type == NEUTRAL_ON && bidi_paired_bracket_type (ch) == BIDI_BRACKET_OPEN) { - if (bidi_it->level_stack[bidi_it->stack_idx].level == prev_level) + if (bidi_it->bracket_pairing_pos > bidi_it->charpos) { - if (bidi_it->bracket_pairing_pos > 0) - { - /* A cached opening bracket that wasn't completely - resolved yet. */ - resolve_bracket = true; - } + /* A cached opening bracket that wasn't completely + resolved yet. */ + resolve_bracket = true; } - else + else if (bidi_it->bracket_pairing_pos == -1) { /* Higher levels were not BPA-resolved yet, even if - cached by bidi_find_bracket_pairs. Lower levels were - probably processed by bidi_find_bracket_pairs, but we - have no easy way of retaining the prev_for_neutral - from the previous level run of the isolating - sequence. Force application of BPA now. */ + cached by bidi_find_bracket_pairs. Force application + of BPA to the new level now. */ if (bidi_find_bracket_pairs (bidi_it)) resolve_bracket = true; } } - /* Keep track of the prev_for_neutral type, needed for resolving - brackets below and for resolving neutrals in bidi_resolve_neutral. */ - if (bidi_it->level_stack[bidi_it->stack_idx].level == prev_level - && (tem_info.type == STRONG_L || tem_info.type == STRONG_R - || tem_info.type == WEAK_AN || tem_info.type == WEAK_EN)) - bidi_it->prev_for_neutral = tem_info; + /* Keep track of the prev_for_neutral and next_for_neutral + types, needed for resolving brackets below and for resolving + neutrals in bidi_resolve_neutral. */ + if (bidi_it->level_stack[bidi_it->stack_idx].level == prev_level) + { + bidi_it->prev_for_neutral = prev_for_neutral; + if (next_for_neutral.charpos > 0) + bidi_it->next_for_neutral = next_for_neutral; + } } /* If needed, resolve the bracket type according to N0. */ @@ -2657,9 +2742,18 @@ || (type == WEAK_BN && bidi_explicit_dir_char (bidi_it->ch))) { if (bidi_it->next_for_neutral.type != UNKNOWN_BT) - type = bidi_resolve_neutral_1 (bidi_it->prev_for_neutral.type, - bidi_it->next_for_neutral.type, - current_level); + { + /* Make sure the data for resolving neutrals we are + about to use is valid. */ + eassert (bidi_it->next_for_neutral.charpos > bidi_it->charpos + /* PDI defines an eos, so it's OK for it to + serve as its own next_for_neutral. */ + || (bidi_it->next_for_neutral.charpos == bidi_it->charpos + && bidi_it->type == PDI)); + type = bidi_resolve_neutral_1 (bidi_it->prev_for_neutral.type, + bidi_it->next_for_neutral.type, + current_level); + } /* The next two "else if" clauses are shortcuts for the important special case when we have a long sequence of neutral or WEAK_BN characters, such as whitespace or nulls or @@ -2855,16 +2949,13 @@ } } - /* Perhaps the character we want is already cached. If it is, the - call to bidi_cache_find below will return a type other than - UNKNOWN_BT. */ + /* Perhaps the character we want is already cached s fully resolved. + If it is, the call to bidi_cache_find below will return a type + other than UNKNOWN_BT. */ if (bidi_cache_idx > bidi_cache_start && !bidi_it->first_elt) { int bob = ((bidi_it->string.s || STRINGP (bidi_it->string.lstring)) ? 0 : 1); - bidi_type_t prev_type = bidi_it->type; - bidi_type_t type_for_neutral = bidi_it->next_for_neutral.type; - ptrdiff_t pos_for_neutral = bidi_it->next_for_neutral.charpos; if (bidi_it->scan_dir > 0) { @@ -2879,57 +2970,12 @@ cached at the beginning of the iteration. */ next_char_pos = bidi_it->charpos - 1; if (next_char_pos >= bob - 1) - type = bidi_cache_find (next_char_pos, 0, bidi_it); - - /* For a sequence of BN and NI, copy the type from the previous - character. This is because the loop in bidi_resolve_neutral - that handles such sequences caches the characters it - traverses, but does not (and cannot) store the - next_for_neutral member for them, because it is only known - when the loop ends. So when we find them in the cache, their - type needs to be updated, but we don't have next_for_neutral - to do that. However, whatever type is resolved as result of - that loop, it will be the same for all the traversed - characters, by virtue of N1 and N2. */ - if (type == WEAK_BN && bidi_it->scan_dir > 0 - && bidi_explicit_dir_char (bidi_it->ch) - && type_for_neutral != UNKNOWN_BT - && bidi_it->charpos < pos_for_neutral) - { - type = prev_type; - eassert (type != UNKNOWN_BT); - } + type = bidi_cache_find (next_char_pos, 1, bidi_it); if (type != UNKNOWN_BT) { - /* If resolved_level is -1, it means this state was cached - before it was completely resolved, so we cannot return - it. */ - if (bidi_it->resolved_level != -1) - { - eassert (bidi_it->resolved_level >= 0); - return bidi_it->resolved_level; - } - else - { - level = bidi_it->level_stack[bidi_it->stack_idx].level; - if (bidi_get_category (type) == NEUTRAL - || bidi_isolate_fmt_char (type)) - { - /* Make sure the data for resolving neutrals we are - about to use is valid. */ - if (bidi_it->next_for_neutral.charpos < bidi_it->charpos - /* PDI defines an eos, so it's OK for it to - serve as its own next_for_neutral. */ - || (bidi_it->next_for_neutral.charpos == bidi_it->charpos - && bidi_it->type != PDI) - || bidi_it->next_for_neutral.type == UNKNOWN_BT) - emacs_abort (); - - type = bidi_resolve_neutral_1 (bidi_it->prev_for_neutral.type, - bidi_it->next_for_neutral.type, - level); - } - } + /* We asked the cache for fully resolved states. */ + eassert (bidi_it->resolved_level >= 0); + return bidi_it->resolved_level; } } ------------------------------------------------------------ revno: 118147 committer: Alan Mackenzie branch nick: trunk timestamp: Sat 2014-10-18 10:02:59 +0000 message: Check that a "macro" found near point-min isn't a ## operator. Fixes bug #18749. progmodes/cc-engine.el (c-macro-is-genuine-p): New function. (c-beginning-of-macro): Use the above new function. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-10-18 01:02:30 +0000 +++ lisp/ChangeLog 2014-10-18 10:02:59 +0000 @@ -1,3 +1,10 @@ +2014-10-18 Alan Mackenzie + + Check that a "macro" found near point-min isn't a ## operator. + Fixes bug #18749. + * progmodes/cc-engine.el (c-macro-is-genuine-p): New function. + (c-beginning-of-macro): Use the above new function. + 2014-10-18 Teodor Zlatanov * net/gnutls.el (gnutls-negotiate): Don't use cl-mapcan; pass === modified file 'lisp/progmodes/cc-engine.el' --- lisp/progmodes/cc-engine.el 2014-10-12 20:09:15 +0000 +++ lisp/progmodes/cc-engine.el 2014-10-18 10:02:59 +0000 @@ -249,6 +249,24 @@ (setq c-macro-cache-start-pos beg c-macro-cache-syntactic nil)))) +(defun c-macro-is-genuine-p () + ;; Check that the ostensible CPP construct at point is a real one. In + ;; particular, if point is on the first line of a narrowed buffer, make sure + ;; that the "#" isn't, say, the second character of a "##" operator. Return + ;; t when the macro is real, nil otherwise. + (let ((here (point))) + (beginning-of-line) + (prog1 + (if (and (eq (point) (point-min)) + (/= (point) 1)) + (save-restriction + (widen) + (beginning-of-line) + (and (looking-at c-anchored-cpp-prefix) + (eq (match-beginning 1) here))) + t) + (goto-char here)))) + (defun c-beginning-of-macro (&optional lim) "Go to the beginning of a preprocessor directive. Leave point at the beginning of the directive and return t if in one, @@ -279,7 +297,8 @@ (forward-line -1)) (back-to-indentation) (if (and (<= (point) here) - (looking-at c-opt-cpp-start)) + (looking-at c-opt-cpp-start) + (c-macro-is-genuine-p)) (progn (setq c-macro-cache (cons (point) nil) c-macro-cache-start-pos here) ------------------------------------------------------------ revno: 118146 committer: Eli Zaretskii branch nick: trunk timestamp: Sat 2014-10-18 09:40:04 +0300 message: Ensure 8-byte stack alignment in w32select's callback. src/w32select.c (owner_callback): Mark with ALIGN_STACK attribute. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-10-17 16:14:37 +0000 +++ src/ChangeLog 2014-10-18 06:40:04 +0000 @@ -1,3 +1,7 @@ +2014-10-18 Eli Zaretskii + + * w32select.c (owner_callback): Mark with ALIGN_STACK attribute. + 2014-10-17 Eli Zaretskii * xterm.c (x_draw_hollow_cursor): Fix display of hollow cursor on === modified file 'src/w32select.c' --- src/w32select.c 2014-07-17 15:37:48 +0000 +++ src/w32select.c 2014-10-18 06:40:04 +0000 @@ -95,8 +95,8 @@ static Lisp_Object render_all (Lisp_Object ignore); static void run_protected (Lisp_Object (*code) (Lisp_Object), Lisp_Object arg); static Lisp_Object lisp_error_handler (Lisp_Object error); -static LRESULT CALLBACK owner_callback (HWND win, UINT msg, - WPARAM wp, LPARAM lp); +static LRESULT CALLBACK ALIGN_STACK owner_callback (HWND win, UINT msg, + WPARAM wp, LPARAM lp); static HWND create_owner (void); static void setup_config (void); @@ -420,7 +420,7 @@ } -static LRESULT CALLBACK +static LRESULT CALLBACK ALIGN_STACK owner_callback (HWND win, UINT msg, WPARAM wp, LPARAM lp) { switch (msg) ------------------------------------------------------------ Use --include-merged or -n0 to see merged revisions.