Now on revision 110481. ------------------------------------------------------------ revno: 110481 committer: Stefan Monnier branch nick: trunk timestamp: Tue 2012-10-09 02:41:07 -0400 message: * lisp/bindings.el (mode-line-toggle-read-only, mode-line-toggle-modified) (mode-line-widen, mode-line-input-method-map) (mode-line-coding-system-map, mode-line-remote) (mode-line-unbury-buffer, mode-line-bury-buffer) (mode-line-next-buffer, mode-line-previous-buffer): Replace save-selected-window+select-window => with-selected-window. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-10-09 06:36:16 +0000 +++ lisp/ChangeLog 2012-10-09 06:41:07 +0000 @@ -1,5 +1,12 @@ 2012-10-09 Stefan Monnier + * bindings.el (mode-line-toggle-read-only, mode-line-toggle-modified) + (mode-line-widen, mode-line-input-method-map) + (mode-line-coding-system-map, mode-line-remote) + (mode-line-unbury-buffer, mode-line-bury-buffer) + (mode-line-next-buffer, mode-line-previous-buffer): + Replace save-selected-window+select-window => with-selected-window. + * progmodes/cc-bytecomp.el (cc-bytecomp-defmacro): Remove, unused. * progmodes/cc-vars.el (bq-process): Remove, unused. === modified file 'lisp/bindings.el' --- lisp/bindings.el 2012-09-30 08:35:11 +0000 +++ lisp/bindings.el 2012-10-09 06:41:07 +0000 @@ -38,23 +38,20 @@ (defun mode-line-toggle-read-only (event) "Like `toggle-read-only', for the mode-line." (interactive "e") - (save-selected-window - (select-window (posn-window (event-start event))) + (with-selected-window (posn-window (event-start event)) (read-only-mode 'toggle))) (defun mode-line-toggle-modified (event) "Toggle the buffer-modified flag from the mode-line." (interactive "e") - (save-selected-window - (select-window (posn-window (event-start event))) + (with-selected-window (posn-window (event-start event)) (set-buffer-modified-p (not (buffer-modified-p))) (force-mode-line-update))) (defun mode-line-widen (event) "Widen a buffer from the mode-line." (interactive "e") - (save-selected-window - (select-window (posn-window (event-start event))) + (with-selected-window (posn-window (event-start event)) (widen) (force-mode-line-update))) @@ -63,17 +60,13 @@ (define-key map [mode-line mouse-2] (lambda (e) (interactive "e") - (save-selected-window - (select-window - (posn-window (event-start e))) + (with-selected-window (posn-window (event-start e)) (toggle-input-method) (force-mode-line-update)))) (define-key map [mode-line mouse-3] (lambda (e) (interactive "e") - (save-selected-window - (select-window - (posn-window (event-start e))) + (with-selected-window (posn-window (event-start e)) (describe-current-input-method)))) (purecopy map))) @@ -82,16 +75,14 @@ (define-key map [mode-line mouse-1] (lambda (e) (interactive "e") - (save-selected-window - (select-window (posn-window (event-start e))) + (with-selected-window (posn-window (event-start e)) (when (and enable-multibyte-characters buffer-file-coding-system) (describe-coding-system buffer-file-coding-system))))) (define-key map [mode-line mouse-3] (lambda (e) (interactive "e") - (save-selected-window - (select-window (posn-window (event-start e))) + (with-selected-window (posn-window (event-start e)) (call-interactively 'set-buffer-file-coding-system)))) (purecopy map)) "Local keymap for the coding-system part of the mode line.") @@ -237,8 +228,7 @@ 'mouse-face 'mode-line-highlight 'help-echo (purecopy (lambda (window _object _point) (format "%s" - (save-selected-window - (select-window window) + (with-selected-window window (concat (if (file-remote-p default-directory) "Current directory is remote: " @@ -474,15 +464,13 @@ (defun mode-line-unbury-buffer (event) "\ Call `unbury-buffer' in this window." (interactive "e") - (save-selected-window - (select-window (posn-window (event-start event))) + (with-selected-window (posn-window (event-start event)) (unbury-buffer))) (defun mode-line-bury-buffer (event) "\ Like `bury-buffer', but temporarily select EVENT's window." (interactive "e") - (save-selected-window - (select-window (posn-window (event-start event))) + (with-selected-window (posn-window (event-start event)) (bury-buffer))) (defun mode-line-other-buffer () "\ @@ -493,15 +481,13 @@ (defun mode-line-next-buffer (event) "Like `next-buffer', but temporarily select EVENT's window." (interactive "e") - (save-selected-window - (select-window (posn-window (event-start event))) + (with-selected-window (posn-window (event-start event)) (next-buffer))) (defun mode-line-previous-buffer (event) "Like `previous-buffer', but temporarily select EVENT's window." (interactive "e") - (save-selected-window - (select-window (posn-window (event-start event))) + (with-selected-window (posn-window (event-start event)) (previous-buffer))) (defmacro bound-and-true-p (var) ------------------------------------------------------------ revno: 110480 committer: Stefan Monnier branch nick: trunk timestamp: Tue 2012-10-09 02:36:16 -0400 message: * lisp/progmodes/cc-bytecomp.el (cc-bytecomp-defmacro): Remove, unused. * lisp/progmodes/cc-vars.el (bq-process): Remove, unused. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-10-09 06:01:10 +0000 +++ lisp/ChangeLog 2012-10-09 06:36:16 +0000 @@ -1,5 +1,8 @@ 2012-10-09 Stefan Monnier + * progmodes/cc-bytecomp.el (cc-bytecomp-defmacro): Remove, unused. + * progmodes/cc-vars.el (bq-process): Remove, unused. + * emacs-lisp/cl-macs.el (cl-defstruct): Obey the :read-only property. 2012-10-09 Fabián Ezequiel Gallina === modified file 'lisp/progmodes/cc-bytecomp.el' --- lisp/progmodes/cc-bytecomp.el 2012-01-19 07:21:25 +0000 +++ lisp/progmodes/cc-bytecomp.el 2012-10-09 06:36:16 +0000 @@ -338,30 +338,6 @@ (cc-bytecomp-debug-msg "cc-bytecomp-defun: Covered function %s" ',fun)))))) -(put 'cc-bytecomp-defmacro 'lisp-indent-function 'defun) -(defmacro cc-bytecomp-defmacro (fun &rest temp-macro) - "Bind the symbol as a macro during compilation (and evaluation) of the -file. Don't use outside `eval-when-compile'." - `(let ((orig-fun (assq ',fun cc-bytecomp-original-functions))) - (if (not orig-fun) - (setq orig-fun - (list ',fun - nil - (if (fboundp ',fun) - (progn - (cc-bytecomp-debug-msg - "cc-bytecomp-defmacro: Saving %s" ',fun) - (symbol-function ',fun)) - (cc-bytecomp-debug-msg - "cc-bytecomp-defmacro: Saving %s as unbound" ',fun) - 'unbound)) - cc-bytecomp-original-functions - (cons orig-fun cc-bytecomp-original-functions))) - (defmacro ,fun ,@temp-macro) - (cc-bytecomp-debug-msg - "cc-bytecomp-defmacro: Bound macro %s" ',fun) - (setcar (cdr orig-fun) (symbol-function ',fun)))) - (defmacro cc-bytecomp-put (symbol propname value) "Set a property on a symbol during compilation (and evaluation) of the file. Don't use outside `eval-when-compile'." === modified file 'lisp/progmodes/cc-vars.el' --- lisp/progmodes/cc-vars.el 2012-02-11 22:13:29 +0000 +++ lisp/progmodes/cc-vars.el 2012-10-09 06:36:16 +0000 @@ -49,16 +49,6 @@ (require 'custom) (require 'widget)) -(cc-eval-when-compile - ;; Need the function form of `backquote', which isn't standardized - ;; between Emacsen. It's called `bq-process' in XEmacs, and - ;; `backquote-process' in Emacs. `backquote-process' returns a - ;; slightly more convoluted form, so let `bq-process' be the norm. - (if (fboundp 'backquote-process) - (cc-bytecomp-defmacro bq-process (form) - `(cdr (backquote-process ,form))))) - - ;;; Helpers ;; This widget exists in newer versions of the Custom library ------------------------------------------------------------ revno: 110479 committer: Glenn Morris branch nick: trunk timestamp: Mon 2012-10-08 23:33:51 -0700 message: ChangeLog fixes diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-10-08 19:58:54 +0000 +++ src/ChangeLog 2012-10-09 06:33:51 +0000 @@ -4,18 +4,18 @@ HAVE_NTGUI, not just WINDOWSNT, resolving a problem in the cygw32 build that caused Emacs to display the hourglass cursor forever. + * w32fns.c (Fx_display_color_cells): Instead of using NCOLORS, + which is broken under remote desktop, calculate the number of + colors available for a display based on the display's number of + planes and number of bits per pixel per plane. (bug#10397). + 2012-10-08 Jan Djärv + * nsfont.m (Vfonts_in_cache): New variable. (nsfont_open): Use unsignedLongLongValue for cache in case wide ints are used. Add cached fonts to Vfonts_in_cache. (syms_of_nsfont): Initialize and staticpro Vfonts_in_cache. -2012-10-08 Daniel Colascione - * w32fns.c (Fx_display_color_cells): Instead of using NCOLORS, - which is broken under remote desktop, calculate the number of - colors available for a display based on the display's number of - planes and number of bits per pixel per plane. (bug#10397). - 2012-10-08 Juanma Barranquero * makefile.w32-in (LOCAL_FLAGS): Don't define HAVE_NTGUI, it's now @@ -32,12 +32,12 @@ (W32TERM_H): Add $(ATIMER_H) and $(FRAME_H). ($(BLD)/emacs.$(O), $(BLD)/w32console.$(O)): Update dependencies. (GLOBAL_SOURCES): Add cygw32.c. - ($(BLD)/unexw32.$(O)): - ($(BLD)/w32.$(O)): - ($(BLD)/w32console.$(O)): - ($(BLD)/w32fns.$(O)): - ($(BLD)/w32heap.$(O)): - ($(BLD)/w32menu.$(O)): + ($(BLD)/unexw32.$(O)): + ($(BLD)/w32.$(O)): + ($(BLD)/w32console.$(O)): + ($(BLD)/w32fns.$(O)): + ($(BLD)/w32heap.$(O)): + ($(BLD)/w32menu.$(O)): ($(BLD)/w32proc.$(O)): Add w32common.h. * w32fns.c (w32_color_map_lookup, x_to_w32_color): Argument is now ------------------------------------------------------------ revno: 110478 committer: Stefan Monnier branch nick: trunk timestamp: Tue 2012-10-09 02:01:10 -0400 message: * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Obey the :read-only property. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-10-09 02:07:26 +0000 +++ lisp/ChangeLog 2012-10-09 06:01:10 +0000 @@ -1,3 +1,7 @@ +2012-10-09 Stefan Monnier + + * emacs-lisp/cl-macs.el (cl-defstruct): Obey the :read-only property. + 2012-10-09 Fabián Ezequiel Gallina Implemented `backward-up-list'-like navigation. @@ -20,8 +24,7 @@ 2012-10-08 Fabián Ezequiel Gallina Fix shell handling of unbalanced quotes and parens in output. - * progmodes/python.el (python-rx-constituents): Added - string-delimiter. + * progmodes/python.el (python-rx-constituents): Add string-delimiter. (python-syntax-propertize-function): Use it. (python-shell-output-syntax-table): New var. (inferior-python-mode): Prevent unbalanced parens/quotes from === modified file 'lisp/emacs-lisp/cl-loaddefs.el' --- lisp/emacs-lisp/cl-loaddefs.el 2012-10-06 17:34:57 +0000 +++ lisp/emacs-lisp/cl-loaddefs.el 2012-10-09 06:01:10 +0000 @@ -260,7 +260,7 @@ ;;;;;; cl-typecase cl-ecase cl-case cl-load-time-value cl-eval-when ;;;;;; cl-destructuring-bind cl-function cl-defmacro cl-defun cl-gentemp ;;;;;; cl-gensym cl--compiler-macro-cXXr cl--compiler-macro-list*) -;;;;;; "cl-macs" "cl-macs.el" "6951d080daefb5194b1d21fe9b2deae4") +;;;;;; "cl-macs" "cl-macs.el" "885919e79dbcd11081cfb2e039b470c7") ;;; Generated autoloads from cl-macs.el (autoload 'cl--compiler-macro-list* "cl-macs" "\ === modified file 'lisp/emacs-lisp/cl-macs.el' --- lisp/emacs-lisp/cl-macs.el 2012-10-06 17:34:57 +0000 +++ lisp/emacs-lisp/cl-macs.el 2012-10-09 06:01:10 +0000 @@ -2324,26 +2324,29 @@ (if (= pos 0) '(car cl-x) `(nth ,pos cl-x)))) forms) (push (cons accessor t) side-eff) - ;; Don't bother defining a setf-expander, since gv-get can use - ;; the compiler macro to get the same result. - ;;(push `(gv-define-setter ,accessor (cl-val cl-x) - ;; ,(if (cadr (memq :read-only (cddr desc))) - ;; `(progn (ignore cl-x cl-val) - ;; (error "%s is a read-only slot" - ;; ',accessor)) - ;; ;; If cl is loaded only for compilation, - ;; ;; the call to cl--struct-setf-expander would - ;; ;; cause a warning because it may not be - ;; ;; defined at run time. Suppress that warning. - ;; `(progn - ;; (declare-function - ;; cl--struct-setf-expander "cl-macs" - ;; (x name accessor pred-form pos)) - ;; (cl--struct-setf-expander - ;; cl-val cl-x ',name ',accessor - ;; ,(and pred-check `',pred-check) - ;; ,pos)))) - ;; forms) + (if (cadr (memq :read-only (cddr desc))) + (push `(gv-define-expander ,accessor + (lambda (_cl-do _cl-x) + (error "%s is a read-only slot" ',accessor))) + forms) + ;; For normal slots, we don't need to define a setf-expander, + ;; since gv-get can use the compiler macro to get the + ;; same result. + ;; (push `(gv-define-setter ,accessor (cl-val cl-x) + ;; ;; If cl is loaded only for compilation, + ;; ;; the call to cl--struct-setf-expander would + ;; ;; cause a warning because it may not be + ;; ;; defined at run time. Suppress that warning. + ;; (progn + ;; (declare-function + ;; cl--struct-setf-expander "cl-macs" + ;; (x name accessor pred-form pos)) + ;; (cl--struct-setf-expander + ;; cl-val cl-x ',name ',accessor + ;; ,(and pred-check `',pred-check) + ;; ,pos))) + ;; forms) + ) (if print-auto (nconc print-func (list `(princ ,(format " %s" slot) cl-s) ------------------------------------------------------------ revno: 110477 author: Lars Magne Ingebrigtsen committer: Katsumi Yamaoka branch nick: trunk timestamp: Tue 2012-10-09 02:28:34 +0000 message: shr.el (shr-insert): \r is also not inserted, so don't try to delete it diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2012-10-06 20:30:26 +0000 +++ lisp/gnus/ChangeLog 2012-10-09 02:28:34 +0000 @@ -1,3 +1,8 @@ +2012-10-09 Lars Magne Ingebrigtsen + + * shr.el (shr-insert): \r is also not inserted, so don't try to delete + it. + 2012-10-06 Glenn Morris * gnus-notifications.el (gnus-notifications): === modified file 'lisp/gnus/shr.el' --- lisp/gnus/shr.el 2012-07-17 11:52:00 +0000 +++ lisp/gnus/shr.el 2012-10-09 02:28:34 +0000 @@ -391,7 +391,7 @@ (shr-indent)) (end-of-line)) (insert " "))) - (unless (string-match "[ \t\n ]\\'" text) + (unless (string-match "[ \t\r\n ]\\'" text) (delete-char -1))))) (defun shr-find-fill-point () ------------------------------------------------------------ revno: 110476 committer: Fabián Ezequiel Gallina branch nick: trunk timestamp: Mon 2012-10-08 23:07:26 -0300 message: Implemented `backward-up-list'-like navigation. * progmodes/python.el (python-nav-up-list) (python-nav-backward-up-list): New functions. (python-mode-map): Define substitute key for backward-up-list to python-nav-backward-up-list. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-10-08 22:18:05 +0000 +++ lisp/ChangeLog 2012-10-09 02:07:26 +0000 @@ -1,3 +1,11 @@ +2012-10-09 Fabián Ezequiel Gallina + + Implemented `backward-up-list'-like navigation. + * progmodes/python.el (python-nav-up-list) + (python-nav-backward-up-list): New functions. + (python-mode-map): Define substitute key for backward-up-list to + python-nav-backward-up-list. + 2012-10-08 Fabián Ezequiel Gallina * progmodes/python.el (python-fill-paragraph): Rename from === modified file 'lisp/progmodes/python.el' --- lisp/progmodes/python.el 2012-10-08 22:18:05 +0000 +++ lisp/progmodes/python.el 2012-10-09 02:07:26 +0000 @@ -235,6 +235,9 @@ (substitute-key-definition 'forward-sentence 'python-nav-forward-block map global-map) + (substitute-key-definition 'backward-up-list + 'python-nav-backward-up-list + map global-map) (define-key map "\C-c\C-j" 'imenu) ;; Indent specific (define-key map "\177" 'python-indent-dedent-line-backspace) @@ -1409,6 +1412,67 @@ (python-nav--backward-sexp) (setq arg (1+ arg)))) +(defun python-nav--up-list (&optional dir) + "Internal implementation of `python-nav-up-list'. +DIR is always 1 or -1 and comes sanitized from +`python-nav-up-list' calls." + (let ((context (python-syntax-context-type)) + (forward-p (> dir 0))) + (cond + ((memq context '(string comment))) + ((eq context 'paren) + (let ((forward-sexp-function)) + (up-list dir))) + ((and forward-p (python-info-end-of-block-p)) + (let ((parent-end-pos + (save-excursion + (let ((indentation (and + (python-nav-beginning-of-block) + (current-indentation)))) + (while (and indentation + (> indentation 0) + (>= (current-indentation) indentation) + (python-nav-backward-block))) + (python-nav-end-of-block))))) + (and (> (or parent-end-pos (point)) (point)) + (goto-char parent-end-pos)))) + (forward-p (python-nav-end-of-block)) + ((and (not forward-p) + (> (current-indentation) 0) + (python-info-beginning-of-block-p)) + (let ((prev-block-pos + (save-excursion + (let ((indentation (current-indentation))) + (while (and (python-nav-backward-block) + (> (current-indentation) indentation)))) + (point)))) + (and (> (point) prev-block-pos) + (goto-char prev-block-pos)))) + ((not forward-p) (python-nav-beginning-of-block))))) + +(defun python-nav-up-list (&optional arg) + "Move forward out of one level of parentheses (or blocks). +With ARG, do this that many times. +A negative argument means move backward but still to a less deep spot. +This command assumes point is not in a string or comment." + (interactive "^p") + (or arg (setq arg 1)) + (while (> arg 0) + (python-nav--up-list 1) + (setq arg (1- arg))) + (while (< arg 0) + (python-nav--up-list -1) + (setq arg (1+ arg)))) + +(defun python-nav-backward-up-list (&optional arg) + "Move backward out of one level of parentheses (or blocks). +With ARG, do this that many times. +A negative argument means move backward but still to a less deep spot. +This command assumes point is not in a string or comment." + (interactive "^p") + (or arg (setq arg 1)) + (python-nav-up-list (- arg))) + ;;; Shell integration ------------------------------------------------------------ revno: 110475 fixes bug: http://debbugs.gnu.org/12605 committer: Fabián Ezequiel Gallina branch nick: trunk timestamp: Mon 2012-10-08 19:18:05 -0300 message: * progmodes/python.el (python-fill-paragraph): Rename from python-fill-paragraph-function. Fixed fill-paragraph for decorators. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-10-08 21:51:02 +0000 +++ lisp/ChangeLog 2012-10-08 22:18:05 +0000 @@ -1,5 +1,11 @@ 2012-10-08 Fabián Ezequiel Gallina + * progmodes/python.el (python-fill-paragraph): Rename from + python-fill-paragraph-function. Fixed fill-paragraph for + decorators (Bug#12605). + +2012-10-08 Fabián Ezequiel Gallina + * progmodes/python.el (python-shell-output-filter): Handle extra carriage return in OSX (Bug#12409). === modified file 'lisp/progmodes/python.el' --- lisp/progmodes/python.el 2012-10-08 21:51:02 +0000 +++ lisp/progmodes/python.el 2012-10-08 22:18:05 +0000 @@ -2272,28 +2272,28 @@ (defcustom python-fill-comment-function 'python-fill-comment "Function to fill comments. -This is the function used by `python-fill-paragraph-function' to +This is the function used by `python-fill-paragraph' to fill comments." :type 'symbol :group 'python) (defcustom python-fill-string-function 'python-fill-string "Function to fill strings. -This is the function used by `python-fill-paragraph-function' to +This is the function used by `python-fill-paragraph' to fill strings." :type 'symbol :group 'python) (defcustom python-fill-decorator-function 'python-fill-decorator "Function to fill decorators. -This is the function used by `python-fill-paragraph-function' to +This is the function used by `python-fill-paragraph' to fill decorators." :type 'symbol :group 'python) (defcustom python-fill-paren-function 'python-fill-paren "Function to fill parens. -This is the function used by `python-fill-paragraph-function' to +This is the function used by `python-fill-paragraph' to fill parens." :type 'symbol :group 'python) @@ -2370,7 +2370,7 @@ :safe (lambda (val) (memq val '(django onetwo pep-257 pep-257-nn symmetric nil)))) -(defun python-fill-paragraph-function (&optional justify) +(defun python-fill-paragraph (&optional justify) "`fill-paragraph-function' handling multi-line strings and possibly comments. If any of the current line is in or at the end of a multi-line string, fill the string or the paragraph of it that point is in, preserving @@ -2389,8 +2389,7 @@ (funcall python-fill-string-function justify)) ;; Decorators ((equal (char-after (save-excursion - (back-to-indentation) - (point))) ?@) + (python-nav-beginning-of-statement))) ?@) (funcall python-fill-decorator-function justify)) ;; Parens ((or (python-syntax-context 'paren) @@ -2402,12 +2401,12 @@ (t t)))) (defun python-fill-comment (&optional justify) - "Comment fill function for `python-fill-paragraph-function'. + "Comment fill function for `python-fill-paragraph'. JUSTIFY should be used (if applicable) as in `fill-paragraph'." (fill-comment-paragraph justify)) (defun python-fill-string (&optional justify) - "String fill function for `python-fill-paragraph-function'. + "String fill function for `python-fill-paragraph'. JUSTIFY should be used (if applicable) as in `fill-paragraph'." (let* ((marker (point-marker)) (str-start-pos @@ -2477,12 +2476,12 @@ (indent-according-to-mode))))) t) (defun python-fill-decorator (&optional justify) - "Decorator fill function for `python-fill-paragraph-function'. + "Decorator fill function for `python-fill-paragraph'. JUSTIFY should be used (if applicable) as in `fill-paragraph'." t) (defun python-fill-paren (&optional justify) - "Paren fill function for `python-fill-paragraph-function'. + "Paren fill function for `python-fill-paragraph'. JUSTIFY should be used (if applicable) as in `fill-paragraph'." (save-restriction (narrow-to-region (progn @@ -3133,7 +3132,7 @@ (set (make-local-variable 'paragraph-start) "\\s-*$") (set (make-local-variable 'fill-paragraph-function) - 'python-fill-paragraph-function) + 'python-fill-paragraph) (set (make-local-variable 'beginning-of-defun-function) #'python-beginning-of-defun-function) ------------------------------------------------------------ revno: 110474 committer: Paul Eggert branch nick: trunk timestamp: Mon 2012-10-08 15:14:39 -0700 message: Minor tweaks to recently-changed code. Space before paren, avoid overparenthesization, etc. diff: === modified file 'src/conf_post.h' --- src/conf_post.h 2012-09-17 12:07:36 +0000 +++ src/conf_post.h 2012-10-08 22:14:39 +0000 @@ -142,19 +142,19 @@ #endif #endif -#if defined(HAVE_NTGUI) && !defined(DebPrint) -# if defined(EMACSDEBUG) +#if defined HAVE_NTGUI && !defined DebPrint +# ifdef EMACSDEBUG extern void _DebPrint (const char *fmt, ...); # define DebPrint(stuff) _DebPrint stuff # else # define DebPrint(stuff) -# endif /* EMACSDEBUG */ -#endif /* DebPrint */ +# endif +#endif -#if defined(CYGWIN) && defined(HAVE_NTGUI) -#define NTGUI_UNICODE /* Cygwin runs only on UNICODE-supporting systems */ -#define _WIN32_WINNT 0x500 /* Win2k */ -#endif /* CYGWIN && HAVE_NTGUI */ +#if defined CYGWIN && defined HAVE_NTGUI +# define NTGUI_UNICODE /* Cygwin runs only on UNICODE-supporting systems */ +# define _WIN32_WINNT 0x500 /* Win2k */ +#endif #ifdef emacs /* Don't do this for lib-src. */ /* Tell regex.c to use a type compatible with Emacs. */ === modified file 'src/emacs.c' --- src/emacs.c 2012-10-08 12:53:18 +0000 +++ src/emacs.c 2012-10-08 22:14:39 +0000 @@ -34,18 +34,15 @@ #ifdef WINDOWSNT #include #include "w32.h" -#endif - -#if defined (WINDOWSNT) #include "w32heap.h" #endif -#if defined (WINDOWSNT) || defined (HAVE_NTGUI) +#if defined WINDOWSNT || defined HAVE_NTGUI #include "w32select.h" #include "w32font.h" #endif -#if defined (HAVE_NTGUI) && defined (CYGWIN) +#if defined HAVE_NTGUI && defined CYGWIN #include "cygw32.h" #endif @@ -179,7 +176,7 @@ We mark being in the exec'd process by a daemon name argument of form "--daemon=\nFD0,FD1\nNAME" where FD are the pipe file descriptors, NAME is the original daemon name, if any. */ -#if defined (NS_IMPL_COCOA) || (defined (HAVE_NTGUI) && defined (CYGWIN)) +#if defined NS_IMPL_COCOA || (defined HAVE_NTGUI && defined CYGWIN) # define DAEMON_MUST_EXEC #endif @@ -698,7 +695,7 @@ char *dname_arg = 0; #ifdef DAEMON_MUST_EXEC char dname_arg2[80]; -#endif /* DAEMON_MUST_EXEC */ +#endif char *ch_to_dir; #if GC_MARK_STACK @@ -1378,9 +1375,9 @@ #ifdef WINDOWSNT syms_of_ntproc (); #endif /* WINDOWSNT */ -#if defined (CYGWIN) && defined (HAVE_NTGUI) +#if defined CYGWIN && defined HAVE_NTGUI syms_of_cygw32 (); -#endif /* defined(CYGWIN) && defined (HAVE_NTGUI) */ +#endif syms_of_window (); syms_of_xdisp (); syms_of_font (); @@ -1415,9 +1412,9 @@ syms_of_fontset (); #endif /* HAVE_NTGUI */ -#if defined (WINDOWSNT) || defined (HAVE_NTGUI) +#if defined WINDOWSNT || defined HAVE_NTGUI syms_of_w32select (); -#endif /* WINDOWSNT || HAVE_NTGUI */ +#endif #ifdef MSDOS syms_of_xmenu (); @@ -1465,10 +1462,9 @@ globals_of_w32menu (); #endif /* HAVE_NTGUI */ -#if defined (WINDOWSNT) || defined (HAVE_NTGUI) +#if defined WINDOWSNT || defined HAVE_NTGUI globals_of_w32select (); -#endif /* WINDOWSNT || HAVE_NTGUI */ - +#endif } init_charset (); === modified file 'src/image.c' --- src/image.c 2012-10-08 10:26:10 +0000 +++ src/image.c 2012-10-08 22:14:39 +0000 @@ -75,11 +75,12 @@ #endif /* HAVE_X_WINDOWS */ #ifdef HAVE_NTGUI -# ifdef WINDOWSNT -/* We only need (or want) w32.h when we're _not_ - * compiling for Cygwin */ + +/* We need (or want) w32.h only when we're _not_ compiling for Cygwin. */ +#ifdef WINDOWSNT # include "w32.h" -# endif /* WINDOWSNT */ +#endif + /* W32_TODO : Color tables on W32. */ #undef COLOR_TABLE_SUPPORT @@ -571,7 +572,7 @@ do { Vlibrary_cache = Fcons (Fcons (type, status), Vlibrary_cache); } while (0) #else #define CACHE_IMAGE_TYPE(type, status) -#endif /* WINDOWSNT */ +#endif #define ADD_IMAGE_TYPE(type) \ do { Vimage_types = Fcons (type, Vimage_types); } while (0) @@ -594,7 +595,7 @@ if (type->init) { -#if defined (HAVE_NTGUI) && defined (WINDOWSNT) +#if defined HAVE_NTGUI && defined WINDOWSNT /* If we failed to load the library before, don't try again. */ Lisp_Object tested = Fassq (target_type, Vlibrary_cache); if (CONSP (tested) && NILP (XCDR (tested))) @@ -3013,7 +3014,7 @@ {":background", IMAGE_STRING_OR_NIL_VALUE, 0} }; -#if defined(HAVE_NTGUI) && defined(WINDOWSNT) +#if defined HAVE_NTGUI && defined WINDOWSNT static bool init_xpm_functions (void); #else #define init_xpm_functions NULL @@ -3240,7 +3241,7 @@ #endif /* WINDOWSNT */ -#if defined (HAVE_NTGUI) && !defined (WINDOWSNT) +#if defined HAVE_NTGUI && !defined WINDOWSNT /* Glue for code below */ #define fn_XpmReadFileToImage XpmReadFileToImage #define fn_XpmCreateImageFromBuffer XpmCreateImageFromBuffer @@ -5352,7 +5353,7 @@ {":background", IMAGE_STRING_OR_NIL_VALUE, 0} }; -#if defined(HAVE_NTGUI) && defined (WINDOWSNT) +#if defined HAVE_NTGUI && defined WINDOWSNT static bool init_png_functions (void); #else #define init_png_functions NULL @@ -6011,7 +6012,7 @@ {":background", IMAGE_STRING_OR_NIL_VALUE, 0} }; -#if defined(HAVE_NTGUI) && defined(WINDOWSNT) +#if defined HAVE_NTGUI && defined WINDOWSNT static bool init_jpeg_functions (void); #else #define init_jpeg_functions NULL @@ -6075,7 +6076,7 @@ different name. This name, jpeg_boolean, remains in effect through the rest of image.c. */ -#if defined (CYGWIN) && defined (HAVE_NTGUI) +#if defined CYGWIN && defined HAVE_NTGUI #define boolean jpeg_boolean #endif #include @@ -7071,7 +7072,7 @@ {":background", IMAGE_STRING_OR_NIL_VALUE, 0} }; -#if defined(HAVE_NTGUI) && defined(WINDOWSNT) +#if defined HAVE_NTGUI && defined WINDOWSNT static bool init_gif_functions (void); #else #define init_gif_functions NULL === modified file 'src/keyboard.c' --- src/keyboard.c 2012-10-07 22:31:58 +0000 +++ src/keyboard.c 2012-10-08 22:14:39 +0000 @@ -313,7 +313,7 @@ /* Symbols to denote kinds of events. */ static Lisp_Object Qfunction_key; Lisp_Object Qmouse_click; -#if defined (HAVE_NTGUI) +#ifdef HAVE_NTGUI Lisp_Object Qlanguage_change; #endif static Lisp_Object Qdrag_n_drop; @@ -3947,7 +3947,7 @@ x_activate_menubar (XFRAME (event->frame_or_window)); } #endif -#if defined (HAVE_NTGUI) +#ifdef HAVE_NTGUI else if (event->kind == LANGUAGE_CHANGE_EVENT) { /* Make an event (language-change (FRAME CODEPAGE LANGUAGE-ID)). */ @@ -11394,7 +11394,7 @@ DEFSYM (Qconfig_changed_event, "config-changed-event"); DEFSYM (Qmenu_enable, "menu-enable"); -#if defined (HAVE_NTGUI) +#ifdef HAVE_NTGUI DEFSYM (Qlanguage_change, "language-change"); #endif === modified file 'src/termhooks.h' --- src/termhooks.h 2012-10-07 22:31:58 +0000 +++ src/termhooks.h 2012-10-08 22:14:39 +0000 @@ -107,7 +107,7 @@ HORIZ_WHEEL_EVENT, /* A wheel event generated by a second horizontal wheel that is present on some mice. See WHEEL_EVENT. */ -#if defined (HAVE_NTGUI) +#ifdef HAVE_NTGUI LANGUAGE_CHANGE_EVENT, /* A LANGUAGE_CHANGE_EVENT is generated when HAVE_NTGUI or on Mac OS when the keyboard layout or input ------------------------------------------------------------ revno: 110473 fixes bug: http://debbugs.gnu.org/12409 committer: Fabián Ezequiel Gallina branch nick: trunk timestamp: Mon 2012-10-08 18:51:02 -0300 message: * progmodes/python.el (python-shell-output-filter): Handle extra carriage return in OSX. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-10-08 21:30:36 +0000 +++ lisp/ChangeLog 2012-10-08 21:51:02 +0000 @@ -1,5 +1,10 @@ 2012-10-08 Fabián Ezequiel Gallina + * progmodes/python.el (python-shell-output-filter): Handle extra + carriage return in OSX (Bug#12409). + +2012-10-08 Fabián Ezequiel Gallina + Fix shell handling of unbalanced quotes and parens in output. * progmodes/python.el (python-rx-constituents): Added string-delimiter. === modified file 'lisp/progmodes/python.el' --- lisp/progmodes/python.el 2012-10-08 21:30:36 +0000 +++ lisp/progmodes/python.el 2012-10-08 21:51:02 +0000 @@ -1866,7 +1866,9 @@ python-shell-output-filter-buffer (concat python-shell-output-filter-buffer string)) (when (string-match - (format "\n\\(?:%s\\|%s\\|%s\\)$" + ;; XXX: It seems on OSX an extra carriage return is attached + ;; at the end of output, this handles that too. + (format "\r?\n\\(?:%s\\|%s\\|%s\\)$" python-shell-prompt-regexp python-shell-prompt-block-regexp python-shell-prompt-pdb-regexp) ------------------------------------------------------------ revno: 110472 committer: Fabián Ezequiel Gallina branch nick: trunk timestamp: Mon 2012-10-08 18:30:36 -0300 message: Fix shell handling of unbalanced quotes and parens in output. * progmodes/python.el (python-rx-constituents): Added string-delimiter. (python-syntax-propertize-function): Use it. (python-shell-output-syntax-table): New var. (inferior-python-mode): Prevent unbalanced parens/quotes from previous output mess with current input context. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-10-08 16:20:59 +0000 +++ lisp/ChangeLog 2012-10-08 21:30:36 +0000 @@ -1,3 +1,13 @@ +2012-10-08 Fabián Ezequiel Gallina + + Fix shell handling of unbalanced quotes and parens in output. + * progmodes/python.el (python-rx-constituents): Added + string-delimiter. + (python-syntax-propertize-function): Use it. + (python-shell-output-syntax-table): New var. + (inferior-python-mode): Prevent unbalanced parens/quotes from + previous output mess with current input context. + 2012-10-08 Juanma Barranquero * generic-x.el (javascript-generic-mode, javascript-generic-mode-hook): === modified file 'lisp/progmodes/python.el' --- lisp/progmodes/python.el 2012-10-08 05:19:15 +0000 +++ lisp/progmodes/python.el 2012-10-08 21:30:36 +0000 @@ -337,19 +337,28 @@ "==" ">=" "is" "not"))) ;; FIXME: Use regexp-opt. (assignment-operator . ,(rx (or "=" "+=" "-=" "*=" "/=" "//=" "%=" "**=" - ">>=" "<<=" "&=" "^=" "|=")))) - "Additional Python specific sexps for `python-rx'")) + ">>=" "<<=" "&=" "^=" "|="))) + (string-delimiter . ,(rx (and + ;; Match even number of backslashes. + (or (not (any ?\\ ?\' ?\")) point + ;; Quotes might be preceded by a escaped quote. + (and (or (not (any ?\\)) point) ?\\ + (* ?\\ ?\\) (any ?\' ?\"))) + (* ?\\ ?\\) + ;; Match single or triple quotes of any kind. + (group (or "\"" "\"\"\"" "'" "'''")))))) + "Additional Python specific sexps for `python-rx'") -(defmacro python-rx (&rest regexps) - "Python mode specialized rx macro. + (defmacro python-rx (&rest regexps) + "Python mode specialized rx macro. This variant of `rx' supports common python named REGEXPS." - (let ((rx-constituents (append python-rx-constituents rx-constituents))) - (cond ((null regexps) - (error "No regexp")) - ((cdr regexps) - (rx-to-string `(and ,@regexps) t)) - (t - (rx-to-string (car regexps) t))))) + (let ((rx-constituents (append python-rx-constituents rx-constituents))) + (cond ((null regexps) + (error "No regexp")) + ((cdr regexps) + (rx-to-string `(and ,@regexps) t)) + (t + (rx-to-string (car regexps) t)))))) ;;; Font-lock and syntax @@ -498,16 +507,7 @@ (defconst python-syntax-propertize-function (syntax-propertize-rules - ((rx - (and - ;; Match even number of backslashes. - (or (not (any ?\\ ?\' ?\")) point - ;; Quotes might be preceded by a escaped quote. - (and (or (not (any ?\\)) point) ?\\ - (* ?\\ ?\\) (any ?\' ?\"))) - (* ?\\ ?\\) - ;; Match single or triple quotes of any kind. - (group (or "\"" "\"\"\"" "'" "'''")))) + ((python-rx string-delimiter) (0 (ignore (python-syntax-stringify)))))) (defsubst python-syntax-count-quotes (quote-char &optional point limit) @@ -1609,6 +1609,20 @@ (defvar python-shell--parent-buffer nil) +(defvar python-shell-output-syntax-table + (let ((table (make-syntax-table python-dotty-syntax-table))) + (modify-syntax-entry ?\' "." table) + (modify-syntax-entry ?\" "." table) + (modify-syntax-entry ?\( "." table) + (modify-syntax-entry ?\[ "." table) + (modify-syntax-entry ?\{ "." table) + (modify-syntax-entry ?\) "." table) + (modify-syntax-entry ?\] "." table) + (modify-syntax-entry ?\} "." table) + table) + "Syntax table for shell output. +It makes parens and quotes be treated as punctuation chars.") + (define-derived-mode inferior-python-mode comint-mode "Inferior Python" "Major mode for Python inferior process. Runs a Python interpreter as a subprocess of Emacs, with Python @@ -1637,7 +1651,6 @@ python-shell-prompt-regexp python-shell-prompt-block-regexp python-shell-prompt-pdb-regexp)) - (set-syntax-table python-mode-syntax-table) (setq mode-line-process '(":%s")) (make-local-variable 'comint-output-filter-functions) (add-hook 'comint-output-filter-functions @@ -1658,10 +1671,21 @@ (make-local-variable 'python-pdbtrack-tracked-buffer) (make-local-variable 'python-shell-internal-last-output) (when python-shell-enable-font-lock + (set-syntax-table python-mode-syntax-table) (set (make-local-variable 'font-lock-defaults) '(python-font-lock-keywords nil nil nil nil)) (set (make-local-variable 'syntax-propertize-function) - python-syntax-propertize-function)) + (syntax-propertize-rules + (comint-prompt-regexp + (0 (ignore + (put-text-property + comint-last-input-start end 'syntax-table + python-shell-output-syntax-table) + (font-lock-unfontify-region comint-last-input-start end)))) + ((python-rx string-delimiter) + (0 (ignore + (and (not (eq (get-text-property start 'field) 'output)) + (python-syntax-stringify)))))))) (compilation-shell-minor-mode 1)) (defun python-shell-make-comint (cmd proc-name &optional pop internal) ------------------------------------------------------------ revno: 110471 committer: Eli Zaretskii branch nick: trunk timestamp: Mon 2012-10-08 21:58:54 +0200 message: Fix wording in src/ChangeLog entries from last commits. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-10-08 19:22:42 +0000 +++ src/ChangeLog 2012-10-08 19:58:54 +0000 @@ -1,8 +1,8 @@ 2012-10-08 Daniel Colascione * xdisp.c (start_hourglass): Call w32_note_current_window when - HAVE_NTGUI but not WINDOWSNT, resolving a problem that caused - Emacs to display the hourglass cursor forever. + HAVE_NTGUI, not just WINDOWSNT, resolving a problem in the cygw32 + build that caused Emacs to display the hourglass cursor forever. 2012-10-08 Jan Djärv * nsfont.m (Vfonts_in_cache): New variable. @@ -12,7 +12,7 @@ 2012-10-08 Daniel Colascione * w32fns.c (Fx_display_color_cells): Instead of using NCOLORS, - which is broke under remote desktop, calculating the number of + which is broken under remote desktop, calculate the number of colors available for a display based on the display's number of planes and number of bits per pixel per plane. (bug#10397). ------------------------------------------------------------ revno: 110470 committer: David Engster branch nick: trunk timestamp: Mon 2012-10-08 21:40:50 +0200 message: * semantic/bovine/el.el: Add `semantic-default-elisp-setup' to `emacs-lisp-mode-hook'. This was accidentally removed during the CEDET update (rev. 110325). diff: === modified file 'lisp/cedet/ChangeLog' --- lisp/cedet/ChangeLog 2012-10-08 06:58:36 +0000 +++ lisp/cedet/ChangeLog 2012-10-08 19:40:50 +0000 @@ -1,3 +1,9 @@ +2012-10-08 David Engster > + + * semantic/bovine/el.el: Add `semantic-default-elisp-setup' to + `emacs-lisp-mode-hook'. This was accidentally removed during the + CEDET update (rev. 110325). + 2012-10-07 David Engster * semantic/wisent/python.el (semantic-ctxt-current-function) === modified file 'lisp/cedet/semantic/bovine/el.el' --- lisp/cedet/semantic/bovine/el.el 2012-10-01 18:10:29 +0000 +++ lisp/cedet/semantic/bovine/el.el 2012-10-08 19:40:50 +0000 @@ -944,6 +944,8 @@ "Setup hook function for Emacs Lisp files and Semantic." ) +(add-hook 'emacs-lisp-mode-hook 'semantic-default-elisp-setup) + ;;; LISP MODE ;; ;; @TODO: Lisp supports syntaxes that Emacs Lisp does not. ------------------------------------------------------------ revno: 110469 committer: Daniel Colascione branch nick: cyg timestamp: Mon 2012-10-08 11:22:42 -0800 message: * xdisp.c (start_hourglass): Call w32_note_current_window when HAVE_NTGUI but not WINDOWSNT, resolving a problem that caused Emacs to display the hourglass cursor forever. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-10-08 18:47:29 +0000 +++ src/ChangeLog 2012-10-08 19:22:42 +0000 @@ -1,3 +1,9 @@ +2012-10-08 Daniel Colascione + + * xdisp.c (start_hourglass): Call w32_note_current_window when + HAVE_NTGUI but not WINDOWSNT, resolving a problem that caused + Emacs to display the hourglass cursor forever. + 2012-10-08 Jan Djärv * nsfont.m (Vfonts_in_cache): New variable. (nsfont_open): Use unsignedLongLongValue for cache in case wide ints === modified file 'src/xdisp.c' --- src/xdisp.c 2012-10-07 22:31:58 +0000 +++ src/xdisp.c 2012-10-08 19:22:42 +0000 @@ -29379,9 +29379,10 @@ else delay = make_emacs_time (DEFAULT_HOURGLASS_DELAY, 0); -#ifdef WINDOWSNT +#ifdef HAVE_NTGUI + extern void w32_note_current_window (void); w32_note_current_window (); -#endif +#endif /* HAVE_NTGUI */ hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay, show_hourglass, NULL); ------------------------------------------------------------ revno: 110468 [merge] committer: dancol@dancol.org branch nick: trunk timestamp: Mon 2012-10-08 10:47:29 -0800 message: Merge into trunk diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-10-08 18:31:39 +0000 +++ src/ChangeLog 2012-10-08 18:47:29 +0000 @@ -1,10 +1,15 @@ 2012-10-08 Jan Djärv - * nsfont.m (Vfonts_in_cache): New variable. (nsfont_open): Use unsignedLongLongValue for cache in case wide ints are used. Add cached fonts to Vfonts_in_cache. (syms_of_nsfont): Initialize and staticpro Vfonts_in_cache. +2012-10-08 Daniel Colascione + * w32fns.c (Fx_display_color_cells): Instead of using NCOLORS, + which is broke under remote desktop, calculating the number of + colors available for a display based on the display's number of + planes and number of bits per pixel per plane. (bug#10397). + 2012-10-08 Juanma Barranquero * makefile.w32-in (LOCAL_FLAGS): Don't define HAVE_NTGUI, it's now === modified file 'src/w32fns.c' --- src/w32fns.c 2012-10-08 12:53:18 +0000 +++ src/w32fns.c 2012-10-08 18:44:42 +0000 @@ -4642,22 +4642,14 @@ (Lisp_Object display) { struct w32_display_info *dpyinfo = check_x_display_info (display); - HDC hdc; int cap; - hdc = GetDC (dpyinfo->root_window); - if (dpyinfo->has_palette) - cap = GetDeviceCaps (hdc, SIZEPALETTE); - else - cap = GetDeviceCaps (hdc, NUMCOLORS); - - /* We force 24+ bit depths to 24-bit, both to prevent an overflow - and because probably is more meaningful on Windows anyway */ - if (cap < 0) - cap = 1 << min (dpyinfo->n_planes * dpyinfo->n_cbits, 24); - - ReleaseDC (dpyinfo->root_window, hdc); - + /* Don't use NCOLORS: it returns incorrect results under remote + * desktop. We force 24+ bit depths to 24-bit, both to prevent an + * overflow and because probably is more meaningful on Windows + * anyway. */ + + cap = 1 << min (dpyinfo->n_planes * dpyinfo->n_cbits, 24); return make_number (cap); } ------------------------------------------------------------ revno: 110467 committer: Jan D. branch nick: trunk timestamp: Mon 2012-10-08 20:31:39 +0200 message: Fix wide-int related error and cache error in NS font handling. * nsfont.m (Vfonts_in_cache): New variable. (nsfont_open): Use unsignedLongLongValue for cache in case wide ints are used. Add cached fonts to Vfonts_in_cache. (syms_of_nsfont): Initialize and staticpro Vfonts_in_cache. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-10-08 14:37:04 +0000 +++ src/ChangeLog 2012-10-08 18:31:39 +0000 @@ -1,3 +1,10 @@ +2012-10-08 Jan Djärv + + * nsfont.m (Vfonts_in_cache): New variable. + (nsfont_open): Use unsignedLongLongValue for cache in case wide ints + are used. Add cached fonts to Vfonts_in_cache. + (syms_of_nsfont): Initialize and staticpro Vfonts_in_cache. + 2012-10-08 Juanma Barranquero * makefile.w32-in (LOCAL_FLAGS): Don't define HAVE_NTGUI, it's now === modified file 'src/nsfont.m' --- src/nsfont.m 2012-09-23 08:44:20 +0000 +++ src/nsfont.m 2012-10-08 18:31:39 +0000 @@ -53,6 +53,9 @@ extern int ns_tmp_flags; extern struct nsfont_info *ns_tmp_font; +static Lisp_Object Vfonts_in_cache; + + /* font glyph and metrics caching functions, implemented at end */ static void ns_uni_to_glyphs (struct nsfont_info *font_info, unsigned char block); @@ -799,8 +802,7 @@ { if (NSFONT_TRACE) fprintf(stderr, "*** nsfont_open CACHE HIT!\n"); - /* FIXME: Cast from (unsigned long) to Lisp_Object. */ - XHASH (font_object) = [cached unsignedLongValue]; + XHASH (font_object) = [cached unsignedLongLongValue]; return font_object; } else @@ -808,9 +810,13 @@ font_object = font_make_object (VECSIZE (struct nsfont_info), font_entity, pixel_size); if (!synthItal) - [fontCache setObject: [NSNumber numberWithUnsignedLong: - (unsigned long) XHASH (font_object)] - forKey: nsfont]; + { + [fontCache setObject: [NSNumber + numberWithUnsignedLongLong: + (unsigned long long) XHASH (font_object)] + forKey: nsfont]; + Vfonts_in_cache = Fcons (font_object, Vfonts_in_cache); + } } font_info = (struct nsfont_info *) XFONT_OBJECT (font_object); @@ -1529,4 +1535,7 @@ doc: /* Internal use: maps font registry to Unicode script. */); ascii_printable = NULL; + + Vfonts_in_cache = Qnil; + staticpro (&Vfonts_in_cache); } ------------------------------------------------------------ revno: 110466 committer: Juanma Barranquero branch nick: trunk timestamp: Mon 2012-10-08 18:20:59 +0200 message: lisp/generic-x.el: Make javascript-generic-mode an obsolete alias of js-mode. diff: === modified file 'etc/NEWS' --- etc/NEWS 2012-10-08 09:23:31 +0000 +++ etc/NEWS 2012-10-08 16:20:59 +0000 @@ -431,6 +431,9 @@ specifying URL types which should be converted to remote file names at the FFAP prompt. The default is now '("ftp"). +** Generic-x +`javascript-generic-mode' is now an obsolete alias for `js-mode'. + ** Ibuffer *** New `derived-mode' filter, bound to `/ M'. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-10-08 13:59:18 +0000 +++ lisp/ChangeLog 2012-10-08 16:20:59 +0000 @@ -1,3 +1,8 @@ +2012-10-08 Juanma Barranquero + + * generic-x.el (javascript-generic-mode, javascript-generic-mode-hook): + Make obsolete aliases of js-mode and js-mode-hook (from js.el). + 2012-10-08 Michael Albinus * ffap.el (ffap-replace-file-component): Support Tramp file name === modified file 'lisp/generic-x.el' --- lisp/generic-x.el 2012-09-24 11:39:33 +0000 +++ lisp/generic-x.el 2012-10-08 16:20:59 +0000 @@ -646,83 +646,10 @@ "Generic mode for Sys V pkginfo files.")) ;; Javascript mode -;; Includes extra keywords from Armando Singer [asinger@MAIL.COLGATE.EDU] +;; Obsolete; defer to js-mode from js.el. (when (memq 'javascript-generic-mode generic-extras-enable-list) - -(define-generic-mode javascript-generic-mode - '("//" ("/*" . "*/")) - '("break" - "case" - "continue" - "default" - "delete" - "do" - "else" - "export" - "for" - "function" - "if" - "import" - "in" - "new" - "return" - "switch" - "this" - "typeof" - "var" - "void" - "while" - "with" - ;; words reserved for ECMA extensions below - "catch" - "class" - "const" - "debugger" - "enum" - "extends" - "finally" - "super" - "throw" - "try" - ;; Java Keywords reserved by JavaScript - "abstract" - "boolean" - "byte" - "char" - "double" - "false" - "final" - "float" - "goto" - "implements" - "instanceof" - "int" - "interface" - "long" - "native" - "null" - "package" - "private" - "protected" - "public" - "short" - "static" - "synchronized" - "throws" - "transient" - "true") - '(("^\\s-*function\\s-+\\([A-Za-z0-9_]+\\)" - (1 font-lock-function-name-face)) - ("^\\s-*var\\s-+\\([A-Za-z0-9_]+\\)" - (1 font-lock-variable-name-face))) - '("\\.js\\'") - (list - (function - (lambda () - (setq imenu-generic-expression - '((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1) - ("*Variables*" "^var\\s-+\\([A-Za-z0-9_]+\\)" 1)))))) - "Generic mode for JavaScript files.")) + (define-obsolete-function-alias 'javascript-generic-mode 'js-mode "24.3") + (define-obsolete-variable-alias 'javascript-generic-mode-hook 'js-mode-hook "24.3")) ;; VRML files (when (memq 'vrml-generic-mode generic-extras-enable-list) ------------------------------------------------------------ revno: 110465 committer: Glenn Morris branch nick: trunk timestamp: Mon 2012-10-08 09:11:41 -0700 message: Add 2012 to copyright years diff: === modified file 'src/w32select.h' --- src/w32select.h 2012-10-08 12:53:18 +0000 +++ src/w32select.h 2012-10-08 16:11:41 +0000 @@ -1,6 +1,6 @@ /* Selection processing for Emacs on the Microsoft W32 API. -Copyright (C) 1993-1994, 2001-2011 Free Software Foundation, Inc. +Copyright (C) 1993-1994, 2001-2012 Free Software Foundation, Inc. This file is part of GNU Emacs. ------------------------------------------------------------ revno: 110464 committer: Glenn Morris branch nick: trunk timestamp: Mon 2012-10-08 09:09:00 -0700 message: Distinguish MS Windows diff: === modified file 'configure.ac' --- configure.ac 2012-10-07 22:31:58 +0000 +++ configure.ac 2012-10-08 16:09:00 +0000 @@ -177,7 +177,7 @@ OPTION_DEFAULT_ON([xaw3d],[don't use Xaw3d]) OPTION_DEFAULT_ON([xim],[don't use X11 XIM]) OPTION_DEFAULT_OFF([ns],[use NeXTstep (Cocoa or GNUstep) windowing system]) -OPTION_DEFAULT_OFF([w32], [use native Windows GUI]) +OPTION_DEFAULT_OFF([w32], [use native MS Windows GUI]) OPTION_DEFAULT_ON([gpm],[don't use -lgpm for mouse support on a GNU/Linux console]) OPTION_DEFAULT_ON([dbus],[don't compile with D-Bus support]) @@ -1586,7 +1586,7 @@ AC_CHECK_HEADER([windows.h], [HAVE_W32=yes], [AC_MSG_ERROR([`--with-w32' was specified, but windows.h cannot be found.])]) - AC_DEFINE(HAVE_NTGUI, 1, [Define to use native Windows GUI.]) + AC_DEFINE(HAVE_NTGUI, 1, [Define to use native MS Windows GUI.]) W32_OBJ="w32fns.o w32menu.o w32reg.o w32font.o w32term.o" W32_OBJ="$W32_OBJ w32xfns.o w32select.o w32uniscribe.o" W32_LIBS="$W32_LIBS -lkernel32 -luser32 -lgdi32 -lole32 -lcomdlg32" ------------------------------------------------------------ revno: 110463 committer: Juanma Barranquero branch nick: trunk timestamp: Mon 2012-10-08 16:37:04 +0200 message: src/makefile.w32-in: Update dependencies. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-10-08 14:14:22 +0000 +++ src/ChangeLog 2012-10-08 14:37:04 +0000 @@ -2,6 +2,9 @@ * makefile.w32-in (LOCAL_FLAGS): Don't define HAVE_NTGUI, it's now in nt/config.nt. + (FONT_H): Define after FRAME_H. + ($(BLD)/emacs.$(O), $(BLD)/process.$(O), $(BLD)/w32heap.$(O)): + Update dependencies. * w32term.c: Remove leftover declaration of keyboard_codepage. === modified file 'src/makefile.w32-in' --- src/makefile.w32-in 2012-10-08 14:14:22 +0000 +++ src/makefile.w32-in 2012-10-08 14:37:04 +0000 @@ -423,11 +423,11 @@ $(W32GUI_H) FILEMODE_H = $(GNU_LIB)/filemode.h \ $(NT_INC)/sys/stat.h +FRAME_H = $(SRC)/frame.h \ + $(DISPEXTERN_H) FONT_H = $(SRC)/font.h \ - $(FRAME_H) \ - $(CCL_H) -FRAME_H = $(SRC)/frame.h \ - $(DISPEXTERN_H) + $(CCL_H) \ + $(FRAME_H) FTOASTR_H = $(GNU_LIB)/ftoastr.h \ $(GNU_LIB)/intprops.h GRP_H = $(NT_INC)/grp.h \ @@ -800,7 +800,6 @@ $(SRC)/w32.h \ $(SRC)/w32heap.h \ $(SRC)/w32select.h \ - $(SRC)/w32font.h \ $(NT_INC)/sys/file.h \ $(NT_INC)/unistd.h \ $(GNU_LIB)/ignore-value.h \ @@ -816,6 +815,7 @@ $(SYSSIGNAL_H) \ $(SYSTTY_H) \ $(TERMHOOKS_H) \ + $(W32FONT_H) \ $(W32TERM_H) \ $(WINDOW_H) @@ -1190,8 +1190,8 @@ $(BLD)/w32heap.$(O) : \ $(SRC)/w32heap.c \ + $(SRC)/w32common.h \ $(SRC)/w32heap.h \ - $(SRC)/w32common.h \ $(CONFIG_H) \ $(LISP_H) ------------------------------------------------------------ revno: 110462 committer: Juanma Barranquero branch nick: trunk timestamp: Mon 2012-10-08 16:14:22 +0200 message: nt/config.nt: Sync with autogen/config.in. (HAVE_NTGUI): New macro. src/makefile.w32-in (LOCAL_FLAGS): Don't define HAVE_NTGUI, it's now in nt/config.nt. diff: === modified file 'nt/ChangeLog' --- nt/ChangeLog 2012-10-02 17:55:29 +0000 +++ nt/ChangeLog 2012-10-08 14:14:22 +0000 @@ -1,3 +1,8 @@ +2012-10-08 Juanma Barranquero + + * config.nt: Sync with autogen/config.in. + (HAVE_NTGUI): New macro. + 2012-10-02 Eli Zaretskii * preprep.c (RVA_TO_PTR): Cast the result to 'void *', to avoid === modified file 'nt/config.nt' --- nt/config.nt 2012-09-30 15:49:05 +0000 +++ nt/config.nt 2012-10-08 14:14:22 +0000 @@ -701,6 +701,9 @@ Mac OS X. */ #undef HAVE_NS +/* Define to use native Windows GUI. */ +#define HAVE_NTGUI 1 + /* Define to 1 if libotf has OTF_get_variation_glyphs. */ #undef HAVE_OTF_GET_VARIATION_GLYPHS === modified file 'src/ChangeLog' --- src/ChangeLog 2012-10-08 13:46:03 +0000 +++ src/ChangeLog 2012-10-08 14:14:22 +0000 @@ -1,5 +1,8 @@ 2012-10-08 Juanma Barranquero + * makefile.w32-in (LOCAL_FLAGS): Don't define HAVE_NTGUI, it's now + in nt/config.nt. + * w32term.c: Remove leftover declaration of keyboard_codepage. 2012-10-08 Eli Zaretskii === modified file 'src/makefile.w32-in' --- src/makefile.w32-in 2012-10-08 13:31:14 +0000 +++ src/makefile.w32-in 2012-10-08 14:14:22 +0000 @@ -27,7 +27,7 @@ # Size in MBs of the static heap in temacs.exe. HEAPSIZE = $(EMACS_HEAPSIZE) -LOCAL_FLAGS = -Demacs=1 -I../lib -I../nt/inc -DHAVE_NTGUI=1 $(EMACS_EXTRA_C_FLAGS) +LOCAL_FLAGS = -Demacs=1 -I../lib -I../nt/inc $(EMACS_EXTRA_C_FLAGS) SRC = . EMACS = $(BLD)/emacs.exe ------------------------------------------------------------ revno: 110461 committer: Michael Albinus + + * ffap.el (ffap-replace-file-component): Support Tramp file name + syntax, not only ange-ftp's one. + 2012-10-08 Glenn Morris * cus-start.el (message-log-max): Set :version. === modified file 'lisp/ffap.el' --- lisp/ffap.el 2012-09-17 05:41:04 +0000 +++ lisp/ffap.el 2012-10-08 13:59:18 +0000 @@ -482,18 +482,12 @@ (defun ffap-replace-file-component (fullname name) "In remote FULLNAME, replace path with NAME. May return nil." - ;; Use ange-ftp or efs if loaded, but do not load them otherwise. - (let (found) - (mapc - (function (lambda (sym) (and (fboundp sym) (setq found sym)))) - '( - efs-replace-path-component - ange-ftp-replace-path-component - ange-ftp-replace-name-component - )) - (and found - (fset 'ffap-replace-file-component found) - (funcall found fullname name)))) + ;; Use efs if loaded, but do not load it otherwise. + (if (fboundp 'efs-replace-path-component) + (funcall efs-replace-path-component fullname name) + (and (stringp fullname) + (stringp name) + (concat (file-remote-p fullname) name)))) ;; (ffap-replace-file-component "/who@foo.com:/whatever" "/new") (defun ffap-file-suffix (file) ------------------------------------------------------------ revno: 110460 committer: Juanma Barranquero branch nick: trunk timestamp: Mon 2012-10-08 15:46:03 +0200 message: src/w32term.c: Remove leftover declaration of keyboard_codepage. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-10-08 13:31:14 +0000 +++ src/ChangeLog 2012-10-08 13:46:03 +0000 @@ -1,3 +1,7 @@ +2012-10-08 Juanma Barranquero + + * w32term.c: Remove leftover declaration of keyboard_codepage. + 2012-10-08 Eli Zaretskii * makefile.w32-in (FONT_H): Add $(FRAME_H). === modified file 'src/w32term.c' --- src/w32term.c 2012-10-07 22:31:58 +0000 +++ src/w32term.c 2012-10-08 13:46:03 +0000 @@ -201,9 +201,6 @@ int w32_message_fd = -1; #endif /* CYGWIN */ -/* Keyboard code page - may be changed by language-change events. */ -static int keyboard_codepage; - static void x_update_window_end (struct window *, int, int); static void w32_handle_tool_bar_click (struct frame *, struct input_event *); ------------------------------------------------------------ revno: 110459 committer: Eli Zaretskii branch nick: trunk timestamp: Mon 2012-10-08 15:31:14 +0200 message: Fix w32 dependencies due to introduction of w32common.h. src/makefile.w32-in ($(BLD)/unexw32.$(O)): ($(BLD)/w32.$(O)): ($(BLD)/w32console.$(O)): ($(BLD)/w32fns.$(O)): ($(BLD)/w32heap.$(O)): ($(BLD)/w32menu.$(O)): ($(BLD)/w32proc.$(O)): Add w32common.h. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-10-08 12:53:18 +0000 +++ src/ChangeLog 2012-10-08 13:31:14 +0000 @@ -4,6 +4,13 @@ (W32TERM_H): Add $(ATIMER_H) and $(FRAME_H). ($(BLD)/emacs.$(O), $(BLD)/w32console.$(O)): Update dependencies. (GLOBAL_SOURCES): Add cygw32.c. + ($(BLD)/unexw32.$(O)): + ($(BLD)/w32.$(O)): + ($(BLD)/w32console.$(O)): + ($(BLD)/w32fns.$(O)): + ($(BLD)/w32heap.$(O)): + ($(BLD)/w32menu.$(O)): + ($(BLD)/w32proc.$(O)): Add w32common.h. * w32fns.c (w32_color_map_lookup, x_to_w32_color): Argument is now 'const char *'. === modified file 'src/makefile.w32-in' --- src/makefile.w32-in 2012-10-08 12:21:04 +0000 +++ src/makefile.w32-in 2012-10-08 13:31:14 +0000 @@ -1172,6 +1172,7 @@ $(SRC)/w32.c \ $(SRC)/ndir.h \ $(SRC)/w32.h \ + $(SRC)/w32common.h \ $(SRC)/w32heap.h \ $(NT_INC)/pwd.h \ $(NT_INC)/sys/file.h \ @@ -1190,6 +1191,7 @@ $(BLD)/w32heap.$(O) : \ $(SRC)/w32heap.c \ $(SRC)/w32heap.h \ + $(SRC)/w32common.h \ $(CONFIG_H) \ $(LISP_H) @@ -1212,6 +1214,7 @@ $(SRC)/w32proc.c \ $(SRC)/syswait.h \ $(SRC)/w32.h \ + $(SRC)/w32common.h \ $(SRC)/w32heap.h \ $(NT_INC)/nl_types.h \ $(NT_INC)/sys/file.h \ @@ -1229,7 +1232,7 @@ $(SRC)/w32console.c \ $(SRC)/disptab.h \ $(SRC)/termchar.h \ - $(SRC)/w32heap.h \ + $(SRC)/w32common.h \ $(SRC)/w32inevt.h \ $(CHARACTER_H) \ $(CODING_H) \ @@ -1467,6 +1470,7 @@ $(BLD)/unexw32.$(O) : \ $(SRC)/unexw32.c \ $(SRC)/unexec.h \ + $(SRC)/w32common.h \ $(SRC)/w32heap.h \ $(CONFIG_H) @@ -1553,6 +1557,7 @@ $(SRC)/epaths.h \ $(SRC)/fontset.h \ $(SRC)/w32.h \ + $(SRC)/w32common.h \ $(SRC)/w32heap.h \ $(BUFFER_H) \ $(CCL_H) \ @@ -1576,7 +1581,7 @@ $(SRC)/w32menu.c \ $(SRC)/blockinput.h \ $(SRC)/keymap.h \ - $(SRC)/w32heap.h \ + $(SRC)/w32common.h \ $(BUFFER_H) \ $(CHARACTER_H) \ $(CHARSET_H) \ @@ -1626,7 +1631,7 @@ $(SRC)/w32select.c \ $(SRC)/blockinput.h \ $(SRC)/composite.h \ - $(SRC)/w32heap.h \ + $(SRC)/w32common.h \ $(CHARSET_H) \ $(CODING_H) \ $(CONFIG_H) \ ------------------------------------------------------------ revno: 110458 committer: Daniel Colascione branch nick: cyg timestamp: Mon 2012-10-08 04:53:18 -0800 message: Code cleanup for cygw32 diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-10-08 12:21:04 +0000 +++ src/ChangeLog 2012-10-08 12:53:18 +0000 @@ -11,6 +11,59 @@ 2012-10-08 Daniel Colascione + * w32term.h (WM_EMACS_BRINGTOTOP, WM_EMACS_INPUT_READY) + (WM_EMACS_END): Change WM_EMACS_BRINGTOTOP from 22 to 21 to close + accidental message numbering hole. Change other messages to + match. + + * w32select.h (HAVE_W32SELECT): Remove. + + * w32select.c, w32proc.c, w32menu.c, w32console.c, w32.c: Include + w32common.h instead of w32heap.h + + * w32heap.h (ROUND_UP, ROUND_DOWN, get_page_size) + (get_allocation_unit, get_processor_type, get_w32_major_version) + (get_w32_minor_version, sysinfo_cache, osinfo_cache) + (w32_major_version, w32_minor_version, w32_build_number, OS_9X) + (OS_NT, os_subtype, cache_system_info): Move declarations to + w32common. + + * w32heap.c: Include w32common.h. + (sysinfo_cache, syspage_mask, osinfo_cache, w32_major_version) + (w32_minor_version, w32_build_number, w32_subtype): Remove + duplicate definitions. + + * w32fns.c: Include w32common.h; include w32heap.h only in + WINDOWSNT. + + (Fx_file_dialog): Clarify comment on GetOpenFileName structure. + Use `report_file_error' instead of `error' in order to better + inform users of what went wrong. Increase NTGUI_UNICODE file + dialog box file name length to 32k, the maximum allowed by the NT + kernel. + + * w32common.h: New file. + (ROUND_UP, ROUND_DOWN, get_page_size) + (get_allocation_unit, get_processor_type, get_w32_major_version) + (get_w32_minor_version, sysinfo_cache, osinfo_cache) + (w32_major_version, w32_minor_version, w32_build_number, OS_9X) + (OS_NT, os_subtype, cache_system_info): Move here. + + * unexw32.c, unexcw.c: Include w32common.h. + + * emacs.c (main): Use (defined (WINDOWSNT) || defined + HAVE_NTGUI) instead of removed HAVE_W32SELECT to decide whether + to call syms_of_w32select. + + * cygw32.h: Remove obsolete EXFUN declarations. + + * cygw32.c (Qutf_16_le): Rename to Qutf_16le. + + * Makefile.in (SOME_MACHINE_OBJECTS): Reverse accidental removal + of w32inevt.o from SOME_MACHINE_OBJECTS. + +2012-10-08 Daniel Colascione + * image.c: Permanent fix for JPEG compilation issue --- limit jpeglib `boolean' redefinition to Cygwin builds. === modified file 'src/Makefile.in' --- src/Makefile.in 2012-10-07 22:31:58 +0000 +++ src/Makefile.in 2012-10-08 12:53:18 +0000 @@ -357,7 +357,7 @@ xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \ fontset.o dbusbind.o cygw32.o \ nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o \ - w32.o w32console.o w32fns.o w32heap.o \ + w32.o w32console.o w32fns.o w32heap.o w32inevt.o \ w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o \ w16select.o widget.o xfont.o ftfont.o xftfont.o ftxfont.o gtkutil.o \ xsettings.o xgselect.o termcap.o === modified file 'src/cygw32.c' --- src/cygw32.c 2012-10-08 09:41:04 +0000 +++ src/cygw32.c 2012-10-08 12:53:18 +0000 @@ -22,7 +22,7 @@ #include "buffer.h" #include #include -static Lisp_Object Qutf_16_le; +static Lisp_Object Qutf_16le; static Lisp_Object fchdir_unwind (Lisp_Object dir_fd) @@ -117,13 +117,13 @@ str = Fsubstring (str, make_number (0), make_number (-1)); } - return code_convert_string_norecord (str, Qutf_16_le, 0); + return code_convert_string_norecord (str, Qutf_16le, 0); } wchar_t * to_unicode (Lisp_Object str, Lisp_Object *buf) { - *buf = code_convert_string_norecord (str, Qutf_16_le, 1); + *buf = code_convert_string_norecord (str, Qutf_16le, 1); /* We need to make a another copy (in addition to the one made by code_convert_string_norecord) to ensure that the final string is _doubly_ zero terminated --- that is, that the string is @@ -163,7 +163,7 @@ syms_of_cygw32 (void) { /* No, not utf-16-le: that one has a BOM. */ - DEFSYM (Qutf_16_le, "utf-16le"); + DEFSYM (Qutf_16le, "utf-16le"); defsubr (&Scygwin_convert_path_from_windows); defsubr (&Scygwin_convert_path_to_windows); } === modified file 'src/cygw32.h' --- src/cygw32.h 2012-10-08 09:52:25 +0000 +++ src/cygw32.h 2012-10-08 12:53:18 +0000 @@ -46,11 +46,6 @@ object, to a multi-byte Emacs string, and return it. */ extern Lisp_Object from_unicode (Lisp_Object str); -/* *** Path conversion. *** */ - -EXFUN (Fcygwin_convert_path_to_windows, 2); -EXFUN (Fcygwin_convert_path_from_windows, 2); - /* *** Misc *** */ extern void syms_of_cygw32 (void); extern char * w32_strerror (int error_no); === modified file 'src/emacs.c' --- src/emacs.c 2012-10-08 10:01:59 +0000 +++ src/emacs.c 2012-10-08 12:53:18 +0000 @@ -1415,9 +1415,9 @@ syms_of_fontset (); #endif /* HAVE_NTGUI */ -#ifdef HAVE_W32SELECT +#if defined (WINDOWSNT) || defined (HAVE_NTGUI) syms_of_w32select (); -#endif /* HAVE_W32SELECT */ +#endif /* WINDOWSNT || HAVE_NTGUI */ #ifdef MSDOS syms_of_xmenu (); @@ -1465,9 +1465,10 @@ globals_of_w32menu (); #endif /* HAVE_NTGUI */ -#ifdef HAVE_W32SELECT +#if defined (WINDOWSNT) || defined (HAVE_NTGUI) globals_of_w32select (); -#endif /* HAVE_W32SELECT */ +#endif /* WINDOWSNT || HAVE_NTGUI */ + } init_charset (); === modified file 'src/unexcw.c' --- src/unexcw.c 2012-09-15 07:06:56 +0000 +++ src/unexcw.c 2012-10-08 12:53:18 +0000 @@ -20,6 +20,7 @@ #include #include "unexec.h" +#include "w32common.h" #include #include === modified file 'src/unexw32.c' --- src/unexw32.c 2012-10-07 22:31:58 +0000 +++ src/unexw32.c 2012-10-08 12:53:18 +0000 @@ -22,6 +22,7 @@ #include #include "unexec.h" +#include "w32common.h" #include #include === modified file 'src/w32.c' --- src/w32.c 2012-10-07 22:31:58 +0000 +++ src/w32.c 2012-10-08 12:53:18 +0000 @@ -173,6 +173,7 @@ #include "w32.h" #include "ndir.h" +#include "w32common.h" #include "w32heap.h" #include "systime.h" #include "dispextern.h" /* for xstrcasecmp */ === added file 'src/w32common.h' --- src/w32common.h 1970-01-01 00:00:00 +0000 +++ src/w32common.h 2012-10-08 12:53:18 +0000 @@ -0,0 +1,53 @@ +/* Common functions for Microsoft Windows builds of Emacs + Copyright (C) 2012 Free Software Foundation, Inc. + +This file is part of GNU Emacs. + +GNU Emacs is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +GNU Emacs is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Emacs. If not, see . + +*/ + +#ifndef W32COMMON_H +#define W32COMMON_H + +#include + +#define ROUND_UP(p, align) (((DWORD_PTR)(p) + (align)-1) & ~((DWORD_PTR)(align)-1)) +#define ROUND_DOWN(p, align) ((DWORD_PTR)(p) & ~((DWORD_PTR)(align)-1)) + +#define get_page_size() sysinfo_cache.dwPageSize +#define get_allocation_unit() sysinfo_cache.dwAllocationGranularity +#define get_processor_type() sysinfo_cache.dwProcessorType +#define get_w32_major_version() w32_major_version +#define get_w32_minor_version() w32_minor_version + +extern SYSTEM_INFO sysinfo_cache; +extern OSVERSIONINFO osinfo_cache; +extern unsigned long syspage_mask; + +extern int w32_major_version; +extern int w32_minor_version; +extern int w32_build_number; + +enum { + OS_9X = 1, + OS_NT +}; + +extern int os_subtype; + +/* Cache system info, e.g., the NT page size. */ +extern void cache_system_info (void); + +#endif /* W32COMMON_H */ === modified file 'src/w32console.c' --- src/w32console.c 2012-09-17 12:07:36 +0000 +++ src/w32console.c 2012-10-08 12:53:18 +0000 @@ -37,7 +37,7 @@ #include "termchar.h" #include "dispextern.h" #include "w32term.h" -#include "w32heap.h" /* for os_subtype */ +#include "w32common.h" /* for os_subtype */ #include "w32inevt.h" /* from window.c */ === modified file 'src/w32fns.c' --- src/w32fns.c 2012-10-08 11:19:35 +0000 +++ src/w32fns.c 2012-10-08 12:53:18 +0000 @@ -45,7 +45,11 @@ #include "systime.h" #include "termhooks.h" +#include "w32common.h" + +#ifdef WINDOWSNT #include "w32heap.h" +#endif /* WINDOWSNT */ #if CYGWIN #include "cygw32.h" @@ -6111,7 +6115,7 @@ } new_file_details; #ifdef NTGUI_UNICODE - wchar_t filename_buf[MAX_PATH + 1]; + wchar_t filename_buf[32*1024 + 1]; // NT kernel maximum OPENFILENAMEW * file_details = &new_file_details.details; #else /* not NTGUI_UNICODE */ char filename_buf[MAX_PATH + 1]; @@ -6173,11 +6177,12 @@ unixtodos_filename (SDATA (filename)); #endif /* NTGUI_UNICODE */ - /* Fill in the structure for the call to GetOpenFileName below. For - NTGUI_UNICODE builds (which run only on NT), we just use the - actual size of the structure. For non-NTGUI_UNICODE builds, we - tell the OS we're using an old version of the structure if it's not - new enough to support the newer version. */ + /* Fill in the structure for the call to GetOpenFileName below. + For NTGUI_UNICODE builds (which run only on NT), we just use + the actual size of the structure. For non-NTGUI_UNICODE + builds, we tell the OS we're using an old version of the + structure if the OS isn't new enough to support the newer + version. */ memset (&new_file_details, 0, sizeof (new_file_details)); if (w32_major_version > 4 && w32_major_version < 95) @@ -6187,7 +6192,7 @@ /* Set up the inout parameter for the selected file name. */ if (SBYTES (filename) + 1 > sizeof (filename_buf)) - error ("filename too long"); + report_file_error ("filename too long", default_filename); memcpy (filename_buf, SDATA (filename), SBYTES (filename) + 1); file_details->lpstrFile = filename_buf; === modified file 'src/w32heap.c' --- src/w32heap.c 2012-10-08 08:18:01 +0000 +++ src/w32heap.c 2012-10-08 12:53:18 +0000 @@ -23,26 +23,12 @@ #include #include +#include "w32common.h" #include "w32heap.h" #include "lisp.h" /* for VALMASK */ #define RVA_TO_PTR(rva) ((unsigned char *)((DWORD_PTR)(rva) + (DWORD_PTR)GetModuleHandle (NULL))) -/* This gives us the page size and the size of the allocation unit on NT. */ -SYSTEM_INFO sysinfo_cache; - -/* This gives us version, build, and platform identification. */ -extern unsigned long syspage_mask; -OSVERSIONINFO osinfo_cache; - -/* The major and minor versions of NT. */ -int w32_major_version; -int w32_minor_version; -int w32_build_number; - -/* Distinguish between Windows NT and Windows 95. */ -int os_subtype; - /* Emulate getpagesize. */ int getpagesize (void) === modified file 'src/w32heap.h' --- src/w32heap.h 2012-09-30 21:36:42 +0000 +++ src/w32heap.h 2012-10-08 12:53:18 +0000 @@ -24,9 +24,6 @@ #include -#define ROUND_UP(p, align) (((DWORD_PTR)(p) + (align)-1) & ~((DWORD_PTR)(align)-1)) -#define ROUND_DOWN(p, align) ((DWORD_PTR)(p) & ~((DWORD_PTR)(align)-1)) - /* * Heap related stuff. */ @@ -34,28 +31,11 @@ #define get_committed_heap_size() (get_data_end () - get_data_start ()) #define get_heap_start() get_data_start () #define get_heap_end() get_data_end () -#define get_page_size() sysinfo_cache.dwPageSize -#define get_allocation_unit() sysinfo_cache.dwAllocationGranularity -#define get_processor_type() sysinfo_cache.dwProcessorType -#define get_w32_major_version() w32_major_version -#define get_w32_minor_version() w32_minor_version extern unsigned char *get_data_start (void); extern unsigned char *get_data_end (void); extern size_t reserved_heap_size; -extern SYSTEM_INFO sysinfo_cache; -extern OSVERSIONINFO osinfo_cache; extern BOOL using_dynamic_heap; -extern int w32_major_version; -extern int w32_minor_version; -extern int w32_build_number; - -enum { - OS_9X = 1, - OS_NT -}; - -extern int os_subtype; /* Emulation of Unix sbrk(). */ extern void *sbrk (ptrdiff_t size); @@ -66,9 +46,6 @@ /* Round the heap to this size. */ extern void round_heap (size_t size); -/* Cache system info, e.g., the NT page size. */ -extern void cache_system_info (void); - /* ----------------------------------------------------------------- */ /* Useful routines for manipulating memory-mapped files. */ === modified file 'src/w32menu.c' --- src/w32menu.c 2012-10-07 22:31:58 +0000 +++ src/w32menu.c 2012-10-08 12:53:18 +0000 @@ -56,7 +56,7 @@ #include "dispextern.h" -#include "w32heap.h" /* for osinfo_cache */ +#include "w32common.h" /* for osinfo_cache */ #undef HAVE_DIALOGS /* TODO: Implement native dialogs. */ === modified file 'src/w32proc.c' --- src/w32proc.c 2012-10-07 22:31:58 +0000 +++ src/w32proc.c 2012-10-08 12:53:18 +0000 @@ -51,6 +51,7 @@ #include "lisp.h" #include "w32.h" +#include "w32common.h" #include "w32heap.h" #include "systime.h" #include "syswait.h" === modified file 'src/w32select.c' --- src/w32select.c 2012-10-07 22:31:58 +0000 +++ src/w32select.c 2012-10-08 12:53:18 +0000 @@ -75,7 +75,7 @@ #include #include "lisp.h" #include "w32term.h" /* for all of the w32 includes */ -#include "w32heap.h" /* os_subtype */ +#include "w32common.h" /* os_subtype */ #include "blockinput.h" #include "charset.h" #include "coding.h" === modified file 'src/w32select.h' --- src/w32select.h 2012-09-17 11:57:03 +0000 +++ src/w32select.h 2012-10-08 12:53:18 +0000 @@ -21,8 +21,6 @@ #define W32SELECT_H #include -#define HAVE_W32SELECT 1 - extern void syms_of_w32select (void); extern void globals_of_w32select (void); extern void term_w32select (void); === modified file 'src/w32term.h' --- src/w32term.h 2012-10-07 22:31:58 +0000 +++ src/w32term.h 2012-10-08 12:53:18 +0000 @@ -619,9 +619,9 @@ #define WM_EMACS_HIDE_CARET (WM_EMACS_START + 18) #define WM_EMACS_SETCURSOR (WM_EMACS_START + 19) #define WM_EMACS_PAINT (WM_EMACS_START + 20) -#define WM_EMACS_BRINGTOTOP (WM_EMACS_START + 22) -#define WM_EMACS_INPUT_READY (WM_EMACS_START + 23) -#define WM_EMACS_END (WM_EMACS_START + 24) +#define WM_EMACS_BRINGTOTOP (WM_EMACS_START + 21) +#define WM_EMACS_INPUT_READY (WM_EMACS_START + 22) +#define WM_EMACS_END (WM_EMACS_START + 23) #define WND_FONTWIDTH_INDEX (0) #define WND_LINEHEIGHT_INDEX (4) ------------------------------------------------------------ revno: 110457 committer: Eli Zaretskii branch nick: trunk timestamp: Mon 2012-10-08 14:21:04 +0200 message: Update w32 dependencies in the wake of cygw32 changes. src/makefile.w32-in (FONT_H): Add $(FRAME_H). (W32TERM_H): Add $(ATIMER_H) and $(FRAME_H). ($(BLD)/emacs.$(O), $(BLD)/w32console.$(O)): Update dependencies. (GLOBAL_SOURCES): Add cygw32.c. lib-src/makefile.w32-in (obj): Add cygw32.o. diff: === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2012-10-08 07:58:40 +0000 +++ lib-src/ChangeLog 2012-10-08 12:21:04 +0000 @@ -1,3 +1,7 @@ +2012-10-08 Eli Zaretskii + + * makefile.w32-in (obj): Add cygw32.o. + 2012-10-08 Daniel Colascione * emacsclient.c: Include windows.h when HAVE_NTGUI. === modified file 'lib-src/makefile.w32-in' --- lib-src/makefile.w32-in 2012-09-26 22:04:10 +0000 +++ lib-src/makefile.w32-in 2012-10-08 12:21:04 +0000 @@ -124,7 +124,7 @@ obj = dosfns.o msdos.o \ xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \ fontset.o menu.o \ - w32.o w32console.o w32fns.o w32heap.o w32inevt.o \ + w32.o w32console.o w32fns.o w32heap.o w32inevt.o cygw32.o \ w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o \ font.o w32font.o w32uniscribe.o \ dispnew.o frame.o scroll.o xdisp.o window.o bidi.o \ === modified file 'src/ChangeLog' --- src/ChangeLog 2012-10-08 11:19:35 +0000 +++ src/ChangeLog 2012-10-08 12:21:04 +0000 @@ -1,5 +1,10 @@ 2012-10-08 Eli Zaretskii + * makefile.w32-in (FONT_H): Add $(FRAME_H). + (W32TERM_H): Add $(ATIMER_H) and $(FRAME_H). + ($(BLD)/emacs.$(O), $(BLD)/w32console.$(O)): Update dependencies. + (GLOBAL_SOURCES): Add cygw32.c. + * w32fns.c (w32_color_map_lookup, x_to_w32_color): Argument is now 'const char *'. (x_to_w32_color): Don't modify the argument, modify a copy instead. === modified file 'src/makefile.w32-in' --- src/makefile.w32-in 2012-10-02 00:08:54 +0000 +++ src/makefile.w32-in 2012-10-08 12:21:04 +0000 @@ -207,7 +207,7 @@ GLOBAL_SOURCES = dosfns.c msdos.c \ xterm.c xfns.c xmenu.c xselect.c xrdb.c xsmfns.c fringe.c image.c \ fontset.c menu.c dbusbind.c \ - w32.c w32console.c w32fns.c w32heap.c w32inevt.c \ + w32.c w32console.c w32fns.c w32heap.c w32inevt.c cygw32.c \ w32menu.c w32proc.c w32reg.c w32select.c w32term.c w32xfns.c \ font.c w32font.c w32uniscribe.c \ dispnew.c frame.c scroll.c xdisp.c window.c bidi.c \ @@ -424,6 +424,7 @@ FILEMODE_H = $(GNU_LIB)/filemode.h \ $(NT_INC)/sys/stat.h FONT_H = $(SRC)/font.h \ + $(FRAME_H) \ $(CCL_H) FRAME_H = $(SRC)/frame.h \ $(DISPEXTERN_H) @@ -476,6 +477,8 @@ W32FONT_H = $(SRC)/w32font.h \ $(FONT_H) W32TERM_H = $(SRC)/w32term.h \ + $(ATIMER_H) \ + $(FRAME_H) \ $(W32GUI_H) WINDOW_H = $(SRC)/window.h \ $(DISPEXTERN_H) @@ -796,6 +799,8 @@ $(SRC)/unexec.h \ $(SRC)/w32.h \ $(SRC)/w32heap.h \ + $(SRC)/w32select.h \ + $(SRC)/w32font.h \ $(NT_INC)/sys/file.h \ $(NT_INC)/unistd.h \ $(GNU_LIB)/ignore-value.h \ @@ -1233,6 +1238,7 @@ $(FRAME_H) \ $(LISP_H) \ $(TERMHOOKS_H) \ + $(W32TERM_H) \ $(WINDOW_H) $(BLD)/print.$(O) : \ ------------------------------------------------------------ revno: 110456 committer: Eli Zaretskii branch nick: trunk timestamp: Mon 2012-10-08 13:19:35 +0200 message: Avoid compiler warnings on w32, caused by cygw32 changes. src/w32fns.c (w32_color_map_lookup, x_to_w32_color): Argument is now 'const char *'. (x_to_w32_color): Don't modify the argument, modify a copy instead. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-10-08 10:26:10 +0000 +++ src/ChangeLog 2012-10-08 11:19:35 +0000 @@ -1,3 +1,9 @@ +2012-10-08 Eli Zaretskii + + * w32fns.c (w32_color_map_lookup, x_to_w32_color): Argument is now + 'const char *'. + (x_to_w32_color): Don't modify the argument, modify a copy instead. + 2012-10-08 Daniel Colascione * image.c: Permanent fix for JPEG compilation issue --- limit === modified file 'src/w32fns.c' --- src/w32fns.c 2012-10-08 11:03:00 +0000 +++ src/w32fns.c 2012-10-08 11:19:35 +0000 @@ -697,7 +697,7 @@ } static Lisp_Object -w32_color_map_lookup (char *colorname) +w32_color_map_lookup (const char *colorname) { Lisp_Object tail, ret = Qnil; @@ -776,7 +776,7 @@ static Lisp_Object -x_to_w32_color (char * colorname) +x_to_w32_color (const char * colorname) { register Lisp_Object ret = Qnil; @@ -785,11 +785,10 @@ if (colorname[0] == '#') { /* Could be an old-style RGB Device specification. */ - char *color; - int size; - color = colorname + 1; + int size = strlen (colorname + 1); + char *color = alloca (size + 1); - size = strlen (color); + strcpy (color, colorname + 1); if (size == 3 || size == 6 || size == 9 || size == 12) { UINT colorval; @@ -843,7 +842,7 @@ } else if (strnicmp (colorname, "rgb:", 4) == 0) { - char *color; + const char *color; UINT colorval; int i, pos; pos = 0; @@ -899,7 +898,7 @@ else if (strnicmp (colorname, "rgbi:", 5) == 0) { /* This is an RGB Intensity specification. */ - char *color; + const char *color; UINT colorval; int i, pos; pos = 0; ------------------------------------------------------------ revno: 110455 committer: Eli Zaretskii branch nick: trunk timestamp: Mon 2012-10-08 13:03:00 +0200 message: Fix wording of comments in w32fns.c. diff: === modified file 'src/w32fns.c' --- src/w32fns.c 2012-10-07 22:31:58 +0000 +++ src/w32fns.c 2012-10-08 11:03:00 +0000 @@ -6128,8 +6128,8 @@ /* Note: under NTGUI_UNICODE, we do _NOT_ use ENCODE_FILE: the system file encoding expected by the platform APIs (e.g. Cygwin's - POSIX implementation) may not the same as the encoding expected - by the Windows API! */ + POSIX implementation) may not be the same as the encoding expected + by the Windows "ANSI" APIs! */ CHECK_STRING (prompt); CHECK_STRING (dir); @@ -6215,6 +6215,7 @@ { int count = SPECPDL_INDEX (); + /* Prevent redisplay. */ specbind (Qinhibit_redisplay, Qt); block_input (); file_details->lpfnHook = file_dialog_callback; ------------------------------------------------------------ revno: 110454 committer: Daniel Colascione branch nick: cyg timestamp: Mon 2012-10-08 02:26:10 -0800 message: Improve fix for jpeglib build break diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-10-08 10:07:16 +0000 +++ src/ChangeLog 2012-10-08 10:26:10 +0000 @@ -1,3 +1,8 @@ +2012-10-08 Daniel Colascione + + * image.c: Permanent fix for JPEG compilation issue --- limit + jpeglib `boolean' redefinition to Cygwin builds. + 2012-10-08 Eli Zaretskii * image.c (CHECK_LIB_AVAILABLE): Remove, no longer used. === modified file 'src/image.c' --- src/image.c 2012-10-08 10:05:50 +0000 +++ src/image.c 2012-10-08 10:26:10 +0000 @@ -6061,21 +6061,26 @@ #define __WIN32__ 1 #endif -#if 0 /* FIXME */ -/* Work around conflict between jpeg boolean and rpcndr.h - under Windows. */ +/* rpcndr.h (via windows.h) and jpeglib.h both define boolean types. + Some versions of jpeglib try to detect whether rpcndr.h is loaded, + using the Windows boolean type instead of the jpeglib boolean type + if so. Cygwin jpeglib, however, doesn't try to detect whether its + headers are included along with windows.h, so under Cygwin, jpeglib + attempts to define a conflicting boolean type. Worse, forcing + Cygwin jpeglib headers to use the Windows boolean type doesn't work + because it created an ABI incompatibility between the + already-compiled jpeg library and the header interface definition. + + The best we can do is to define jpeglib's boolean type to a + different name. This name, jpeg_boolean, remains in effect through + the rest of image.c. +*/ +#if defined (CYGWIN) && defined (HAVE_NTGUI) #define boolean jpeg_boolean #endif #include #include -/* Don't undefine boolean --- use the JPEG boolean - through the rest of the file. */ - -#ifdef HAVE_STLIB_H_1 -#define HAVE_STDLIB_H 1 -#endif - #ifdef WINDOWSNT /* JPEG library details. */ ------------------------------------------------------------ revno: 110453 committer: Glenn Morris branch nick: trunk timestamp: Mon 2012-10-08 06:17:36 -0400 message: Auto-commit of generated files. diff: === modified file 'autogen/Makefile.in' --- autogen/Makefile.in 2012-10-04 10:17:29 +0000 +++ autogen/Makefile.in 2012-10-08 10:17:36 +0000 @@ -753,6 +753,8 @@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ VERSION = @VERSION@ VMLIMIT_OBJ = @VMLIMIT_OBJ@ +W32_LIBS = @W32_LIBS@ +W32_OBJ = @W32_OBJ@ WARN_CFLAGS = @WARN_CFLAGS@ WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ WERROR_CFLAGS = @WERROR_CFLAGS@ === modified file 'autogen/config.in' --- autogen/config.in 2012-09-30 10:17:45 +0000 +++ autogen/config.in 2012-10-08 10:17:36 +0000 @@ -692,6 +692,9 @@ Mac OS X. */ #undef HAVE_NS +/* Define to use native Windows GUI. */ +#undef HAVE_NTGUI + /* Define to 1 if libotf has OTF_get_variation_glyphs. */ #undef HAVE_OTF_GET_VARIATION_GLYPHS === modified file 'autogen/configure' --- autogen/configure 2012-10-07 10:19:00 +0000 +++ autogen/configure 2012-10-08 10:17:36 +0000 @@ -1204,6 +1204,8 @@ VMLIMIT_OBJ GMALLOC_OBJ HAVE_XSERVER +W32_LIBS +W32_OBJ LIB_STANDARD NS_OBJC_OBJ NS_OBJ @@ -1362,6 +1364,7 @@ with_xaw3d with_xim with_ns +with_w32 with_gpm with_dbus with_gconf @@ -2081,6 +2084,7 @@ --without-xaw3d don't use Xaw3d --without-xim don't use X11 XIM --with-ns use NeXTstep (Cocoa or GNUstep) windowing system + --with-w32 use native Windows GUI --without-gpm don't use -lgpm for mouse support on a GNU/Linux console --without-dbus don't compile with D-Bus support @@ -4093,6 +4097,14 @@ fi +# Check whether --with-w32 was given. +if test "${with_w32+set}" = set; then : + withval=$with_w32; +else + with_w32=no +fi + + # Check whether --with-gpm was given. if test "${with_gpm+set}" = set; then : @@ -9568,6 +9580,7 @@ fi + INSTALL_ARCH_INDEP_EXTRA=install-etc ns_self_contained=no NS_OBJ= @@ -9603,6 +9616,38 @@ +HAVE_W32=no +W32_OBJ= +W32_LIBS= +if test "${with_w32}" != no; then + if test "${opsys}" != "cygwin"; then + as_fn_error "Using w32 with an autotools build is only supported for Cygwin." "$LINENO" 5 + fi + ac_fn_c_check_header_mongrel "$LINENO" "windows.h" "ac_cv_header_windows_h" "$ac_includes_default" +if test "x$ac_cv_header_windows_h" = x""yes; then : + HAVE_W32=yes +else + as_fn_error "\`--with-w32' was specified, but windows.h + cannot be found." "$LINENO" 5 +fi + + + +$as_echo "#define HAVE_NTGUI 1" >>confdefs.h + + W32_OBJ="w32fns.o w32menu.o w32reg.o w32font.o w32term.o" + W32_OBJ="$W32_OBJ w32xfns.o w32select.o w32uniscribe.o" + W32_LIBS="$W32_LIBS -lkernel32 -luser32 -lgdi32 -lole32 -lcomdlg32" + W32_LIBS="$W32_LIBS -lusp10 -lcomctl32 -lwinspool" +fi + + + +if test "${HAVE_W32}" = "yes"; then + window_system=w32 + with_xft=no +fi + ## $window_system is now set to the window system we will ## ultimately use. @@ -9635,6 +9680,9 @@ nextstep ) term_header=nsterm.h ;; + w32 ) + term_header=w32term.h + ;; esac if test -n "${term_header}"; then @@ -11701,6 +11749,10 @@ $as_echo "#define USE_TOOLKIT_SCROLL_BARS 1" >>confdefs.h USE_TOOLKIT_SCROLL_BARS=yes + elif test "${HAVE_W32}" = "yes"; then + $as_echo "#define USE_TOOLKIT_SCROLL_BARS 1" >>confdefs.h + + USE_TOOLKIT_SCROLL_BARS=yes fi fi @@ -12262,6 +12314,99 @@ ### Use -lXpm if available, unless `--with-xpm=no'. HAVE_XPM=no LIBXPM= + +if test "${HAVE_W32}" = "yes"; then + if test "${with_xpm}" != "no"; then + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + CPPFLAGS="$CPPFLAGS -I/usr/include/noX" + LDFLAGS="$LDFLAGS -L/usr/lib/noX" + ac_fn_c_check_header_mongrel "$LINENO" "X11/xpm.h" "ac_cv_header_X11_xpm_h" "$ac_includes_default" +if test "x$ac_cv_header_X11_xpm_h" = x""yes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XpmReadFileToImage in -lXpm" >&5 +$as_echo_n "checking for XpmReadFileToImage in -lXpm... " >&6; } +if test "${ac_cv_lib_Xpm_XpmReadFileToImage+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lXpm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char XpmReadFileToImage (); +int +main () +{ +return XpmReadFileToImage (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_Xpm_XpmReadFileToImage=yes +else + ac_cv_lib_Xpm_XpmReadFileToImage=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xpm_XpmReadFileToImage" >&5 +$as_echo "$ac_cv_lib_Xpm_XpmReadFileToImage" >&6; } +if test "x$ac_cv_lib_Xpm_XpmReadFileToImage" = x""yes; then : + HAVE_XPM=yes +fi + +fi + + + if test "${HAVE_XPM}" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XpmReturnAllocPixels preprocessor define" >&5 +$as_echo_n "checking for XpmReturnAllocPixels preprocessor define... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include "X11/xpm.h" +#ifndef XpmReturnAllocPixels +no_return_alloc_pixels +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "no_return_alloc_pixels" >/dev/null 2>&1; then : + HAVE_XPM=no +else + HAVE_XPM=yes +fi +rm -f conftest* + + + if test "${HAVE_XPM}" = "yes"; then + REAL_CPPFLAGS="$REAL_CPPFLAGS -I/usr/include/noX" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CPPFLAGS="$SAVE_CPPFLAGS" + LDFLAGS="$SAVE_LDFLAGS" + fi + fi + fi + + if test "${HAVE_XPM}" = "yes"; then + +$as_echo "#define HAVE_XPM 1" >>confdefs.h + + LIBXPM=-lXpm + fi +fi + if test "${HAVE_X11}" = "yes"; then if test "${with_xpm}" != "no"; then ac_fn_c_check_header_mongrel "$LINENO" "X11/xpm.h" "ac_cv_header_X11_xpm_h" "$ac_includes_default" @@ -12348,10 +12493,11 @@ fi + ### Use -ljpeg if available, unless `--with-jpeg=no'. HAVE_JPEG=no LIBJPEG= -if test "${HAVE_X11}" = "yes"; then +if test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then if test "${with_jpeg}" != "no"; then ac_fn_c_check_header_mongrel "$LINENO" "jerror.h" "ac_cv_header_jerror_h" "$ac_includes_default" if test "x$ac_cv_header_jerror_h" = x""yes; then : @@ -12430,7 +12576,7 @@ ### Use -lpng if available, unless `--with-png=no'. HAVE_PNG=no LIBPNG= -if test "${HAVE_X11}" = "yes"; then +if test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then if test "${with_png}" != "no"; then # Debian unstable as of July 2003 has multiple libpngs, and puts png.h # in /usr/include/libpng. @@ -12520,7 +12666,7 @@ ### Use -ltiff if available, unless `--with-tiff=no'. HAVE_TIFF=no LIBTIFF= -if test "${HAVE_X11}" = "yes"; then +if test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then if test "${with_tiff}" != "no"; then ac_fn_c_check_header_mongrel "$LINENO" "tiffio.h" "ac_cv_header_tiffio_h" "$ac_includes_default" if test "x$ac_cv_header_tiffio_h" = x""yes; then : @@ -12584,7 +12730,8 @@ ### Use -lgif or -lungif if available, unless `--with-gif=no'. HAVE_GIF=no LIBGIF= -if test "${HAVE_X11}" = "yes" && test "${with_gif}" != "no"; then +if test "${HAVE_X11}" = "yes" && test "${with_gif}" != "no" \ + || test "${HAVE_W32}" = "yes"; then ac_fn_c_check_header_mongrel "$LINENO" "gif_lib.h" "ac_cv_header_gif_lib_h" "$ac_includes_default" if test "x$ac_cv_header_gif_lib_h" = x""yes; then : # EGifPutExtensionLast only exists from version libungif-4.1.0b1. @@ -12805,6 +12952,9 @@ OTHER_FILES=ns-app fi +if test "${HAVE_W32}" = "yes"; then + HAVE_MENUS=yes +fi ### Use session management (-lSM -lICE) if available HAVE_X_SM=no @@ -16078,7 +16228,7 @@ if test "$opsys" = "cygwin"; then - CYGWIN_OBJ="sheap.o" + CYGWIN_OBJ="sheap.o cygw32.o" ## Cygwin differs because of its unexec(). PRE_ALLOC_OBJ= POST_ALLOC_OBJ=lastfile.o ------------------------------------------------------------ revno: 110452 committer: Eli Zaretskii branch nick: trunk timestamp: Mon 2012-10-08 12:07:16 +0200 message: Commit ChangeLog for last change. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-10-08 10:01:59 +0000 +++ src/ChangeLog 2012-10-08 10:07:16 +0000 @@ -1,5 +1,7 @@ 2012-10-08 Eli Zaretskii + * image.c (CHECK_LIB_AVAILABLE): Remove, no longer used. + * emacs.c (DAEMON_MUST_EXEC) [HAVE_NTGUI]: Define this only on Cygwin. ------------------------------------------------------------ revno: 110451 committer: Eli Zaretskii branch nick: trunk timestamp: Mon 2012-10-08 12:05:50 +0200 message: Remove CHECK_LIB_AVAILABLE from image.c, mistakenly reintroduced by cygw32. src/image.c (CHECK_LIB_AVAILABLE): Remove, no longer used. diff: === modified file 'src/image.c' --- src/image.c 2012-10-08 09:19:20 +0000 +++ src/image.c 2012-10-08 10:05:50 +0000 @@ -8783,16 +8783,6 @@ Initialization ***********************************************************************/ -#ifdef WINDOWSNT -/* Image types that rely on external libraries are loaded dynamically - if the library is available. */ -#define CHECK_LIB_AVAILABLE(image_type, init_lib_fn, libraries) \ - define_image_type (image_type, init_lib_fn (libraries)) -#else -#define CHECK_LIB_AVAILABLE(image_type, init_lib_fn, libraries) \ - define_image_type (image_type, 1) -#endif /* WINDOWSNT */ - DEFUN ("init-image-library", Finit_image_library, Sinit_image_library, 1, 1, 0, doc: /* Initialize image library implementing image type TYPE. Return non-nil if TYPE is a supported image type. ------------------------------------------------------------ revno: 110450 committer: Eli Zaretskii branch nick: trunk timestamp: Mon 2012-10-08 12:01:59 +0200 message: Fix conditional macros in emacs.c, introduced by cygw32 addition. src/emacs.c (DAEMON_MUST_EXEC) [HAVE_NTGUI]: Define this only on Cygwin. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-10-08 07:58:40 +0000 +++ src/ChangeLog 2012-10-08 10:01:59 +0000 @@ -1,3 +1,8 @@ +2012-10-08 Eli Zaretskii + + * emacs.c (DAEMON_MUST_EXEC) [HAVE_NTGUI]: Define this only on + Cygwin. + 2012-10-08 Daniel Colascione * xfaces.c, xdisp.c, window.c, w32xfns.c, w32term.h, w32term.c, === modified file 'src/emacs.c' --- src/emacs.c 2012-10-07 22:31:58 +0000 +++ src/emacs.c 2012-10-08 10:01:59 +0000 @@ -179,7 +179,7 @@ We mark being in the exec'd process by a daemon name argument of form "--daemon=\nFD0,FD1\nNAME" where FD are the pipe file descriptors, NAME is the original daemon name, if any. */ -#if defined (NS_IMPL_COCOA) || defined (HAVE_NTGUI) +#if defined (NS_IMPL_COCOA) || (defined (HAVE_NTGUI) && defined (CYGWIN)) # define DAEMON_MUST_EXEC #endif ------------------------------------------------------------ revno: 110449 committer: Eli Zaretskii branch nick: trunk timestamp: Mon 2012-10-08 11:52:25 +0200 message: Fix comments in src/cygw32.h. diff: === modified file 'src/cygw32.h' --- src/cygw32.h 2012-10-08 09:41:04 +0000 +++ src/cygw32.h 2012-10-08 09:52:25 +0000 @@ -38,13 +38,12 @@ /* Access the wide-character string stored in a Lisp string object. */ #define WCSDATA(x) ((wchar_t *) SDATA (x)) -/* Convert the Emacs string in STR to UTF-16LE and store a new string - containing the encoded version of STR into *BUF. BUF may safely - point to STR on entry. */ +/* Convert the multi-byte string in STR to UTF-16LE encoded unibyte + string, and store it in *BUF. BUF may safely point to STR on entry. */ extern wchar_t *to_unicode (Lisp_Object str, Lisp_Object *buf); -/* Convert STR, a UTF-16LE encoded string embedded in an Emacs string - object, to a normal Emacs string and return it. */ +/* Convert STR, a UTF-16LE encoded string embedded in a unibyte string + object, to a multi-byte Emacs string, and return it. */ extern Lisp_Object from_unicode (Lisp_Object str); /* *** Path conversion. *** */ ------------------------------------------------------------ revno: 110448 committer: Eli Zaretskii branch nick: trunk timestamp: Mon 2012-10-08 11:41:04 +0200 message: Fix copyright years in new cygw32 files. diff: === modified file 'src/cygw32.c' --- src/cygw32.c 2012-09-17 11:57:03 +0000 +++ src/cygw32.c 2012-10-08 09:41:04 +0000 @@ -1,5 +1,5 @@ /* Cygwin support routines. - Copyright (C) 2011 Free Software Foundation, Inc. + Copyright (C) 2011-2012 Free Software Foundation, Inc. This file is part of GNU Emacs. === modified file 'src/cygw32.h' --- src/cygw32.h 2012-09-17 11:57:03 +0000 +++ src/cygw32.h 2012-10-08 09:41:04 +0000 @@ -1,5 +1,5 @@ /* Header for Cygwin support routines. - Copyright (C) 2011 Free Software Foundation, Inc. + Copyright (C) 2011-2012 Free Software Foundation, Inc. This file is part of GNU Emacs. ------------------------------------------------------------ revno: 110447 committer: Eli Zaretskii branch nick: trunk timestamp: Mon 2012-10-08 11:32:40 +0200 message: Fix the MSDOS configury due to changes in revno 110444. msdos/sed1v2.inp (W32_LIBS, W32_OBJ): Edit to empty. diff: === modified file 'msdos/ChangeLog' --- msdos/ChangeLog 2012-10-04 07:15:42 +0000 +++ msdos/ChangeLog 2012-10-08 09:32:40 +0000 @@ -1,3 +1,7 @@ +2012-10-08 Eli Zaretskii + + * sed1v2.inp (W32_LIBS, W32_OBJ): Edit to empty. + 2012-10-04 Paul Eggert Merge from gnulib. === modified file 'msdos/sed1v2.inp' --- msdos/sed1v2.inp 2012-09-27 23:02:23 +0000 +++ msdos/sed1v2.inp 2012-10-08 09:32:40 +0000 @@ -128,6 +128,8 @@ /^CANNOT_DUMP *=/s/@CANNOT_DUMP@/no/ /^DEPFLAGS *=/s/@DEPFLAGS@// /^MKDEPDIR *=/s/@MKDEPDIR@// +/^W32_OBJ *=/s/@W32_OBJ@// +/^W32_LIBS *=/s/@W32_LIBS@// /^version *=/s/@[^@\n]*@// /^@SET_MAKE@$/s/@SET_MAKE@// /^ [ ]*\$(libsrc)\/make-docfile.*>.*\/DOC/s!make-docfile!make-docfile -o $(etc)/DOC! ------------------------------------------------------------ revno: 110446 committer: Eli Zaretskii branch nick: trunk timestamp: Mon 2012-10-08 11:23:31 +0200 message: etc/NEWS: Fix wording in the Cygwin-related entries of the last change. diff: === modified file 'etc/NEWS' --- etc/NEWS 2012-10-08 08:23:13 +0000 +++ etc/NEWS 2012-10-08 09:23:31 +0000 @@ -887,10 +887,10 @@ Emacs now supports mouse highlight, help-echo (in the echo area), and mouse-autoselect-window. -** Two new functions are available in Cygwin builds of Emacs: +** Two new functions are available in Cygwin builds of Emacs: cygwin-convert-path-from-windows and cygwin-convert-path-to-windows. -These functions allows lisp code to access the Cygwin path mapping -machinery to convert between Cygwin and Windows-native paths. +These functions allow Lisp code to access the Cygwin file-name mapping +machinery to convert between Cygwin and Windows-native file names. ** On MS-Windows Vista and later Emacs now supports symbolic links. ------------------------------------------------------------ revno: 110445 committer: Eli Zaretskii branch nick: trunk timestamp: Mon 2012-10-08 11:19:20 +0200 message: Temporary fix for changes in revno 110444. diff: === modified file 'src/image.c' --- src/image.c 2012-10-07 22:31:58 +0000 +++ src/image.c 2012-10-08 09:19:20 +0000 @@ -3240,13 +3240,13 @@ #endif /* WINDOWSNT */ -#ifdef HAVE_NTGUI +#if defined (HAVE_NTGUI) && !defined (WINDOWSNT) /* Glue for code below */ #define fn_XpmReadFileToImage XpmReadFileToImage #define fn_XpmCreateImageFromBuffer XpmCreateImageFromBuffer #define fn_XImageFree XImageFree #define fn_XpmFreeAttributes XpmFreeAttributes -#endif /* HAVE_NTGUI */ +#endif /* HAVE_NTGUI && !WINDOWSNT */ /* Value is true if COLOR_SYMBOLS is a valid color symbols list for XPM images. Such a list must consist of conses whose car and @@ -6061,9 +6061,11 @@ #define __WIN32__ 1 #endif +#if 0 /* FIXME */ /* Work around conflict between jpeg boolean and rpcndr.h under Windows. */ #define boolean jpeg_boolean +#endif #include #include ------------------------------------------------------------ revno: 110444 [merge] committer: Daniel Colascione branch nick: trunk timestamp: Mon 2012-10-08 00:23:13 -0800 message: Merge cygw32 diff: === modified file 'ChangeLog' --- ChangeLog 2012-10-07 10:07:23 +0000 +++ ChangeLog 2012-10-08 07:58:40 +0000 @@ -1,3 +1,12 @@ +2012-10-08 Daniel Colascione + + * configure.ac: Add --with-w32 as a window system option. Limit + it to Cygwin for now. Integrate w32 into the refactored window + system configuration and set TERM_HEADER to w32term.h when w32 is + configured. + + (CYGWIN_OBJ): Add cygw32.o. + 2012-10-07 Jan Djärv * configure.ac: Check that OSX is 10.4 or newer. === modified file 'configure.ac' --- configure.ac 2012-10-07 10:07:23 +0000 +++ configure.ac 2012-10-07 22:31:58 +0000 @@ -177,6 +177,7 @@ OPTION_DEFAULT_ON([xaw3d],[don't use Xaw3d]) OPTION_DEFAULT_ON([xim],[don't use X11 XIM]) OPTION_DEFAULT_OFF([ns],[use NeXTstep (Cocoa or GNUstep) windowing system]) +OPTION_DEFAULT_OFF([w32], [use native Windows GUI]) OPTION_DEFAULT_ON([gpm],[don't use -lgpm for mouse support on a GNU/Linux console]) OPTION_DEFAULT_ON([dbus],[don't compile with D-Bus support]) @@ -1534,6 +1535,7 @@ AC_DEFINE(NS_HAVE_NSINTEGER, 1, [Define to 1 if `NSInteger' is defined.]) fi fi + AC_SUBST(TEMACS_LDFLAGS2) INSTALL_ARCH_INDEP_EXTRA=install-etc @@ -1574,6 +1576,30 @@ AC_SUBST(NS_OBJC_OBJ) AC_SUBST(LIB_STANDARD) +HAVE_W32=no +W32_OBJ= +W32_LIBS= +if test "${with_w32}" != no; then + if test "${opsys}" != "cygwin"; then + AC_MSG_ERROR([Using w32 with an autotools build is only supported for Cygwin.]) + fi + AC_CHECK_HEADER([windows.h], [HAVE_W32=yes], + [AC_MSG_ERROR([`--with-w32' was specified, but windows.h + cannot be found.])]) + AC_DEFINE(HAVE_NTGUI, 1, [Define to use native Windows GUI.]) + W32_OBJ="w32fns.o w32menu.o w32reg.o w32font.o w32term.o" + W32_OBJ="$W32_OBJ w32xfns.o w32select.o w32uniscribe.o" + W32_LIBS="$W32_LIBS -lkernel32 -luser32 -lgdi32 -lole32 -lcomdlg32" + W32_LIBS="$W32_LIBS -lusp10 -lcomctl32 -lwinspool" +fi +AC_SUBST(W32_OBJ) +AC_SUBST(W32_LIBS) + +if test "${HAVE_W32}" = "yes"; then + window_system=w32 + with_xft=no +fi + ## $window_system is now set to the window system we will ## ultimately use. @@ -1610,6 +1636,9 @@ nextstep ) term_header=nsterm.h ;; + w32 ) + term_header=w32term.h + ;; esac if test -n "${term_header}"; then @@ -2310,6 +2339,9 @@ elif test "${HAVE_NS}" = "yes"; then AC_DEFINE(USE_TOOLKIT_SCROLL_BARS) USE_TOOLKIT_SCROLL_BARS=yes + elif test "${HAVE_W32}" = "yes"; then + AC_DEFINE(USE_TOOLKIT_SCROLL_BARS) + USE_TOOLKIT_SCROLL_BARS=yes fi fi @@ -2476,6 +2508,41 @@ ### Use -lXpm if available, unless `--with-xpm=no'. HAVE_XPM=no LIBXPM= + +if test "${HAVE_W32}" = "yes"; then + if test "${with_xpm}" != "no"; then + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + CPPFLAGS="$CPPFLAGS -I/usr/include/noX" + LDFLAGS="$LDFLAGS -L/usr/lib/noX" + AC_CHECK_HEADER(X11/xpm.h, + [AC_CHECK_LIB(Xpm, XpmReadFileToImage, HAVE_XPM=yes)]) + if test "${HAVE_XPM}" = "yes"; then + AC_MSG_CHECKING(for XpmReturnAllocPixels preprocessor define) + AC_EGREP_CPP(no_return_alloc_pixels, + [#include "X11/xpm.h" +#ifndef XpmReturnAllocPixels +no_return_alloc_pixels +#endif + ], HAVE_XPM=no, HAVE_XPM=yes) + + if test "${HAVE_XPM}" = "yes"; then + REAL_CPPFLAGS="$REAL_CPPFLAGS -I/usr/include/noX" + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + CPPFLAGS="$SAVE_CPPFLAGS" + LDFLAGS="$SAVE_LDFLAGS" + fi + fi + fi + + if test "${HAVE_XPM}" = "yes"; then + AC_DEFINE(HAVE_XPM, 1, [Define to 1 if you have the Xpm libary (-lXpm).]) + LIBXPM=-lXpm + fi +fi + if test "${HAVE_X11}" = "yes"; then if test "${with_xpm}" != "no"; then AC_CHECK_HEADER(X11/xpm.h, @@ -2502,12 +2569,13 @@ LIBXPM=-lXpm fi fi + AC_SUBST(LIBXPM) ### Use -ljpeg if available, unless `--with-jpeg=no'. HAVE_JPEG=no LIBJPEG= -if test "${HAVE_X11}" = "yes"; then +if test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then if test "${with_jpeg}" != "no"; then dnl Checking for jpeglib.h can lose because of a redefinition of dnl HAVE_STDLIB_H. @@ -2535,7 +2603,7 @@ ### Use -lpng if available, unless `--with-png=no'. HAVE_PNG=no LIBPNG= -if test "${HAVE_X11}" = "yes"; then +if test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then if test "${with_png}" != "no"; then # Debian unstable as of July 2003 has multiple libpngs, and puts png.h # in /usr/include/libpng. @@ -2568,7 +2636,7 @@ ### Use -ltiff if available, unless `--with-tiff=no'. HAVE_TIFF=no LIBTIFF= -if test "${HAVE_X11}" = "yes"; then +if test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then if test "${with_tiff}" != "no"; then AC_CHECK_HEADER(tiffio.h, [tifflibs="-lz -lm" @@ -2588,7 +2656,8 @@ ### Use -lgif or -lungif if available, unless `--with-gif=no'. HAVE_GIF=no LIBGIF= -if test "${HAVE_X11}" = "yes" && test "${with_gif}" != "no"; then +if test "${HAVE_X11}" = "yes" && test "${with_gif}" != "no" \ + || test "${HAVE_W32}" = "yes"; then AC_CHECK_HEADER(gif_lib.h, # EGifPutExtensionLast only exists from version libungif-4.1.0b1. # Earlier versions can crash Emacs. @@ -2670,6 +2739,9 @@ OTHER_FILES=ns-app fi +if test "${HAVE_W32}" = "yes"; then + HAVE_MENUS=yes +fi ### Use session management (-lSM -lICE) if available HAVE_X_SM=no @@ -4205,7 +4277,7 @@ AC_SUBST(RALLOC_OBJ) if test "$opsys" = "cygwin"; then - CYGWIN_OBJ="sheap.o" + CYGWIN_OBJ="sheap.o cygw32.o" ## Cygwin differs because of its unexec(). PRE_ALLOC_OBJ= POST_ALLOC_OBJ=lastfile.o === modified file 'etc/NEWS' --- etc/NEWS 2012-10-08 07:23:49 +0000 +++ etc/NEWS 2012-10-08 08:23:13 +0000 @@ -78,6 +78,11 @@ (from the bin and libexec directories, respectively). The former is no longer relevant, the latter is replaced by lisp (in vc-sccs.el). +--- +** The native Windows user interface is available for Cygwin. Passing +--with-w32 will configure a Cygwin emacs to use the Windows user +interface instead of the default, X11. + * Startup Changes in Emacs 24.3 @@ -882,6 +887,11 @@ Emacs now supports mouse highlight, help-echo (in the echo area), and mouse-autoselect-window. +** Two new functions are available in Cygwin builds of Emacs: +cygwin-convert-path-from-windows and cygwin-convert-path-to-windows. +These functions allows lisp code to access the Cygwin path mapping +machinery to convert between Cygwin and Windows-native paths. + ** On MS-Windows Vista and later Emacs now supports symbolic links. * Changes in Emacs 24.2 === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2012-10-01 14:22:23 +0000 +++ lib-src/ChangeLog 2012-10-08 07:58:40 +0000 @@ -1,3 +1,16 @@ +2012-10-08 Daniel Colascione + + * emacsclient.c: Include windows.h when HAVE_NTGUI. + (alt_display): New variable. We send the display held by this + variable when the primary display is either unsupported or not + present. + (longopts): Allow display everywhere. + (w32_set_user_model_id): Move lower in file, inside HAVE_NTGUI + section. + (decode_options): Use alt_display. Explain why. + (main): Retry connection with alt_display if connection with main + display fails. + 2012-10-01 Fabrice Popineau * make-docfile.c (write_globals): Special-case === modified file 'lib-src/emacsclient.c' --- lib-src/emacsclient.c 2012-08-19 21:00:09 +0000 +++ lib-src/emacsclient.c 2012-09-17 11:55:05 +0000 @@ -44,6 +44,10 @@ #else /* !WINDOWSNT */ +# ifdef HAVE_NTGUI +# include +# endif /* HAVE_NTGUI */ + # include "syswait.h" # ifdef HAVE_INET_SOCKETS @@ -140,6 +144,9 @@ /* The display on which Emacs should work. --display. */ const char *display = NULL; +/* The alternate display we should try if Emacs does not support display. */ +const char *alt_display = NULL; + /* The parent window ID, if we are opening a frame via XEmbed. */ char *parent_id = NULL; @@ -182,9 +189,7 @@ { "socket-name", required_argument, NULL, 's' }, #endif { "server-file", required_argument, NULL, 'f' }, -#ifndef WINDOWSNT { "display", required_argument, NULL, 'd' }, -#endif { "parent-id", required_argument, NULL, 'p' }, { 0, 0, 0, 0 } }; @@ -385,32 +390,6 @@ return NULL; } -void -w32_set_user_model_id (void) -{ - HMODULE shell; - HRESULT (WINAPI * set_user_model) (wchar_t * id); - - /* On Windows 7 and later, we need to set the user model ID - to associate emacsclient launched files with Emacs frames - in the UI. */ - shell = LoadLibrary ("shell32.dll"); - if (shell) - { - set_user_model - = (void *) GetProcAddress (shell, - "SetCurrentProcessExplicitAppUserModelID"); - /* If the function is defined, then we are running on Windows 7 - or newer, and the UI uses this to group related windows - together. Since emacs, runemacs, emacsclient are related, we - want them grouped even though the executables are different, - so we need to set a consistent ID between them. */ - if (set_user_model) - set_user_model (L"GNU.Emacs"); - - FreeLibrary (shell); - } -} int w32_window_app (void) @@ -605,16 +584,29 @@ Without the -c option, we used to set `display' to $DISPLAY by default, but this changed the default behavior and is sometimes inconvenient. So we force users to use "--display $DISPLAY" if - they want Emacs to connect to their current display. */ + they want Emacs to connect to their current display. + + Some window systems have a notion of default display not + reflected in the DISPLAY variable. If the user didn't give us an + explicit display, try this platform-specific after trying the + display in DISPLAY (if any). */ if (!current_frame && !tty && !display) { + /* Set these here so we use a default_display only when the user + didn't give us an explicit display. */ +#if defined (NS_IMPL_COCOA) + alt_display = "ns"; +#elif defined (HAVE_NTGUI) + alt_display = "w32"; +#endif + display = egetenv ("DISPLAY"); -#ifdef NS_IMPL_COCOA - /* Under Cocoa, we don't really use displays the same way as in X, - so provide a dummy. */ - if (!display || strlen (display) == 0) - display = "ns"; -#endif + } + + if (!display) + { + display = alt_display; + alt_display = NULL; } /* A null-string display is invalid. */ @@ -1415,10 +1407,37 @@ exit (EXIT_FAILURE); } -#ifdef WINDOWSNT +#ifdef HAVE_NTGUI FARPROC set_fg; /* Pointer to AllowSetForegroundWindow. */ FARPROC get_wc; /* Pointer to RealGetWindowClassA. */ +void +w32_set_user_model_id (void) +{ + HMODULE shell; + HRESULT (WINAPI * set_user_model) (wchar_t * id); + + /* On Windows 7 and later, we need to set the user model ID + to associate emacsclient launched files with Emacs frames + in the UI. */ + shell = LoadLibrary ("shell32.dll"); + if (shell) + { + set_user_model + = (void *) GetProcAddress (shell, + "SetCurrentProcessExplicitAppUserModelID"); + /* If the function is defined, then we are running on Windows 7 + or newer, and the UI uses this to group related windows + together. Since emacs, runemacs, emacsclient are related, we + want them grouped even though the executables are different, + so we need to set a consistent ID between them. */ + if (set_user_model) + set_user_model (L"GNU.Emacs"); + + FreeLibrary (shell); + } +} + BOOL CALLBACK w32_find_emacs_process (HWND hWnd, LPARAM lParam) { @@ -1467,7 +1486,7 @@ && (get_wc = GetProcAddress (user32, "RealGetWindowClassA"))) EnumWindows (w32_find_emacs_process, (LPARAM) 0); } -#endif +#endif /* HAVE_NTGUI */ /* Start the emacs daemon and try to connect to it. */ @@ -1537,11 +1556,13 @@ main_argv = argv; progname = argv[0]; -#ifdef WINDOWSNT - /* On Windows 7 and later, we need to explicitly associate emacsclient - with emacs so the UI behaves sensibly. */ +#ifdef HAVE_NTGUI + /* On Windows 7 and later, we need to explicitly associate + emacsclient with emacs so the UI behaves sensibly. This + association does no harm if we're not actually connecting to an + Emacs using a window display. */ w32_set_user_model_id (); -#endif +#endif /* HAVE_NTGUI */ /* Process options. */ decode_options (argc, argv); @@ -1577,9 +1598,10 @@ fail (); } -#ifdef WINDOWSNT +#ifdef HAVE_NTGUI + if (display && !strcmp (display, "w32")) w32_give_focus (); -#endif +#endif /* HAVE_NTGUI */ /* Send over our environment and current directory. */ if (!current_frame) @@ -1748,46 +1770,56 @@ if (end_p != NULL) *end_p++ = '\0'; - if (strprefix ("-emacs-pid ", p)) - { - /* -emacs-pid PID: The process id of the Emacs process. */ - emacs_pid = strtol (p + strlen ("-emacs-pid"), NULL, 10); - } - else if (strprefix ("-window-system-unsupported ", p)) - { - /* -window-system-unsupported: Emacs was compiled without X - support. Try again on the terminal. */ - nowait = 0; - tty = 1; - goto retry; - } - else if (strprefix ("-print ", p)) - { - /* -print STRING: Print STRING on the terminal. */ - str = unquote_argument (p + strlen ("-print ")); - if (needlf) - printf ("\n"); - printf ("%s", str); - needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; - } - else if (strprefix ("-print-nonl ", p)) - { - /* -print-nonl STRING: Print STRING on the terminal. - Used to continue a preceding -print command. */ - str = unquote_argument (p + strlen ("-print-nonl ")); - printf ("%s", str); - needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; - } - else if (strprefix ("-error ", p)) - { - /* -error DESCRIPTION: Signal an error on the terminal. */ - str = unquote_argument (p + strlen ("-error ")); - if (needlf) - printf ("\n"); - fprintf (stderr, "*ERROR*: %s", str); - needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; - exit_status = EXIT_FAILURE; - } + if (strprefix ("-emacs-pid ", p)) + { + /* -emacs-pid PID: The process id of the Emacs process. */ + emacs_pid = strtol (p + strlen ("-emacs-pid"), NULL, 10); + } + else if (strprefix ("-window-system-unsupported ", p)) + { + /* -window-system-unsupported: Emacs was compiled without support + for whatever window system we tried. Try the alternate + display, or, failing that, try the terminal. */ + if (alt_display) + { + display = alt_display; + alt_display = NULL; + } + else + { + nowait = 0; + tty = 1; + } + + goto retry; + } + else if (strprefix ("-print ", p)) + { + /* -print STRING: Print STRING on the terminal. */ + str = unquote_argument (p + strlen ("-print ")); + if (needlf) + printf ("\n"); + printf ("%s", str); + needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; + } + else if (strprefix ("-print-nonl ", p)) + { + /* -print-nonl STRING: Print STRING on the terminal. + Used to continue a preceding -print command. */ + str = unquote_argument (p + strlen ("-print-nonl ")); + printf ("%s", str); + needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; + } + else if (strprefix ("-error ", p)) + { + /* -error DESCRIPTION: Signal an error on the terminal. */ + str = unquote_argument (p + strlen ("-error ")); + if (needlf) + printf ("\n"); + fprintf (stderr, "*ERROR*: %s", str); + needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; + exit_status = EXIT_FAILURE; + } #ifdef SIGSTOP else if (strprefix ("-suspend ", p)) { === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-10-08 07:18:02 +0000 +++ lisp/ChangeLog 2012-10-08 08:23:13 +0000 @@ -30,6 +30,73 @@ * comint.el (comint-preinput-scroll-to-bottom): Preserve the frame-selected-windows. +2012-10-08 Daniel Colascione + + * battery.el (battery-status-function): Check for + w32-battery-status itself, not system-time windows-nt. + + * frame.el: Require cl-lib. + (display-format-alist): New variable mapping frame types to + functions that initialize them. + (window-system-for-display): New function: interprets + display-format-alist. + (make-frame-on-display): Remove existing display-selection logic + and just forward to make-frame, which will now DTRT. + (make-frame): Restructure to use window-system-for-display to + figure out how to create a frame on a given display. + (display-mouse-p): Look for frame-type w32, not a particular + system-type. + + * loadup.el: Load w32 lisp code when we have the w32 feature. + + * mouse.el (mouse-yank-primarY): Look for frame-type w32, not + system-type windows-nt. + + * server.el (server-create-window-system-frame): Look for window + type. + (server-proces-filter): Only force a window system when windows-nt + _and_ w32. Explain why. + + * simple.el (normal-erase-is-backspace-mode): Add w32 to the list + of window systems we configure for the mode. + + * startup.el (command-line): Mark window system is initialized + after we've done it. + + * common-win.el (x-select-text): Look for w32, not windows-nt. + + * ns-win.el: Require cl-lib. Add ourselves to + display-format-alist. + (ns-initialize-window-system): Assert we're not initialized twice. + + * w32-win.el: Enable lexical binding; require cl-lib; add + ourselves to display-format-alist. + (w32-handle-dropped-file): Convert incoming dropped files from + Windows paths to Cygwin ones before passing them on to the rest of + Emacs. + (w32-drag-n-drop): New paramter new-frame. Simplify logic. + (w32-initialize-window-system): Assert we're not initialized twice. + + * x-win.el: Require cl-lib; add ourselves to display-format-alist. + (x-initialize-window-system): Assert we're not initialized twice. + + * w32-common-fns.el: New File. + (w32-version, w32-using-nt, w32-get-clipboard-data) + (w32-set-clipboard-data, x-set-selection, x-get-selection) + (w32-charset-info-alist, x-last-selected, text) + (x-get-selection-value, x-selection-value): Move here. + + * w32-fns.el: Require w32-common-fns. + (w32-version, w32-using-nt, w32-get-clipboard-data) + (w32-set-clipboard-data, x-set-selection, x-get-selection) + (w32-charset-info-alist, x-last-selected, text) + (x-get-selection-value, x-selection-value): Move to + w32-common-fns. + + * w32-vars.el: + (w32-allow-system-shell, w32-system-shells): Define only in + non-cygwin case. + 2012-10-07 Stefan Monnier * subr.el (read-passwd-map): Don't use `defconst' (bug#12597). === modified file 'lisp/battery.el' --- lisp/battery.el 2012-07-10 11:51:54 +0000 +++ lisp/battery.el 2012-09-17 11:55:02 +0000 @@ -60,7 +60,7 @@ (> (buffer-size) 0))) (error nil))) 'battery-pmset) - ((eq system-type 'windows-nt) + ((fboundp 'w32-battery-status) 'w32-battery-status)) "Function for getting battery status information. The function has to return an alist of conversion definitions. === modified file 'lisp/faces.el' --- lisp/faces.el 2012-10-02 00:40:56 +0000 +++ lisp/faces.el 2012-10-07 22:31:58 +0000 @@ -96,7 +96,7 @@ ;; This is defined originally in xfaces.c. (defcustom face-font-registry-alternatives (mapcar (lambda (arg) (mapcar 'purecopy arg)) - (if (eq system-type 'windows-nt) + (if (featurep 'w32) '(("iso8859-1" "ms-oemlatin") ("gb2312.1980" "gb2312" "gbk" "gb18030") ("jisx0208.1990" "jisx0208.1983" "jisx0208.1978") === modified file 'lisp/frame.el' --- lisp/frame.el 2012-09-17 05:41:04 +0000 +++ lisp/frame.el 2012-09-17 12:07:36 +0000 @@ -25,6 +25,8 @@ ;;; Commentary: ;;; Code: +(eval-when-compile (require 'cl-lib)) + (defvar frame-creation-function-alist (list (cons nil (if (fboundp 'tty-create-frame-with-faces) @@ -45,6 +47,12 @@ ALIST supersede the corresponding parameters specified in `default-frame-alist'.") +(defvar display-format-alist nil + "Alist of patterns to decode display names. +The car of each entry is a regular expression matching a display +name string. The cdr is a symbol giving the window-system that +handles the corresponding kind of display.") + ;; The initial value given here used to ask for a minibuffer. ;; But that's not necessary, because the default is to have one. ;; By not specifying it here, we let an X resource specify it. @@ -510,31 +518,19 @@ 0)) (select-frame-set-input-focus (selected-frame))) -(declare-function x-initialize-window-system "term/x-win" ()) -(declare-function ns-initialize-window-system "term/ns-win" ()) -(defvar x-display-name) ; term/x-win +(defun window-system-for-display (display) + "Return the window system for DISPLAY. +Return nil if we don't know how to interpret DISPLAY." + (cl-loop for descriptor in display-format-alist + for pattern = (car descriptor) + for system = (cdr descriptor) + when (string-match-p pattern display) return system)) (defun make-frame-on-display (display &optional parameters) "Make a frame on display DISPLAY. The optional argument PARAMETERS specifies additional frame parameters." (interactive "sMake frame on display: ") - (cond ((featurep 'ns) - (when (and (boundp 'ns-initialized) (not ns-initialized)) - (setq x-display-name display) - (ns-initialize-window-system)) - (make-frame `((window-system . ns) - (display . ,display) . ,parameters))) - ((eq system-type 'windows-nt) - ;; On Windows, ignore DISPLAY. - (make-frame parameters)) - (t - (unless (string-match-p "\\`[^:]*:[0-9]+\\(\\.[0-9]+\\)?\\'" display) - (error "Invalid display, not HOST:SERVER or HOST:SERVER.SCREEN")) - (when (and (boundp 'x-initialized) (not x-initialized)) - (setq x-display-name display) - (x-initialize-window-system)) - (make-frame `((window-system . x) - (display . ,display) . ,parameters))))) + (make-frame (cons (cons 'display display) parameters))) (declare-function x-close-connection "xfns.c" (terminal)) @@ -616,6 +612,8 @@ (window-system . nil) The frame should be displayed on a terminal device. (window-system . x) The frame should be displayed in an X window. + (display . \":0\") The frame should appear on display :0. + (terminal . TERMINAL) The frame should use the terminal object TERMINAL. In addition, any parameter specified in `default-frame-alist', @@ -626,11 +624,15 @@ creating the frame, it runs the hook `after-make-frame-functions' with one arg, the newly created frame. +If a display parameter is supplied and a window-system is not, +guess the window-system from the display. + On graphical displays, this function does not itself make the new frame the selected frame. However, the window system may select the new frame according to its own rules." (interactive) - (let* ((w (cond + (let* ((display (cdr (assq 'display parameters))) + (w (cond ((assq 'terminal parameters) (let ((type (terminal-live-p (cdr (assq 'terminal parameters))))) (cond @@ -640,6 +642,10 @@ (t type)))) ((assq 'window-system parameters) (cdr (assq 'window-system parameters))) + (display + (or (window-system-for-display display) + (error "Don't know how to interpret display \"%S\"" + display))) (t window-system))) (frame-creation-function (cdr (assq w frame-creation-function-alist))) (oldframe (selected-frame)) @@ -647,6 +653,11 @@ frame) (unless frame-creation-function (error "Don't know how to create a frame on window system %s" w)) + + (unless (get w 'window-system-initialized) + (funcall (cdr (assq w window-system-initialization-alist))) + (put w 'window-system-initialized t)) + ;; Add parameters from `window-system-default-frame-alist'. (dolist (p (cdr (assq w window-system-default-frame-alist))) (unless (assq (car p) params) @@ -1260,7 +1271,7 @@ (cond ((eq frame-type 'pc) (msdos-mouse-p)) - ((eq system-type 'windows-nt) + ((eq frame-type 'w32) (with-no-warnings (> w32-num-mouse-buttons 0))) ((memq frame-type '(x ns)) === modified file 'lisp/international/mule-cmds.el' --- lisp/international/mule-cmds.el 2012-09-25 04:13:02 +0000 +++ lisp/international/mule-cmds.el 2012-10-07 22:31:58 +0000 @@ -2670,7 +2670,8 @@ ;; On Windows, override locale-coding-system, ;; default-file-name-coding-system, keyboard-coding-system, ;; terminal-coding-system with system codepage. - (when (boundp 'w32-ansi-code-page) + (when (and (eq system-type 'windows-nt) + (boundp 'w32-ansi-code-page)) (let ((code-page-coding (intern (format "cp%d" w32-ansi-code-page)))) (when (coding-system-p code-page-coding) (unless frame (setq locale-coding-system code-page-coding)) === modified file 'lisp/loadup.el' --- lisp/loadup.el 2012-09-04 17:40:25 +0000 +++ lisp/loadup.el 2012-09-17 12:07:36 +0000 @@ -237,15 +237,18 @@ (load "term/common-win") (load "term/x-win"))) -(if (eq system-type 'windows-nt) +(if (or (eq system-type 'windows-nt) + (featurep 'w32)) (progn + (load "term/common-win") (load "w32-vars") - (load "term/common-win") (load "term/w32-win") - (load "ls-lisp") (load "disp-table") - (load "dos-w32") - (load "w32-fns"))) + (load "w32-common-fns") + (when (eq system-type 'windows-nt) + (load "w32-fns") + (load "ls-lisp") + (load "dos-w32")))) (if (eq system-type 'ms-dos) (progn (load "dos-w32") === modified file 'lisp/mouse.el' --- lisp/mouse.el 2012-09-25 04:13:02 +0000 +++ lisp/mouse.el 2012-10-07 22:31:58 +0000 @@ -1151,7 +1151,7 @@ (or mouse-yank-at-point (mouse-set-point click)) (let ((primary (cond - ((eq system-type 'windows-nt) + ((eq (framep (selected-frame)) 'w32) ;; MS-Windows emulates PRIMARY in x-get-selection, but not ;; in x-get-selection-value (the latter only accesses the ;; clipboard). So try PRIMARY first, in case they selected === modified file 'lisp/server.el' --- lisp/server.el 2012-09-30 09:18:38 +0000 +++ lisp/server.el 2012-10-07 22:31:58 +0000 @@ -833,35 +833,40 @@ (defun server-create-window-system-frame (display nowait proc parent-id &optional parameters) - (add-to-list 'frame-inherited-parameters 'client) - (if (not (fboundp 'make-frame-on-display)) - (progn - ;; This emacs does not support X. - (server-log "Window system unsupported" proc) - (server-send-string proc "-window-system-unsupported \n") - nil) - ;; Flag frame as client-created, but use a dummy client. - ;; This will prevent the frame from being deleted when - ;; emacsclient quits while also preventing - ;; `server-save-buffers-kill-terminal' from unexpectedly - ;; killing emacs on that frame. - (let* ((params `((client . ,(if nowait 'nowait proc)) - ;; This is a leftover, see above. - (environment . ,(process-get proc 'env)) - ,@parameters)) - (display (or display - (frame-parameter nil 'display) - (getenv "DISPLAY") - (error "Please specify display"))) - frame) - (if parent-id - (push (cons 'parent-id (string-to-number parent-id)) params)) - (setq frame (make-frame-on-display display params)) - (server-log (format "%s created" frame) proc) - (select-frame frame) - (process-put proc 'frame frame) - (process-put proc 'terminal (frame-terminal frame)) - frame))) + (let* ((display (or display + (frame-parameter nil 'display) + (error "Please specify display."))) + (w (or (cdr (assq 'window-system parameters)) + (window-system-for-display display)))) + + (unless (assq w window-system-initialization-alist) + (setq w nil)) + + (cond (w + ;; Flag frame as client-created, but use a dummy client. + ;; This will prevent the frame from being deleted when + ;; emacsclient quits while also preventing + ;; `server-save-buffers-kill-terminal' from unexpectedly + ;; killing emacs on that frame. + (let* ((params `((client . ,(if nowait 'nowait proc)) + ;; This is a leftover, see above. + (environment . ,(process-get proc 'env)) + ,@parameters)) + frame) + (if parent-id + (push (cons 'parent-id (string-to-number parent-id)) params)) + (add-to-list 'frame-inherited-parameters 'client) + (setq frame (make-frame-on-display display params)) + (server-log (format "%s created" frame) proc) + (select-frame frame) + (process-put proc 'frame frame) + (process-put proc 'terminal (frame-terminal frame)) + frame)) + + (t + (server-log "Window system unsupported" proc) + (server-send-string proc "-window-system-unsupported \n") + nil)))) (defun server-goto-toplevel (proc) (condition-case nil @@ -1121,9 +1126,13 @@ tty-type (pop args-left) dontkill (or dontkill (not use-current-frame))) - ;; On Windows, emacsclient always asks for a tty frame. - ;; If running a GUI server, force the frame type to GUI. - (when (eq window-system 'w32) + ;; On Windows, emacsclient always asks for a tty + ;; frame. If running a GUI server, force the frame + ;; type to GUI. (Cygwin is perfectly happy with + ;; multi-tty support, so don't override the user's + ;; choice there.) + (when (and (eq system-type 'windows-nt) + (eq window-system 'w32)) (push "-window-system" args-left))) ;; -position LINE[:COLUMN]: Set point to the given === modified file 'lisp/simple.el' --- lisp/simple.el 2012-09-30 08:41:37 +0000 +++ lisp/simple.el 2012-10-07 22:31:58 +0000 @@ -6872,7 +6872,7 @@ (if (if (eq normal-erase-is-backspace 'maybe) (and (not noninteractive) (or (memq system-type '(ms-dos windows-nt)) - (memq window-system '(ns)) + (memq window-system '(w32 ns)) (and (memq window-system '(x)) (fboundp 'x-backspace-delete-keys-p) (x-backspace-delete-keys-p)) === modified file 'lisp/startup.el' --- lisp/startup.el 2012-09-30 09:18:38 +0000 +++ lisp/startup.el 2012-10-07 22:31:58 +0000 @@ -890,7 +890,8 @@ ;; Initialize the window system. (Open connection, etc.) (funcall (or (cdr (assq initial-window-system window-system-initialization-alist)) - (error "Unsupported window system `%s'" initial-window-system)))) + (error "Unsupported window system `%s'" initial-window-system))) + (put initial-window-system 'window-system-initialized t)) ;; If there was an error, print the error message and exit. (error (princ === modified file 'lisp/term/common-win.el' --- lisp/term/common-win.el 2012-01-19 07:21:25 +0000 +++ lisp/term/common-win.el 2012-09-17 11:55:02 +0000 @@ -57,7 +57,7 @@ On Nextstep, put TEXT in the pasteboard (`x-select-enable-clipboard' is not used)." - (cond ((eq system-type 'windows-nt) + (cond ((eq (framep (selected-frame)) 'w32) (if x-select-enable-clipboard (w32-set-clipboard-data text)) (setq x-last-selected-text text)) === modified file 'lisp/term/ns-win.el' --- lisp/term/ns-win.el 2012-10-07 17:47:41 +0000 +++ lisp/term/ns-win.el 2012-10-07 22:31:58 +0000 @@ -39,7 +39,7 @@ ;; this file, which works in close coordination with src/nsfns.m. ;;; Code: - +(eval-when-compile (require 'cl-lib)) (or (featurep 'ns) (error "%s: Loading ns-win.el but not compiled for GNUstep/MacOS" (invocation-name))) @@ -909,6 +909,7 @@ ;; defines functions and variables that we use now. (defun ns-initialize-window-system () "Initialize Emacs for Nextstep (Cocoa / GNUstep) windowing." + (cl-assert (not ns-initialized)) ;; PENDING: not needed? (setq command-line-args (x-handle-args command-line-args)) @@ -936,6 +937,7 @@ (x-apply-session-resources) (setq ns-initialized t)) +(add-to-list 'display-format-alist '("\\`ns\\'" . ns)) (add-to-list 'handle-args-function-alist '(ns . x-handle-args)) (add-to-list 'frame-creation-function-alist '(ns . x-create-frame-with-faces)) (add-to-list 'window-system-initialization-alist '(ns . ns-initialize-window-system)) === modified file 'lisp/term/w32-win.el' --- lisp/term/w32-win.el 2012-04-27 05:40:46 +0000 +++ lisp/term/w32-win.el 2012-09-17 11:55:05 +0000 @@ -1,4 +1,4 @@ -;;; w32-win.el --- parse switches controlling interface with W32 window system +;;; w32-win.el --- parse switches controlling interface with W32 window system -*- lexical-binding: t -*- ;; Copyright (C) 1993-1994, 2001-2012 Free Software Foundation, Inc. @@ -68,6 +68,7 @@ ;; (if (not (eq window-system 'w32)) ;; (error "%s: Loading w32-win.el but not compiled for w32" (invocation-name))) +(eval-when-compile (require 'cl-lib)) (require 'frame) (require 'mouse) (require 'scroll-bar) @@ -102,7 +103,22 @@ ;; (interactive "e") ;; (princ event)) -(defun w32-drag-n-drop (event) +(defun w32-handle-dropped-file (window file-name) + (let ((f (if (eq system-type 'cygwin) + (cygwin-convert-path-from-windows file-name t) + (subst-char-in-string ?\\ ?/ file-name))) + (coding (or file-name-coding-system + default-file-name-coding-system))) + + (setq file-name + (mapconcat 'url-hexify-string + (split-string (encode-coding-string f coding) + "/") + "/"))) + (dnd-handle-one-url window 'private + (concat "file:" file-name))) + +(defun w32-drag-n-drop (event &optional new-frame) "Edit the files listed in the drag-n-drop EVENT. Switch to a buffer editing the last file dropped." (interactive "e") @@ -116,26 +132,21 @@ (y (cdr coords))) (if (and (> x 0) (> y 0)) (set-frame-selected-window nil window)) - (mapc (lambda (file-name) - (let ((f (subst-char-in-string ?\\ ?/ file-name)) - (coding (or file-name-coding-system - default-file-name-coding-system))) - (setq file-name - (mapconcat 'url-hexify-string - (split-string (encode-coding-string f coding) - "/") - "/"))) - (dnd-handle-one-url window 'private - (concat "file:" file-name))) - (car (cdr (cdr event))))) - (raise-frame))) + + (when new-frame + (select-frame (make-frame))) + (raise-frame) + (setq window (selected-window)) + + (mapc (apply-partially #'w32-handle-dropped-file window) + (car (cdr (cdr event))))))) (defun w32-drag-n-drop-other-frame (event) "Edit the files listed in the drag-n-drop EVENT, in other frames. May create new frames, or reuse existing ones. The frame editing the last file dropped is selected." (interactive "e") - (mapcar 'find-file-other-frame (car (cdr (cdr event))))) + (w32-drag-n-drop event t)) ;; Bind the drag-n-drop event. (global-set-key [drag-n-drop] 'w32-drag-n-drop) @@ -230,6 +241,7 @@ (defun w32-initialize-window-system () "Initialize Emacs for W32 GUI frames." + (cl-assert (not w32-initialized)) ;; Do the actual Windows setup here; the above code just defines ;; functions and variables that we use now. @@ -243,7 +255,7 @@ ;; so as not to choke when we use it in X resource queries. (replace-regexp-in-string "[.*]" "-" (invocation-name)))) - (x-open-connection "" x-command-line-resources + (x-open-connection "w32" x-command-line-resources ;; Exit with a fatal error if this fails and we ;; are the initial display (eq initial-window-system 'w32)) @@ -294,7 +306,7 @@ (setq default-frame-alist (cons '(reverse . t) default-frame-alist))))) - ;; Don't let Emacs suspend under w32 gui + ;; Don't let Emacs suspend under Windows. (add-hook 'suspend-hook 'x-win-suspend-error) ;; Turn off window-splitting optimization; w32 is usually fast enough @@ -312,6 +324,7 @@ (x-apply-session-resources) (setq w32-initialized t)) +(add-to-list 'display-format-alist '("\\`w32\\'" . w32)) (add-to-list 'handle-args-function-alist '(w32 . x-handle-args)) (add-to-list 'frame-creation-function-alist '(w32 . x-create-frame-with-faces)) (add-to-list 'window-system-initialization-alist '(w32 . w32-initialize-window-system)) === modified file 'lisp/term/x-win.el' --- lisp/term/x-win.el 2012-08-10 14:47:12 +0000 +++ lisp/term/x-win.el 2012-09-17 11:55:05 +0000 @@ -67,6 +67,8 @@ ;; An alist of X options and the function which handles them. See ;; ../startup.el. +(eval-when-compile (require 'cl-lib)) + (if (not (fboundp 'x-create-frame)) (error "%s: Loading x-win.el but not compiled for X" (invocation-name))) @@ -1338,6 +1340,8 @@ (defun x-initialize-window-system () "Initialize Emacs for X frames and open the first connection to an X server." + (cl-assert (not x-initialized)) + ;; Make sure we have a valid resource name. (or (stringp x-resource-name) (let (i) @@ -1451,6 +1455,7 @@ (x-apply-session-resources) (setq x-initialized t)) +(add-to-list 'display-format-alist '("\\`[^:]*:[0-9]+\\(\\.[0-9]+\\)?\\'" . x)) (add-to-list 'handle-args-function-alist '(x . x-handle-args)) (add-to-list 'frame-creation-function-alist '(x . x-create-frame-with-faces)) (add-to-list 'window-system-initialization-alist '(x . x-initialize-window-system)) === added file 'lisp/w32-common-fns.el' --- lisp/w32-common-fns.el 1970-01-01 00:00:00 +0000 +++ lisp/w32-common-fns.el 2012-09-17 11:57:03 +0000 @@ -0,0 +1,130 @@ +;;; w32-common-fns.el --- Lisp routines for Windows and Cygwin-w32 + +;; Copyright (C) 1994, 2001-2012 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: +;;; +;;; This file contains functions that are used by both native NT Emacs +;;; and Cygwin Emacs compiled to use the native Windows widget +;;; library. + +(defun w32-version () + "Return the MS-Windows version numbers. +The value is a list of three integers: the major and minor version +numbers, and the build number." + (x-server-version)) + +(defun w32-using-nt () + "Return non-nil if running on a Windows NT descendant. +That includes all Windows systems except for 9X/Me." + (getenv "SystemRoot")) + +(declare-function w32-get-clipboard-data "w32select.c") +(declare-function w32-set-clipboard-data "w32select.c") +(declare-function x-server-version "w32fns.c" (&optional display)) + +;;; Fix interface to (X-specific) mouse.el +(defun x-set-selection (type data) + "Make an X selection of type TYPE and value DATA. +The argument TYPE (nil means `PRIMARY') says which selection, and +DATA specifies the contents. TYPE must be a symbol. \(It can also +be a string, which stands for the symbol with that name, but this +is considered obsolete.) DATA may be a string, a symbol, an +integer (or a cons of two integers or list of two integers). + +The selection may also be a cons of two markers pointing to the same buffer, +or an overlay. In these cases, the selection is considered to be the text +between the markers *at whatever time the selection is examined*. +Thus, editing done in the buffer after you specify the selection +can alter the effective value of the selection. + +The data may also be a vector of valid non-vector selection values. + +The return value is DATA. + +Interactively, this command sets the primary selection. Without +prefix argument, it reads the selection in the minibuffer. With +prefix argument, it uses the text of the region as the selection value. + +Note that on MS-Windows, primary and secondary selections set by Emacs +are not available to other programs." + (put 'x-selections (or type 'PRIMARY) data)) + +(defun x-get-selection (&optional type _data-type) + "Return the value of an X Windows selection. +The argument TYPE (default `PRIMARY') says which selection, +and the argument DATA-TYPE (default `STRING') says +how to convert the data. + +TYPE may be any symbol \(but nil stands for `PRIMARY'). However, +only a few symbols are commonly used. They conventionally have +all upper-case names. The most often used ones, in addition to +`PRIMARY', are `SECONDARY' and `CLIPBOARD'. + +DATA-TYPE is usually `STRING', but can also be one of the symbols +in `selection-converter-alist', which see." + (get 'x-selections (or type 'PRIMARY))) + +;; x-selection-owner-p is used in simple.el +(defun x-selection-owner-p (&optional type) + (and (memq type '(nil PRIMARY SECONDARY)) + (get 'x-selections (or type 'PRIMARY)))) + +;; The "Windows" keys on newer keyboards bring up the Start menu +;; whether you want it or not - make Emacs ignore these keystrokes +;; rather than beep. +(global-set-key [lwindow] 'ignore) +(global-set-key [rwindow] 'ignore) + +(defvar w32-charset-info-alist) ; w32font.c + + +;;;; Selections + +;; We keep track of the last text selected here, so we can check the +;; current selection against it, and avoid passing back our own text +;; from x-selection-value. +(defvar x-last-selected-text nil) + +(defun x-get-selection-value () + "Return the value of the current selection. +Consult the selection. Treat empty strings as if they were unset." + (if x-select-enable-clipboard + (let (text) + ;; Don't die if x-get-selection signals an error. + (condition-case c + (setq text (w32-get-clipboard-data)) + (error (message "w32-get-clipboard-data:%s" c))) + (if (string= text "") (setq text nil)) + (cond + ((not text) nil) + ((eq text x-last-selected-text) nil) + ((string= text x-last-selected-text) + ;; Record the newer string, so subsequent calls can use the 'eq' test. + (setq x-last-selected-text text) + nil) + (t + (setq x-last-selected-text text)))))) + +(defalias 'x-selection-value 'x-get-selection-value) + +;; Arrange for the kill and yank functions to set and check the clipboard. +(setq interprogram-cut-function 'x-select-text) +(setq interprogram-paste-function 'x-get-selection-value) + +(provide 'w32-common-fns) === modified file 'lisp/w32-fns.el' --- lisp/w32-fns.el 2012-05-26 21:58:01 +0000 +++ lisp/w32-fns.el 2012-09-17 11:55:02 +0000 @@ -26,34 +26,20 @@ ;;; Code: (require 'w32-vars) +(require 'w32-common-fns) (defvar explicit-shell-file-name) ;;;; Function keys (declare-function set-message-beep "w32console.c") -(declare-function w32-get-clipboard-data "w32select.c") (declare-function w32-get-locale-info "w32proc.c") (declare-function w32-get-valid-locale-ids "w32proc.c") -(declare-function w32-set-clipboard-data "w32select.c") ;; Map all versions of a filename (8.3, longname, mixed case) to the ;; same buffer. (setq find-file-visit-truename t) -(declare-function x-server-version "w32fns.c" (&optional display)) - -(defun w32-version () - "Return the MS-Windows version numbers. -The value is a list of three integers: the major and minor version -numbers, and the build number." - (x-server-version)) - -(defun w32-using-nt () - "Return non-nil if running on a Windows NT descendant. -That includes all Windows systems except for 9X/Me." - (and (eq system-type 'windows-nt) (getenv "SystemRoot"))) - (defun w32-shell-name () "Return the name of the shell being used." (or (bound-and-true-p shell-file-name) @@ -240,53 +226,6 @@ (setq start (match-end 0)))) name))) -;;; Fix interface to (X-specific) mouse.el -(defun x-set-selection (type data) - "Make an X selection of type TYPE and value DATA. -The argument TYPE (nil means `PRIMARY') says which selection, and -DATA specifies the contents. TYPE must be a symbol. \(It can also -be a string, which stands for the symbol with that name, but this -is considered obsolete.) DATA may be a string, a symbol, an -integer (or a cons of two integers or list of two integers). - -The selection may also be a cons of two markers pointing to the same buffer, -or an overlay. In these cases, the selection is considered to be the text -between the markers *at whatever time the selection is examined*. -Thus, editing done in the buffer after you specify the selection -can alter the effective value of the selection. - -The data may also be a vector of valid non-vector selection values. - -The return value is DATA. - -Interactively, this command sets the primary selection. Without -prefix argument, it reads the selection in the minibuffer. With -prefix argument, it uses the text of the region as the selection value. - -Note that on MS-Windows, primary and secondary selections set by Emacs -are not available to other programs." - (put 'x-selections (or type 'PRIMARY) data)) - -(defun x-get-selection (&optional type _data-type) - "Return the value of an X Windows selection. -The argument TYPE (default `PRIMARY') says which selection, -and the argument DATA-TYPE (default `STRING') says -how to convert the data. - -TYPE may be any symbol \(but nil stands for `PRIMARY'). However, -only a few symbols are commonly used. They conventionally have -all upper-case names. The most often used ones, in addition to -`PRIMARY', are `SECONDARY' and `CLIPBOARD'. - -DATA-TYPE is usually `STRING', but can also be one of the symbols -in `selection-converter-alist', which see." - (get 'x-selections (or type 'PRIMARY))) - -;; x-selection-owner-p is used in simple.el -(defun x-selection-owner-p (&optional type) - (and (memq type '(nil PRIMARY SECONDARY)) - (get 'x-selections (or type 'PRIMARY)))) - (defun set-w32-system-coding-system (coding-system) "Set the coding system used by the Windows system to CODING-SYSTEM. This is used for things like passing font names with non-ASCII @@ -311,14 +250,6 @@ ;; Set to a system sound if you want a fancy bell. (set-message-beep nil) -;; The "Windows" keys on newer keyboards bring up the Start menu -;; whether you want it or not - make Emacs ignore these keystrokes -;; rather than beep. -(global-set-key [lwindow] 'ignore) -(global-set-key [rwindow] 'ignore) - -(defvar w32-charset-info-alist) ; w32font.c - (defun w32-add-charset-info (xlfd-charset windows-charset codepage) "Function to add character sets to display with Windows fonts. Creates entries in `w32-charset-info-alist'. @@ -380,40 +311,6 @@ 'w32-charset-info-alist "21.1") -;;;; Selections - -;; We keep track of the last text selected here, so we can check the -;; current selection against it, and avoid passing back our own text -;; from x-selection-value. -(defvar x-last-selected-text nil) - -(defun x-get-selection-value () - "Return the value of the current selection. -Consult the selection. Treat empty strings as if they were unset." - (if x-select-enable-clipboard - (let (text) - ;; Don't die if x-get-selection signals an error. - (condition-case c - (setq text (w32-get-clipboard-data)) - (error (message "w32-get-clipboard-data:%s" c))) - (if (string= text "") (setq text nil)) - (cond - ((not text) nil) - ((eq text x-last-selected-text) nil) - ((string= text x-last-selected-text) - ;; Record the newer string, so subsequent calls can use the 'eq' test. - (setq x-last-selected-text text) - nil) - (t - (setq x-last-selected-text text)))))) - -(defalias 'x-selection-value 'x-get-selection-value) - -;; Arrange for the kill and yank functions to set and check the clipboard. -(setq interprogram-cut-function 'x-select-text) -(setq interprogram-paste-function 'x-get-selection-value) - - ;;;; Support for build process ;; From autoload.el === modified file 'lisp/w32-vars.el' --- lisp/w32-vars.el 2012-01-19 07:21:25 +0000 +++ lisp/w32-vars.el 2012-09-17 11:55:02 +0000 @@ -44,17 +44,19 @@ "Include proportional fonts in the default font dialog.") (make-obsolete-variable 'w32-list-proportional-fonts "no longer used." "23.1") -(defcustom w32-allow-system-shell nil - "Disable startup warning when using \"system\" shells." - :type 'boolean - :group 'w32) +(unless (eq system-type 'cygwin) + (defcustom w32-allow-system-shell nil + "Disable startup warning when using \"system\" shells." + :type 'boolean + :group 'w32)) -(defcustom w32-system-shells '("cmd" "cmd.exe" "command" "command.com" - "4nt" "4nt.exe" "4dos" "4dos.exe" - "tcc" "tcc.exe" "ndos" "ndos.exe") - "List of strings recognized as Windows system shells." - :type '(repeat string) - :group 'w32) +(unless (eq system-type 'cygwin) + (defcustom w32-system-shells '("cmd" "cmd.exe" "command" "command.com" + "4nt" "4nt.exe" "4dos" "4dos.exe" + "tcc" "tcc.exe" "ndos" "ndos.exe") + "List of strings recognized as Windows system shells." + :type '(repeat string) + :group 'w32)) ;; Want "menu" custom type for this. (defcustom w32-fixed-font-alist === modified file 'src/ChangeLog' --- src/ChangeLog 2012-10-07 18:33:10 +0000 +++ src/ChangeLog 2012-10-08 07:58:40 +0000 @@ -1,3 +1,141 @@ +2012-10-08 Daniel Colascione + + * xfaces.c, xdisp.c, window.c, w32xfns.c, w32term.h, w32term.c, + w32select.h w32select.c, w32proc.c, w32menu.c, w32inevt.c, + w32help.c, w32font.c, w32font.c, w32fns.c, w32console.c, w32.h, + w32.c, unexw32.c, termhooks.h, process.c, menu.c, keyboard.h, + keyboard.c, image.c, frame.h, frame.c, fontset.c, font.h, font.c, + emacs.c, dispextern.h, cygw32.h, cygw32.c, conf_post.h, + Makefile.in: use HAVE_NTGUI for W32 GUI and WINDOWSNT for the + operating system. defined(HAVE_NTGUI) && !defined(WINDOWSNT) is + now a supported configuration. + + * Makefile.in: consolidate image variables into LIBIMAGE; add + W32_OBJ and W32_LIBS. Compile new files. + + * conf_post.h: + (_DebPrint) declare tracing facility for W32 debugging. We need + to unify tracing later. + + (NTGUI_UNICODE) Define when compiling for Cygwin to allow the + unconditional use of W32 Unicode functions. Cygwin runs only on + 100% Unicode operating systems. + + * cygw32.c: New file. Define Cygwin-specific facilities. + (Fcygwin_convert_path_to_windows) + (Fcygwin_convert_path_from_windows): New user functions for + accessing Cygwin path-munging routines. + + * cygw32.h: New file. + (WCSDATA, to_unicode, from_unicode): Define facilities for storing + UTF-16LE strings temporarily inside non-Lisp-visible string + objects. + + (w32_strerror): Just what it says on the tin. + + * emacs.c: Make the NS fork-then-exec code for daemon-launching + also run for Cygwin; both systems have the same problem with using + GUI facilities in a forked child. Also call syms_of_cygw32, + syms_of_w32select in correct places. + + (DAEMON_MUST_EXEC): new macro defined to signal that a platform + needs fork-then-exec for daemon launching. + + * font.h: Include frame.h. + + * image.c: Use the image library cache machinery only when we're + compiling for native WINDOWSNT; Cygwin can use shared libraries + like any other Unixlike system. + + * keyboard.c: Clarify a comment regarding the input loop. + + * menu.c: When NTGUI_UNICODE is defined, use Unicode menu + functions directly instead of trying to detect at runtime that our + host operating system supports them. We make this change for two + reasons: Cygwin lacks support for the multibyte character + conversion functions used by the legacy menu code, and Cygwin + never needs to rely on non-Unicode APIs. + + * unexw32.c (hinst): Declare extern. + + * w32.c: Change header order; + (w32_strerror): Move to w32fns.c because we need it for + non-WINDOWSNT builds. + + * w32.h: Add #error macro to make sure we don't include w32.h for + Cygwin builds. Remove w32select declarations. + + * w32console.c (w32_sys_ring_bell, Fset_message_beep): Move to + w32fns.c. w32console.c is WINDOWSNT-only. + + * w32fns.c: Include cygw32.h or w32.h depending on CYGWIN; more + NTGUI_UNICODE tweaks. (See above.) Change _snprintf to the more + POSIXy alternative. + (faked_key, sysinfo_cache, osinfo_cahce, syspage_mask) + (w32_major_version, w32_minor_version, w32_build_number) + (os_subtype, sound_type): Define here + (w32_defined_color): Make color parameter const for consistency + with other _defined_color functions. + (w32_createwindow): Unconditionally call w32_init_class instead of + doing so only when hprevinst is non-NULL. Plumbing hprevinst + through the code is complex and unnecessary because class + registration is practically free. + (w32_name_of_message): New EMACSDEBUG-only function. + (Fset_message_beep): Move here + (Fx_open_connection): Require that the display name for Windows be + "w32" for consistency, emacsclient disambiguation, and maybe, one + day, multi-window-system support. + (file_dialog_callback): NTGUI_UNICODE changes; encode and decode + Cygwin files for W32 GUI facilities, since these clearly don't + expect Cygwin names. + (_DebPrint): Define. + (w32_strerror, w32_console_toggle_lock_key, w32_kbd_mods_to_emacs) + (w32_kbd_patch_key, w32_sys_ring_bell): Move here. + (Ssystem_move_file_to_trash): Define only for native WINDOWSNT. + (w32_last_error): Remove. + + * w32font.c: Define _strlwr to strlwr for non-WINDOWSNT builds. + + * w32heap.c (syspage_mask): Declare here. + (cache_system_info): Remove. + + * w32inevt.c (faked_key): Define globally, not statically. + (w32_kbd_mods_to_emacs, w32_kbd_patch_key, faked_key) + (w32_console_toggle_lock_key): Move to w32fns.c. + + * w32menu.c: Include setjmp.h. NTGUI_UNICODE changes throughout. + + * w32proc.c (_DebPrint): Move to w32fns.c. + * w32select.c: Include string.h, stdio.h for Cygwin. + * w32select.h: New File. + + * w32term.c: Include io.h for non-CYGWIN builds; needed for + get_osfhandle. + (w32_message_fd): New variable. Under Cygwin, holds the file + descriptor the system used to tell us about pending thread + messages. + + (w32_init_term): Remove incorrect calls to fcntl and init_sigio + that prevented compilation under non-WINDOWSNT systems. + + (w32_initialize): Open /dev/windows and assign it to + w32_message_fd. Provide w32 feature. + + * w32term.h: Include frame.h, atimer.h. Declare various frame functions. + (WM_EMACS_INPUT_READY): add. + (prepend_msg, w32_message_fd): Declare globally. + + * w32xfns.c: + (keyboard_handle): Use only when WINDOWSNT. + (notify_msg_ready): New function. Posts a message to the main + thread's message queue under CYGWIN, which wakes up the main + thread from select(2) by making the /dev/windows file descriptor + ready. Under WINDOWSNT, it sets an event the same way the old + code did. + + (post, prepend_msg): Actually call notify_msg_ready instead of + setting the input event directly. + 2012-10-07 Eli Zaretskii * ralloc.c (relinquish): If a heap is ready to be relinquished, === modified file 'src/Makefile.in' --- src/Makefile.in 2012-09-27 23:02:23 +0000 +++ src/Makefile.in 2012-10-07 22:31:58 +0000 @@ -135,13 +135,10 @@ ## -lpthreads, or empty. LIB_PTHREAD=@LIB_PTHREAD@ -LIBTIFF=@LIBTIFF@ -LIBJPEG=@LIBJPEG@ -LIBPNG=@LIBPNG@ -LIBGIF=@LIBGIF@ -LIBXPM=@LIBXPM@ +LIBIMAGE=@LIBTIFF@ @LIBJPEG@ @LIBPNG@ @LIBGIF@ @LIBXPM@ + XFT_LIBS=@XFT_LIBS@ -LIBX_EXTRA=$(LIBTIFF) $(LIBJPEG) $(LIBPNG) $(LIBGIF) $(LIBXPM) -lX11 $(XFT_LIBS) +LIBX_EXTRA=-lX11 $(XFT_LIBS) FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@ FONTCONFIG_LIBS = @FONTCONFIG_LIBS@ @@ -261,6 +258,13 @@ NS_OBJC_OBJ=@NS_OBJC_OBJ@ ## Only set if NS_IMPL_GNUSTEP. GNU_OBJC_CFLAGS=@GNU_OBJC_CFLAGS@ +## w32fns.o w32menu.c w32reg.o fringe.o fontset.o w32font.o w32term.o +## w32xfns.o w32select.o image.o w32uniscribe.o if HAVE_W32, else +## empty. +W32_OBJ=@W32_OBJ@ +## -lkernel32 -luser32 -lgdi32 -lole32 -lcomdlg32 lusp10 -lcomctl32 +## --lwinspool if HAVE_W32, else empty. +W32_LIBS=@W32_LIBS@ ## Empty if !HAVE_X_WINDOWS ## xfont.o ftfont.o xftfont.o ftxfont.o if HAVE_XFT @@ -342,7 +346,7 @@ doprnt.o intervals.o textprop.o composite.o xml.o \ profiler.o \ $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) \ - $(WINDOW_SYSTEM_OBJ) + $(W32_OBJ) $(WINDOW_SYSTEM_OBJ) obj = $(base_obj) $(NS_OBJC_OBJ) ## Object files used on some machine or other. @@ -351,9 +355,9 @@ ## in the list, in case they ever add any such entries. SOME_MACHINE_OBJECTS = dosfns.o msdos.o \ xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \ - fontset.o dbusbind.o \ + fontset.o dbusbind.o cygw32.o \ nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o \ - w32.o w32console.o w32fns.o w32heap.o w32inevt.o \ + w32.o w32console.o w32fns.o w32heap.o \ w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o \ w16select.o widget.o xfont.o ftfont.o xftfont.o ftxfont.o gtkutil.o \ xsettings.o xgselect.o termcap.o @@ -385,9 +389,11 @@ ## Note that SunOS needs -lm to come before -lc; otherwise, you get ## duplicated symbols. If the standard libraries were compiled ## with GCC, we might need LIB_GCC again after them. -LIBES = $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \ - $(RSVG_LIBS) $(IMAGEMAGICK_LIBS) $(LIB_CLOCK_GETTIME) $(LIB_TIMER_TIME) \ - $(DBUS_LIBS) $(LIB_EXECINFO) \ +LIBES = $(LIBS) $(W32_LIBS) $(LIBX_BASE) $(LIBIMAGE) \ + $(LIBX_OTHER) $(LIBSOUND) \ + $(RSVG_LIBS) $(IMAGEMAGICK_LIBS) $(LIB_CLOCK_GETTIME) \ + $(LIB_TIMER_TIME) $(DBUS_LIBS) \ + $(LIB_EXECINFO) \ $(LIBXML2_LIBS) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \ $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(SETTINGS_LIBS) $(LIBSELINUX_LIBS) \ $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \ === modified file 'src/conf_post.h' --- src/conf_post.h 2012-09-16 21:43:55 +0000 +++ src/conf_post.h 2012-09-17 12:07:36 +0000 @@ -142,6 +142,20 @@ #endif #endif +#if defined(HAVE_NTGUI) && !defined(DebPrint) +# if defined(EMACSDEBUG) +extern void _DebPrint (const char *fmt, ...); +# define DebPrint(stuff) _DebPrint stuff +# else +# define DebPrint(stuff) +# endif /* EMACSDEBUG */ +#endif /* DebPrint */ + +#if defined(CYGWIN) && defined(HAVE_NTGUI) +#define NTGUI_UNICODE /* Cygwin runs only on UNICODE-supporting systems */ +#define _WIN32_WINNT 0x500 /* Win2k */ +#endif /* CYGWIN && HAVE_NTGUI */ + #ifdef emacs /* Don't do this for lib-src. */ /* Tell regex.c to use a type compatible with Emacs. */ #define RE_TRANSLATE_TYPE Lisp_Object === added file 'src/cygw32.c' --- src/cygw32.c 1970-01-01 00:00:00 +0000 +++ src/cygw32.c 2012-09-17 11:57:03 +0000 @@ -0,0 +1,169 @@ +/* Cygwin support routines. + Copyright (C) 2011 Free Software Foundation, Inc. + +This file is part of GNU Emacs. + +GNU Emacs is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +GNU Emacs is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Emacs. If not, see . */ + + +#include "cygw32.h" +#include "character.h" +#include "buffer.h" +#include +#include +static Lisp_Object Qutf_16_le; + +static Lisp_Object +fchdir_unwind (Lisp_Object dir_fd) +{ + (void) fchdir (XFASTINT (dir_fd)); + (void) close (XFASTINT (dir_fd)); + return Qnil; +} + +static void +chdir_to_default_directory () +{ + Lisp_Object new_cwd; + int old_cwd_fd = open (".", O_RDONLY | O_DIRECTORY); + + if (old_cwd_fd == -1) + error ("could not open current directory: %s", strerror (errno)); + + record_unwind_protect (fchdir_unwind, make_number (old_cwd_fd)); + + new_cwd = Funhandled_file_name_directory ( + Fexpand_file_name (build_string ("."), Qnil)); + if (!STRINGP (new_cwd)) + new_cwd = build_string ("/"); + + if (chdir (SDATA (ENCODE_FILE (new_cwd)))) + error ("could not chdir: %s", strerror (errno)); +} + +static Lisp_Object +conv_filename_to_w32_unicode (Lisp_Object in, int absolute_p) +{ + ssize_t converted_len; + Lisp_Object converted; + unsigned flags; + int count = SPECPDL_INDEX (); + + chdir_to_default_directory (); + + flags = CCP_POSIX_TO_WIN_W; + if (!absolute_p) { + flags |= CCP_RELATIVE; + } + + in = ENCODE_FILE (in); + + converted_len = cygwin_conv_path (flags, SDATA (in), NULL, 0); + if (converted_len < 2) + error ("cygwin_conv_path: %s", strerror (errno)); + + converted = make_uninit_string (converted_len - 1); + if (cygwin_conv_path (flags, SDATA (in), + SDATA (converted), converted_len)) + error ("cygwin_conv_path: %s", strerror (errno)); + + return unbind_to (count, converted); +} + +static Lisp_Object +conv_filename_from_w32_unicode (const wchar_t* in, int absolute_p) +{ + ssize_t converted_len; + Lisp_Object converted; + unsigned flags; + int count = SPECPDL_INDEX (); + + chdir_to_default_directory (); + + flags = CCP_WIN_W_TO_POSIX; + if (!absolute_p) { + flags |= CCP_RELATIVE; + } + + converted_len = cygwin_conv_path (flags, in, NULL, 0); + if (converted_len < 1) + error ("cygwin_conv_path: %s", strerror (errno)); + + converted = make_uninit_string (converted_len - 1 /*subtract terminator*/); + if (cygwin_conv_path (flags, in, SDATA (converted), converted_len)) + error ("cygwin_conv_path: %s", strerror (errno)); + + return unbind_to (count, DECODE_FILE (converted)); +} + +Lisp_Object +from_unicode (Lisp_Object str) +{ + CHECK_STRING (str); + if (!STRING_MULTIBYTE (str) && + SBYTES (str) & 1) + { + str = Fsubstring (str, make_number (0), make_number (-1)); + } + + return code_convert_string_norecord (str, Qutf_16_le, 0); +} + +wchar_t * +to_unicode (Lisp_Object str, Lisp_Object *buf) +{ + *buf = code_convert_string_norecord (str, Qutf_16_le, 1); + /* We need to make a another copy (in addition to the one made by + code_convert_string_norecord) to ensure that the final string is + _doubly_ zero terminated --- that is, that the string is + terminated by two zero bytes and one utf-16le null character. + Because strings are already terminated with a single zero byte, + we just add one additional zero. */ + str = make_uninit_string (SBYTES (*buf) + 1); + memcpy (SDATA (str), SDATA (*buf), SBYTES (*buf)); + SDATA (str) [SBYTES (*buf)] = '\0'; + *buf = str; + return WCSDATA (*buf); +} + +DEFUN ("cygwin-convert-path-to-windows", + Fcygwin_convert_path_to_windows, Scygwin_convert_path_to_windows, + 1, 2, 0, + doc: /* Convert PATH to a Windows path. If ABSOLUTE-P if + non-nil, return an absolute path.*/) + (Lisp_Object path, Lisp_Object absolute_p) +{ + return from_unicode ( + conv_filename_to_w32_unicode (path, absolute_p == Qnil ? 0 : 1)); +} + +DEFUN ("cygwin-convert-path-from-windows", + Fcygwin_convert_path_from_windows, Scygwin_convert_path_from_windows, + 1, 2, 0, + doc: /* Convert a Windows path to a Cygwin path. If ABSOLUTE-P + if non-nil, return an absolute path.*/) + (Lisp_Object path, Lisp_Object absolute_p) +{ + return conv_filename_from_w32_unicode (to_unicode (path, &path), + absolute_p == Qnil ? 0 : 1); +} + +void +syms_of_cygw32 (void) +{ + /* No, not utf-16-le: that one has a BOM. */ + DEFSYM (Qutf_16_le, "utf-16le"); + defsubr (&Scygwin_convert_path_from_windows); + defsubr (&Scygwin_convert_path_to_windows); +} === added file 'src/cygw32.h' --- src/cygw32.h 1970-01-01 00:00:00 +0000 +++ src/cygw32.h 2012-09-17 11:57:03 +0000 @@ -0,0 +1,59 @@ +/* Header for Cygwin support routines. + Copyright (C) 2011 Free Software Foundation, Inc. + +This file is part of GNU Emacs. + +GNU Emacs is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +GNU Emacs is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Emacs. If not, see . */ + +#ifndef CYGW32_H +#define CYGW32_H +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "lisp.h" +#include "coding.h" + +/* *** Character conversion *** */ + +/* Access the wide-character string stored in a Lisp string object. */ +#define WCSDATA(x) ((wchar_t *) SDATA (x)) + +/* Convert the Emacs string in STR to UTF-16LE and store a new string + containing the encoded version of STR into *BUF. BUF may safely + point to STR on entry. */ +extern wchar_t *to_unicode (Lisp_Object str, Lisp_Object *buf); + +/* Convert STR, a UTF-16LE encoded string embedded in an Emacs string + object, to a normal Emacs string and return it. */ +extern Lisp_Object from_unicode (Lisp_Object str); + +/* *** Path conversion. *** */ + +EXFUN (Fcygwin_convert_path_to_windows, 2); +EXFUN (Fcygwin_convert_path_from_windows, 2); + +/* *** Misc *** */ +extern void syms_of_cygw32 (void); +extern char * w32_strerror (int error_no); + +#endif /* CYGW32_H */ === modified file 'src/dispextern.h' --- src/dispextern.h 2012-09-30 21:36:42 +0000 +++ src/dispextern.h 2012-10-07 22:31:58 +0000 @@ -3144,7 +3144,7 @@ int update_window_fringes (struct window *, int); void compute_fringe_widths (struct frame *, int); -#ifdef WINDOWSNT +#ifdef HAVE_NTGUI void w32_init_fringe (struct redisplay_interface *); void w32_reset_fringes (void); #endif @@ -3247,7 +3247,7 @@ #ifdef HAVE_X_WINDOWS void gamma_correct (struct frame *, XColor *); #endif -#ifdef WINDOWSNT +#ifdef HAVE_NTGUI void gamma_correct (struct frame *, COLORREF *); #endif === modified file 'src/emacs.c' --- src/emacs.c 2012-10-01 22:12:44 +0000 +++ src/emacs.c 2012-10-07 22:31:58 +0000 @@ -33,9 +33,20 @@ #ifdef WINDOWSNT #include -#include /* just for w32.h */ #include "w32.h" -#include "w32heap.h" /* for prototype of sbrk */ +#endif + +#if defined (WINDOWSNT) +#include "w32heap.h" +#endif + +#if defined (WINDOWSNT) || defined (HAVE_NTGUI) +#include "w32select.h" +#include "w32font.h" +#endif + +#if defined (HAVE_NTGUI) && defined (CYGWIN) +#include "cygw32.h" #endif #ifdef HAVE_WINDOW_SYSTEM @@ -156,6 +167,22 @@ static uprintmax_t heap_bss_diff; #endif +/* To run as a daemon under Cocoa or Windows, we must do a fork+exec, + not a simple fork. + + On Cocoa, CoreFoundation lib fails in forked process: + http://developer.apple.com/ReleaseNotes/ + CoreFoundation/CoreFoundation.html) + + On Windows, a Cygwin fork child cannot access the USER subsystem. + + We mark being in the exec'd process by a daemon name argument of + form "--daemon=\nFD0,FD1\nNAME" where FD are the pipe file descriptors, + NAME is the original daemon name, if any. */ +#if defined (NS_IMPL_COCOA) || defined (HAVE_NTGUI) +# define DAEMON_MUST_EXEC +#endif + /* True means running Emacs without interactive terminal. */ bool noninteractive; @@ -669,9 +696,9 @@ bool no_loadup = 0; char *junk = 0; char *dname_arg = 0; -#ifdef NS_IMPL_COCOA +#ifdef DAEMON_MUST_EXEC char dname_arg2[80]; -#endif +#endif /* DAEMON_MUST_EXEC */ char *ch_to_dir; #if GC_MARK_STACK @@ -964,25 +991,19 @@ exit (1); } -#ifndef NS_IMPL_COCOA +#ifndef DAEMON_MUST_EXEC #ifdef USE_GTK fprintf (stderr, "\nWarning: due to a long standing Gtk+ bug\nhttp://bugzilla.gnome.org/show_bug.cgi?id=85715\n\ Emacs might crash when run in daemon mode and the X11 connection is unexpectedly lost.\n\ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem.\n"); -#endif +#endif /* USE_GTK */ f = fork (); -#else /* NS_IMPL_COCOA */ - /* Under Cocoa we must do fork+exec as CoreFoundation lib fails in - forked process: http://developer.apple.com/ReleaseNotes/ - CoreFoundation/CoreFoundation.html) - We mark being in the exec'd process by a daemon name argument of - form "--daemon=\nFD0,FD1\nNAME" where FD are the pipe file descriptors, - NAME is the original daemon name, if any. */ +#else /* DAEMON_MUST_EXEC */ if (!dname_arg || !strchr (dname_arg, '\n')) f = fork (); /* in orig */ else f = 0; /* in exec'd */ -#endif /* NS_IMPL_COCOA */ +#endif /* !DAEMON_MUST_EXEC */ if (f > 0) { int retval; @@ -1018,7 +1039,7 @@ exit (1); } -#ifdef NS_IMPL_COCOA +#ifdef DAEMON_MUST_EXEC { /* In orig process, forked as child, OR in exec'd. */ if (!dname_arg || !strchr (dname_arg, '\n')) @@ -1054,7 +1075,7 @@ dname_arg2); dname_arg = *dname_arg2 ? dname_arg2 : NULL; } -#endif /* NS_IMPL_COCOA */ +#endif /* DAEMON_MUST_EXEC */ if (dname_arg) daemon_name = xstrdup (dname_arg); @@ -1357,6 +1378,9 @@ #ifdef WINDOWSNT syms_of_ntproc (); #endif /* WINDOWSNT */ +#if defined (CYGWIN) && defined (HAVE_NTGUI) + syms_of_cygw32 (); +#endif /* defined(CYGWIN) && defined (HAVE_NTGUI) */ syms_of_window (); syms_of_xdisp (); syms_of_font (); @@ -1387,11 +1411,14 @@ #ifdef HAVE_NTGUI syms_of_w32term (); syms_of_w32fns (); - syms_of_w32select (); syms_of_w32menu (); syms_of_fontset (); #endif /* HAVE_NTGUI */ +#ifdef HAVE_W32SELECT + syms_of_w32select (); +#endif /* HAVE_W32SELECT */ + #ifdef MSDOS syms_of_xmenu (); syms_of_dosfns (); @@ -1436,8 +1463,11 @@ globals_of_w32font (); globals_of_w32fns (); globals_of_w32menu (); +#endif /* HAVE_NTGUI */ + +#ifdef HAVE_W32SELECT globals_of_w32select (); -#endif /* HAVE_NTGUI */ +#endif /* HAVE_W32SELECT */ } init_charset (); === modified file 'src/font.c' --- src/font.c 2012-09-16 21:18:00 +0000 +++ src/font.c 2012-09-17 12:07:36 +0000 @@ -5208,9 +5208,9 @@ #ifdef HAVE_BDFFONT syms_of_bdffont (); #endif /* HAVE_BDFFONT */ -#ifdef WINDOWSNT +#ifdef HAVE_NTGUI syms_of_w32font (); -#endif /* WINDOWSNT */ +#endif /* HAVE_NTGUI */ #ifdef HAVE_NS syms_of_nsfont (); #endif /* HAVE_NS */ === modified file 'src/font.h' --- src/font.h 2012-09-06 08:04:49 +0000 +++ src/font.h 2012-10-07 22:31:58 +0000 @@ -23,6 +23,7 @@ #define EMACS_FONT_H #include "ccl.h" +#include "frame.h" /* We have three types of Lisp objects related to font. @@ -818,11 +819,11 @@ extern void syms_of_bdffont (void); #endif /* HAVE_BDFFONT */ #endif /* HAVE_X_WINDOWS */ -#ifdef WINDOWSNT +#ifdef HAVE_NTGUI extern struct font_driver w32font_driver; extern struct font_driver uniscribe_font_driver; extern void syms_of_w32font (void); -#endif /* WINDOWSNT */ +#endif /* HAVE_NTGUI */ #ifdef HAVE_NS extern Lisp_Object Qfontsize; extern struct font_driver nsfont_driver; === modified file 'src/fontset.c' --- src/fontset.c 2012-09-23 08:44:20 +0000 +++ src/fontset.c 2012-10-07 22:31:58 +0000 @@ -42,7 +42,7 @@ #ifdef HAVE_X_WINDOWS #include "xterm.h" #endif -#ifdef WINDOWSNT +#ifdef HAVE_NTGUI #include "w32term.h" #endif #ifdef HAVE_NS === modified file 'src/frame.c' --- src/frame.c 2012-10-02 00:31:56 +0000 +++ src/frame.c 2012-10-07 22:31:58 +0000 @@ -2697,7 +2697,7 @@ {"tool-bar-position", &Qtool_bar_position}, }; -#ifdef WINDOWSNT +#ifdef HAVE_NTGUI /* Calculate fullscreen size. Return in *TOP_POS and *LEFT_POS the wanted positions of the WM window (not Emacs window). @@ -2741,7 +2741,7 @@ *height = newheight; } -#endif /* WINDOWSNT */ +#endif /* HAVE_NTGUI */ #ifdef HAVE_WINDOW_SYSTEM === modified file 'src/frame.h' --- src/frame.h 2012-09-23 19:36:31 +0000 +++ src/frame.h 2012-10-07 22:31:58 +0000 @@ -618,7 +618,7 @@ #define FRAME_INITIAL_P(f) ((f)->output_method == output_initial) #define FRAME_TERMCAP_P(f) ((f)->output_method == output_termcap) #define FRAME_X_P(f) ((f)->output_method == output_x_window) -#ifndef WINDOWSNT +#ifndef HAVE_NTGUI #define FRAME_W32_P(f) (0) #else #define FRAME_W32_P(f) ((f)->output_method == output_w32) @@ -1210,7 +1210,7 @@ extern Lisp_Object Qface_set_after_frame_default; -#ifdef WINDOWSNT +#ifdef HAVE_NTGUI extern void x_fullscreen_adjust (struct frame *f, int *, int *, int *, int *); #endif @@ -1282,6 +1282,7 @@ #endif extern void x_query_colors (struct frame *f, XColor *, int); +extern void x_query_color (struct frame *f, XColor *); #endif /* HAVE_WINDOW_SYSTEM */ === modified file 'src/image.c' --- src/image.c 2012-09-30 21:36:42 +0000 +++ src/image.c 2012-10-07 22:31:58 +0000 @@ -75,7 +75,11 @@ #endif /* HAVE_X_WINDOWS */ #ifdef HAVE_NTGUI -#include "w32.h" +# ifdef WINDOWSNT +/* We only need (or want) w32.h when we're _not_ + * compiling for Cygwin */ +# include "w32.h" +# endif /* WINDOWSNT */ /* W32_TODO : Color tables on W32. */ #undef COLOR_TABLE_SUPPORT @@ -560,13 +564,14 @@ static void x_laplace (struct frame *, struct image *); static void x_emboss (struct frame *, struct image *); static void x_build_heuristic_mask (struct frame *, struct image *, - Lisp_Object); -#ifdef HAVE_NTGUI + Lisp_Object); +#ifdef WINDOWSNT +extern Lisp_Object Vlibrary_cache; #define CACHE_IMAGE_TYPE(type, status) \ do { Vlibrary_cache = Fcons (Fcons (type, status), Vlibrary_cache); } while (0) #else #define CACHE_IMAGE_TYPE(type, status) -#endif +#endif /* WINDOWSNT */ #define ADD_IMAGE_TYPE(type) \ do { Vimage_types = Fcons (type, Vimage_types); } while (0) @@ -589,7 +594,7 @@ if (type->init) { -#ifdef HAVE_NTGUI +#if defined (HAVE_NTGUI) && defined (WINDOWSNT) /* If we failed to load the library before, don't try again. */ Lisp_Object tested = Fassq (target_type, Vlibrary_cache); if (CONSP (tested) && NILP (XCDR (tested))) @@ -1834,7 +1839,7 @@ X / NS / W32 support code ***********************************************************************/ -#ifdef HAVE_NTGUI +#ifdef WINDOWSNT /* Macro for defining functions that will be loaded from image DLLs. */ #define DEF_IMGLIB_FN(rettype,func,args) static rettype (FAR CDECL *fn_##func)args @@ -1845,7 +1850,7 @@ if (!fn_##func) return 0; \ } -#endif /* HAVE_NTGUI */ +#endif /* WINDOWSNT */ /* Return true if XIMG's size WIDTH x HEIGHT doesn't break the windowing system. @@ -2897,7 +2902,7 @@ else bits = (char *) XBOOL_VECTOR (data)->data; -#ifdef WINDOWSNT +#ifdef HAVE_NTGUI { char *invertedBits; int nbytes, i; @@ -3008,7 +3013,7 @@ {":background", IMAGE_STRING_OR_NIL_VALUE, 0} }; -#ifdef HAVE_NTGUI +#if defined(HAVE_NTGUI) && defined(WINDOWSNT) static bool init_xpm_functions (void); #else #define init_xpm_functions NULL @@ -3207,7 +3212,7 @@ #endif /* ALLOC_XPM_COLORS */ -#ifdef HAVE_NTGUI +#ifdef WINDOWSNT /* XPM library details. */ @@ -3233,9 +3238,16 @@ return 1; } +#endif /* WINDOWSNT */ + +#ifdef HAVE_NTGUI +/* Glue for code below */ +#define fn_XpmReadFileToImage XpmReadFileToImage +#define fn_XpmCreateImageFromBuffer XpmCreateImageFromBuffer +#define fn_XImageFree XImageFree +#define fn_XpmFreeAttributes XpmFreeAttributes #endif /* HAVE_NTGUI */ - /* Value is true if COLOR_SYMBOLS is a valid color symbols list for XPM images. Such a list must consist of conses whose car and cdr are strings. */ @@ -5340,7 +5352,7 @@ {":background", IMAGE_STRING_OR_NIL_VALUE, 0} }; -#ifdef HAVE_NTGUI +#if defined(HAVE_NTGUI) && defined (WINDOWSNT) static bool init_png_functions (void); #else #define init_png_functions NULL @@ -5378,7 +5390,7 @@ #ifdef HAVE_PNG -#ifdef HAVE_NTGUI +#ifdef WINDOWSNT /* PNG library details. */ DEF_IMGLIB_FN (png_voidp, png_get_io_ptr, (png_structp)); @@ -5478,7 +5490,7 @@ #define fn_png_set_longjmp_fn png_set_longjmp_fn #endif /* libpng version >= 1.5 */ -#endif /* HAVE_NTGUI */ +#endif /* WINDOWSNT */ /* Possibly inefficient/inexact substitutes for _setjmp and _longjmp. Do not use sys_setjmp, as PNG supports only jmp_buf. The _longjmp @@ -5999,7 +6011,7 @@ {":background", IMAGE_STRING_OR_NIL_VALUE, 0} }; -#ifdef HAVE_NTGUI +#if defined(HAVE_NTGUI) && defined(WINDOWSNT) static bool init_jpeg_functions (void); #else #define init_jpeg_functions NULL @@ -6049,14 +6061,20 @@ #define __WIN32__ 1 #endif +/* Work around conflict between jpeg boolean and rpcndr.h + under Windows. */ +#define boolean jpeg_boolean #include #include +/* Don't undefine boolean --- use the JPEG boolean + through the rest of the file. */ + #ifdef HAVE_STLIB_H_1 #define HAVE_STDLIB_H 1 #endif -#ifdef HAVE_NTGUI +#ifdef WINDOWSNT /* JPEG library details. */ DEF_IMGLIB_FN (void, jpeg_CreateDecompress, (j_decompress_ptr, int, size_t)); @@ -6106,7 +6124,7 @@ #define fn_jpeg_std_error jpeg_std_error #define jpeg_resync_to_restart_wrapper jpeg_resync_to_restart -#endif /* HAVE_NTGUI */ +#endif /* WINDOWSNT */ struct my_jpeg_error_mgr { @@ -6630,7 +6648,7 @@ #include -#ifdef HAVE_NTGUI +#ifdef WINDOWSNT /* TIFF library details. */ DEF_IMGLIB_FN (TIFFErrorHandler, TIFFSetErrorHandler, (TIFFErrorHandler)); @@ -6674,7 +6692,7 @@ #define fn_TIFFReadRGBAImage TIFFReadRGBAImage #define fn_TIFFClose TIFFClose #define fn_TIFFSetDirectory TIFFSetDirectory -#endif /* HAVE_NTGUI */ +#endif /* WINDOWSNT */ /* Reading from a memory buffer for TIFF images Based on the PNG @@ -7046,7 +7064,7 @@ {":background", IMAGE_STRING_OR_NIL_VALUE, 0} }; -#ifdef HAVE_NTGUI +#if defined(HAVE_NTGUI) && defined(WINDOWSNT) static bool init_gif_functions (void); #else #define init_gif_functions NULL @@ -7110,7 +7128,7 @@ #endif /* HAVE_NTGUI */ -#ifdef HAVE_NTGUI +#ifdef WINDOWSNT /* GIF library details. */ DEF_IMGLIB_FN (int, DGifCloseFile, (GifFileType *)); @@ -7140,7 +7158,7 @@ #define fn_DGifOpen DGifOpen #define fn_DGifOpenFileName DGifOpenFileName -#endif /* HAVE_NTGUI */ +#endif /* WINDOWSNT */ /* Reading a GIF image from memory Based on the PNG memory stuff to a certain extent. */ @@ -8137,7 +8155,7 @@ #include -#ifdef HAVE_NTGUI +#ifdef WINDOWSNT /* SVG library functions. */ DEF_IMGLIB_FN (RsvgHandle *, rsvg_handle_new); @@ -8215,7 +8233,7 @@ #define fn_g_type_init g_type_init #define fn_g_object_unref g_object_unref #define fn_g_error_free g_error_free -#endif /* !HAVE_NTGUI */ +#endif /* !WINDOWSNT */ /* Load SVG image IMG for use on frame F. Value is true if successful. */ @@ -8763,6 +8781,16 @@ Initialization ***********************************************************************/ +#ifdef WINDOWSNT +/* Image types that rely on external libraries are loaded dynamically + if the library is available. */ +#define CHECK_LIB_AVAILABLE(image_type, init_lib_fn, libraries) \ + define_image_type (image_type, init_lib_fn (libraries)) +#else +#define CHECK_LIB_AVAILABLE(image_type, init_lib_fn, libraries) \ + define_image_type (image_type, 1) +#endif /* WINDOWSNT */ + DEFUN ("init-image-library", Finit_image_library, Sinit_image_library, 1, 1, 0, doc: /* Initialize image library implementing image type TYPE. Return non-nil if TYPE is a supported image type. === modified file 'src/keyboard.c' --- src/keyboard.c 2012-10-06 00:52:17 +0000 +++ src/keyboard.c 2012-10-07 22:31:58 +0000 @@ -313,7 +313,7 @@ /* Symbols to denote kinds of events. */ static Lisp_Object Qfunction_key; Lisp_Object Qmouse_click; -#if defined (WINDOWSNT) +#if defined (HAVE_NTGUI) Lisp_Object Qlanguage_change; #endif static Lisp_Object Qdrag_n_drop; @@ -3766,8 +3766,8 @@ #ifdef subprocesses if (kbd_on_hold_p () && kbd_buffer_nr_stored () < KBD_BUFFER_SIZE/4) { - /* Start reading input again, we have processed enough so we can - accept new events again. */ + /* Start reading input again because we have processed enough to + be able to accept new events again. */ unhold_keyboard_input (); start_polling (); } @@ -3947,7 +3947,7 @@ x_activate_menubar (XFRAME (event->frame_or_window)); } #endif -#if defined (WINDOWSNT) +#if defined (HAVE_NTGUI) else if (event->kind == LANGUAGE_CHANGE_EVENT) { /* Make an event (language-change (FRAME CODEPAGE LANGUAGE-ID)). */ @@ -5417,7 +5417,7 @@ (sizeof (lispy_function_keys) / sizeof (lispy_function_keys[0]))); -#ifdef WINDOWSNT +#ifdef HAVE_NTGUI case MULTIMEDIA_KEY_EVENT: if (event->code < (sizeof (lispy_multimedia_keys) / sizeof (lispy_multimedia_keys[0])) @@ -11394,7 +11394,7 @@ DEFSYM (Qconfig_changed_event, "config-changed-event"); DEFSYM (Qmenu_enable, "menu-enable"); -#if defined (WINDOWSNT) +#if defined (HAVE_NTGUI) DEFSYM (Qlanguage_change, "language-change"); #endif === modified file 'src/keyboard.h' --- src/keyboard.h 2012-09-23 08:44:20 +0000 +++ src/keyboard.h 2012-10-07 22:31:58 +0000 @@ -551,7 +551,7 @@ extern EMACS_TIME timer_check (void); extern void mark_kboards (void); -#ifdef WINDOWSNT +#ifdef HAVE_NTGUI extern const char *const lispy_function_keys[]; #endif === modified file 'src/menu.c' --- src/menu.c 2012-09-23 08:44:20 +0000 +++ src/menu.c 2012-10-07 22:31:58 +0000 @@ -40,7 +40,11 @@ #endif /* HAVE_WINDOW_SYSTEM */ #ifdef HAVE_NTGUI +# ifdef NTGUI_UNICODE +# define unicode_append_menu AppendMenuW +# else /* !NTGUI_UNICODE */ extern AppendMenuW_Proc unicode_append_menu; +# endif /* NTGUI_UNICODE */ extern HMENU current_popup_menu; #endif /* HAVE_NTGUI */ === modified file 'src/process.c' --- src/process.c 2012-10-01 22:12:44 +0000 +++ src/process.c 2012-10-07 22:31:58 +0000 @@ -4646,6 +4646,7 @@ process_output_skip = 0; } #endif + #if defined (USE_GTK) || defined (HAVE_GCONF) || defined (HAVE_GSETTINGS) nfds = xg_select #elif defined (HAVE_NS) === modified file 'src/termhooks.h' --- src/termhooks.h 2012-09-23 08:44:20 +0000 +++ src/termhooks.h 2012-10-07 22:31:58 +0000 @@ -107,9 +107,9 @@ HORIZ_WHEEL_EVENT, /* A wheel event generated by a second horizontal wheel that is present on some mice. See WHEEL_EVENT. */ -#if defined (WINDOWSNT) +#if defined (HAVE_NTGUI) LANGUAGE_CHANGE_EVENT, /* A LANGUAGE_CHANGE_EVENT is - generated on WINDOWSNT or Mac OS + generated when HAVE_NTGUI or on Mac OS when the keyboard layout or input language is changed by the user. */ @@ -188,7 +188,7 @@ , CONFIG_CHANGED_EVENT -#ifdef WINDOWSNT +#ifdef HAVE_NTGUI /* Generated when an APPCOMMAND event is received, in response to Multimedia or Internet buttons on some keyboards. Such keys are available as normal function keys on X through the === modified file 'src/unexw32.c' --- src/unexw32.c 2012-10-01 11:37:37 +0000 +++ src/unexw32.c 2012-10-07 22:31:58 +0000 @@ -83,7 +83,7 @@ PIMAGE_SECTION_HEADER heap_section; #ifdef HAVE_NTGUI -HINSTANCE hinst = NULL; +extern HINSTANCE hinst; HINSTANCE hprevinst = NULL; LPSTR lpCmdLine = ""; int nCmdShow = 0; === modified file 'src/w32.c' --- src/w32.c 2012-10-05 09:21:51 +0000 +++ src/w32.c 2012-10-07 22:31:58 +0000 @@ -31,13 +31,13 @@ #include #include #include -#include /* for _mbspbrk */ #include #include /* must include CRT headers *before* config.h */ #include +#include /* for _mbspbrk */ #undef access #undef chdir @@ -866,23 +866,6 @@ return retval; } -/* Equivalent of strerror for W32 error codes. */ -char * -w32_strerror (int error_no) -{ - static char buf[500]; - - if (error_no == 0) - error_no = GetLastError (); - - buf[0] = '\0'; - if (!FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, NULL, - error_no, - 0, /* choose most suitable language */ - buf, sizeof (buf), NULL)) - sprintf (buf, "w32 error %u", error_no); - return buf; -} /* Return 1 if P is a valid pointer to an object of size SIZE. Return 0 if P is NOT a valid pointer. Return -1 if we cannot validate P. === modified file 'src/w32.h' --- src/w32.h 2012-09-30 15:49:05 +0000 +++ src/w32.h 2012-10-07 22:31:58 +0000 @@ -19,6 +19,12 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ +#ifdef CYGWIN +#error "w32.h is not compatible with Cygwin" +#endif + +#include + /* File descriptor set emulation. */ @@ -130,17 +136,6 @@ extern void init_ntproc (int); extern void term_ntproc (int); extern void globals_of_w32 (void); -extern void syms_of_w32term (void); -extern void syms_of_w32fns (void); -extern void globals_of_w32fns (void); -extern void syms_of_w32select (void); -extern void globals_of_w32select (void); -extern void term_w32select (void); -extern void syms_of_w32menu (void); -extern void globals_of_w32menu (void); -extern void syms_of_fontset (void); -extern void syms_of_w32font (void); -extern void check_windows_init_file (void); extern void term_timers (void); extern void init_timers (void); === modified file 'src/w32console.c' --- src/w32console.c 2012-09-15 08:03:11 +0000 +++ src/w32console.c 2012-09-17 12:07:36 +0000 @@ -36,6 +36,7 @@ #include "termhooks.h" #include "termchar.h" #include "dispextern.h" +#include "w32term.h" #include "w32heap.h" /* for os_subtype */ #include "w32inevt.h" @@ -430,53 +431,6 @@ scroll_line (f, n, LEFT); } -static unsigned int sound_type = 0xFFFFFFFF; -#define MB_EMACS_SILENT (0xFFFFFFFF - 1) - -void -w32_sys_ring_bell (struct frame *f) -{ - if (sound_type == 0xFFFFFFFF) - { - Beep (666, 100); - } - else if (sound_type == MB_EMACS_SILENT) - { - /* Do nothing. */ - } - else - MessageBeep (sound_type); -} - -DEFUN ("set-message-beep", Fset_message_beep, Sset_message_beep, 1, 1, 0, - doc: /* Set the sound generated when the bell is rung. -SOUND is 'asterisk, 'exclamation, 'hand, 'question, 'ok, or 'silent -to use the corresponding system sound for the bell. The 'silent sound -prevents Emacs from making any sound at all. -SOUND is nil to use the normal beep. */) - (Lisp_Object sound) -{ - CHECK_SYMBOL (sound); - - if (NILP (sound)) - sound_type = 0xFFFFFFFF; - else if (EQ (sound, intern ("asterisk"))) - sound_type = MB_ICONASTERISK; - else if (EQ (sound, intern ("exclamation"))) - sound_type = MB_ICONEXCLAMATION; - else if (EQ (sound, intern ("hand"))) - sound_type = MB_ICONHAND; - else if (EQ (sound, intern ("question"))) - sound_type = MB_ICONQUESTION; - else if (EQ (sound, intern ("ok"))) - sound_type = MB_OK; - else if (EQ (sound, intern ("silent"))) - sound_type = MB_EMACS_SILENT; - else - sound_type = 0xFFFFFFFF; - - return sound; -} static void w32con_reset_terminal_modes (struct terminal *t) @@ -850,5 +804,4 @@ defsubr (&Sset_screen_color); defsubr (&Sget_screen_color); defsubr (&Sset_cursor_size); - defsubr (&Sset_message_beep); } === modified file 'src/w32fns.c' --- src/w32fns.c 2012-10-07 14:54:01 +0000 +++ src/w32fns.c 2012-10-07 22:31:58 +0000 @@ -44,8 +44,14 @@ #include "fontset.h" #include "systime.h" #include "termhooks.h" + #include "w32heap.h" + +#if CYGWIN +#include "cygw32.h" +#else #include "w32.h" +#endif #include "bitmaps/gray.xbm" @@ -58,9 +64,6 @@ #include #include -#define FILE_NAME_TEXT_FIELD edt1 -#define FILE_NAME_COMBO_BOX cmb13 -#define FILE_NAME_LIST lst1 #include "font.h" #include "w32font.h" @@ -78,6 +81,7 @@ extern void w32_menu_display_help (HWND, HMENU, UINT, UINT); extern void w32_free_menu_strings (HWND); extern const char *map_w32_filename (const char *, const char **); +extern char * w32_strerror (int error_no); /* If non-NULL, a handle to a frame where to display the hourglass cursor. */ static HWND hourglass_hwnd = NULL; @@ -161,7 +165,11 @@ MonitorFromPoint_Proc monitor_from_point_fn = NULL; GetMonitorInfo_Proc get_monitor_info_fn = NULL; +#ifdef NTGUI_UNICODE +#define unicode_append_menu AppendMenuW +#else /* !NTGUI_UNICODE */ extern AppendMenuW_Proc unicode_append_menu; +#endif /* NTGUI_UNICODE */ /* Flag to selectively ignore WM_IME_CHAR messages. */ static int ignore_ime_char = 0; @@ -198,6 +206,33 @@ static void w32_show_hourglass (struct frame *); static void w32_hide_hourglass (void); +#ifdef WINDOWSNT +/* From w32inevet.c */ +extern int faked_key; +#endif /* WINDOWSNT */ + +/* This gives us the page size and the size of the allocation unit on NT. */ +SYSTEM_INFO sysinfo_cache; + +/* This gives us version, build, and platform identification. */ +OSVERSIONINFO osinfo_cache; + +unsigned long syspage_mask = 0; + +/* The major and minor versions of NT. */ +int w32_major_version; +int w32_minor_version; +int w32_build_number; + +/* Distinguish between Windows NT and Windows 95. */ +int os_subtype; + +#ifdef HAVE_NTGUI +HINSTANCE hinst = NULL; +#endif + +static unsigned int sound_type = 0xFFFFFFFF; +#define MB_EMACS_SILENT (0xFFFFFFFF - 1) /* Error if we are not connected to MS-Windows. */ @@ -1068,7 +1103,7 @@ If ALLOC is nonzero, allocate a new colormap cell. */ int -w32_defined_color (FRAME_PTR f, char *color, XColor *color_def, int alloc) +w32_defined_color (FRAME_PTR f, const char *color, XColor *color_def, int alloc) { register Lisp_Object tem; COLORREF w32_color_ref; @@ -1843,10 +1878,7 @@ /* Do first time app init */ - if (!hprevinst) - { - w32_init_class (hinst); - } + w32_init_class (hinst); if (f->size_hint_flags & USPosition || f->size_hint_flags & PPosition) { @@ -2246,6 +2278,58 @@ } } +#if EMACSDEBUG +const char* +w32_name_of_message (UINT msg) +{ + unsigned i; + static char buf[64]; + static const struct { + UINT msg; + const char* name; + } msgnames[] = { +#define M(msg) { msg, # msg } + M (WM_PAINT), + M (WM_TIMER), + M (WM_USER), + M (WM_MOUSEMOVE), + M (WM_LBUTTONUP), + M (WM_KEYDOWN), + M (WM_EMACS_KILL), + M (WM_EMACS_CREATEWINDOW), + M (WM_EMACS_DONE), + M (WM_EMACS_CREATESCROLLBAR), + M (WM_EMACS_SHOWWINDOW), + M (WM_EMACS_SETWINDOWPOS), + M (WM_EMACS_DESTROYWINDOW), + M (WM_EMACS_TRACKPOPUPMENU), + M (WM_EMACS_SETFOCUS), + M (WM_EMACS_SETFOREGROUND), + M (WM_EMACS_SETLOCALE), + M (WM_EMACS_SETKEYBOARDLAYOUT), + M (WM_EMACS_REGISTER_HOT_KEY), + M (WM_EMACS_UNREGISTER_HOT_KEY), + M (WM_EMACS_TOGGLE_LOCK_KEY), + M (WM_EMACS_TRACK_CARET), + M (WM_EMACS_DESTROY_CARET), + M (WM_EMACS_SHOW_CARET), + M (WM_EMACS_HIDE_CARET), + M (WM_EMACS_SETCURSOR), + M (WM_EMACS_PAINT), + M (WM_CHAR), +#undef M + { 0, 0 } + }; + + for (i = 0; msgnames[i].name; ++i) + if (msgnames[i].msg == msg) + return msgnames[i].name; + + sprintf (buf, "message 0x%04x", (unsigned)msg); + return buf; +} +#endif /* EMACSDEBUG */ + /* Here's an overview of how Emacs input works on MS-Windows. System messages are read and processed by w32_msg_pump below. This @@ -2265,7 +2349,12 @@ messages immediately, or converts them into Emacs input events and stuffs them into kbd_buffer, where kbd_buffer_get_event can get at them and process them when read_char and its callers require - input. */ + input. + + Under Cygwin with the W32 toolkit, the use of /dev/windows with + select(2) takes the place of w32_read_socket. + + */ /* Main message dispatch loop. */ @@ -2280,6 +2369,10 @@ while ((w32_unicode_gui ? GetMessageW : GetMessageA) (&msg, NULL, 0, 0)) { + + /* DebPrint (("w32_msg_pump: %s time:%u\n", */ + /* w32_name_of_message (msg.message), msg.time)); */ + if (msg.hwnd == NULL) { switch (msg.message) @@ -2367,7 +2460,7 @@ /* Broadcast messages make it here, so you need to be looking for something in particular for this to be useful. */ default: - DebPrint (("msg %x not expected by w32_msg_pump\n", msg.message)); + DebPrint (("msg %x not expected by w32_msg_pump\n", msg.message)); #endif } } @@ -4703,6 +4796,37 @@ { return Qnil; } + +DEFUN ("set-message-beep", Fset_message_beep, Sset_message_beep, 1, 1, 0, + doc: /* Set the sound generated when the bell is rung. +SOUND is 'asterisk, 'exclamation, 'hand, 'question, 'ok, or 'silent +to use the corresponding system sound for the bell. The 'silent sound +prevents Emacs from making any sound at all. +SOUND is nil to use the normal beep. */) + (Lisp_Object sound) +{ + CHECK_SYMBOL (sound); + + if (NILP (sound)) + sound_type = 0xFFFFFFFF; + else if (EQ (sound, intern ("asterisk"))) + sound_type = MB_ICONASTERISK; + else if (EQ (sound, intern ("exclamation"))) + sound_type = MB_ICONEXCLAMATION; + else if (EQ (sound, intern ("hand"))) + sound_type = MB_ICONHAND; + else if (EQ (sound, intern ("question"))) + sound_type = MB_ICONQUESTION; + else if (EQ (sound, intern ("ok"))) + sound_type = MB_OK; + else if (EQ (sound, intern ("silent"))) + sound_type = MB_EMACS_SILENT; + else + sound_type = 0xFFFFFFFF; + + return sound; +} + int x_pixel_width (register struct frame *f) @@ -4784,12 +4908,21 @@ unsigned char *xrm_option; struct w32_display_info *dpyinfo; + CHECK_STRING (display); + + /* Signal an error in order to encourage correct use from callers. + * If we ever support multiple window systems in the same Emacs, + * we'll need callers to be precise about what window system they + * want. */ + + if (strcmp (SSDATA (display), "w32") != 0) + error ("The name of the display in this Emacs must be \"w32\""); + /* If initialization has already been done, return now to avoid overwriting critical parts of one_w32_display_info. */ if (w32_in_use) return Qnil; - CHECK_STRING (display); if (! NILP (xrm_string)) CHECK_STRING (xrm_string); @@ -5860,6 +5993,18 @@ File selection dialog ***********************************************************************/ +#define FILE_NAME_TEXT_FIELD edt1 +#define FILE_NAME_COMBO_BOX cmb13 +#define FILE_NAME_LIST lst1 + +#ifdef NTGUI_UNICODE +#define GUISTR(x) (L ## x) +typedef wchar_t guichar_t; +#else /* !NTGUI_UNICODE */ +#define GUISTR(x) x +typedef char guichar_t; +#endif /* NTGUI_UNICODE */ + /* Callback for altering the behavior of the Open File dialog. Makes the Filename text field contain "Current Directory" and be read-only when "Directories" is selected in the filter. This @@ -5870,7 +6015,11 @@ { if (msg == WM_NOTIFY) { - OFNOTIFY * notify = (OFNOTIFY *)lParam; +#ifdef NTGUI_UNICODE + OFNOTIFYW * notify = (OFNOTIFYW *)lParam; +#else /* !NTGUI_UNICODE */ + OFNOTIFYA * notify = (OFNOTIFYA *)lParam; +#endif /* NTGUI_UNICODE */ /* Detect when the Filter dropdown is changed. */ if (notify->hdr.code == CDN_TYPECHANGE || notify->hdr.code == CDN_INITDONE) @@ -5898,7 +6047,7 @@ if (notify->lpOFN->nFilterIndex == 2) { CommDlg_OpenSave_SetControlText (dialog, FILE_NAME_TEXT_FIELD, - "Current Directory"); + GUISTR ("Current Directory")); EnableWindow (edit_control, FALSE); /* Note that at least on Windows 7, the above call to EnableWindow disables the window that would ordinarily have focus. If we @@ -5914,7 +6063,8 @@ /* Don't override default filename on init done. */ if (notify->hdr.code == CDN_TYPECHANGE) CommDlg_OpenSave_SetControlText (dialog, - FILE_NAME_TEXT_FIELD, ""); + FILE_NAME_TEXT_FIELD, + GUISTR ("")); EnableWindow (edit_control, TRUE); } } @@ -5922,19 +6072,6 @@ return 0; } -/* Since we compile with _WIN32_WINNT set to 0x0400 (for NT4 compatibility) - we end up with the old file dialogs. Define a big enough struct for the - new dialog to trick GetOpenFileName into giving us the new dialogs on - Windows 2000 and XP. */ -typedef struct -{ - OPENFILENAME real_details; - void * pReserved; - DWORD dwReserved; - DWORD FlagsEx; -} NEWOPENFILENAME; - - DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0, doc: /* Read file name, prompting with PROMPT in directory DIR. Use a file selection dialog. Select DEFAULT-FILENAME in the dialog's file @@ -5946,134 +6083,203 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p) { + /* Filter index: 1: All Files, 2: Directories only */ + static const guichar_t filter[] = + GUISTR ("All Files (*.*)\0*.*\0Directories\0*|*\0"); + + Lisp_Object filename = default_filename; struct frame *f = SELECTED_FRAME (); - Lisp_Object file = Qnil; - ptrdiff_t count = SPECPDL_INDEX (); + BOOL file_opened = FALSE; + Lisp_Object orig_dir = dir; + Lisp_Object orig_prompt = prompt; + + /* If we compile with _WIN32_WINNT set to 0x0400 (for NT4 + compatibility) we end up with the old file dialogs. Define a big + enough struct for the new dialog to trick GetOpenFileName into + giving us the new dialogs on newer versions of Windows. */ + struct { +#ifdef NTGUI_UNICODE + OPENFILENAMEW details; +#else /* !NTGUI_UNICODE */ + OPENFILENAMEA details; +#endif /* NTGUI_UNICODE */ + +#if _WIN32_WINNT < 0x500 /* < win2k */ + PVOID pvReserved; + DWORD dwReserved; + DWORD FlagsEx; +#endif /* < win2k */ + } new_file_details; + +#ifdef NTGUI_UNICODE + wchar_t filename_buf[MAX_PATH + 1]; + OPENFILENAMEW * file_details = &new_file_details.details; +#else /* not NTGUI_UNICODE */ + char filename_buf[MAX_PATH + 1]; + OPENFILENAMEA * file_details = &new_file_details.details; +#endif /* NTGUI_UNICODE */ + struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; - char filename[MAX_PATH + 1]; - char init_dir[MAX_PATH + 1]; - int default_filter_index = 1; /* 1: All Files, 2: Directories only */ - - GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file); - CHECK_STRING (prompt); - CHECK_STRING (dir); - - /* Create the dialog with PROMPT as title, using DIR as initial - directory and using "*" as pattern. */ - dir = Fexpand_file_name (dir, Qnil); - strncpy (init_dir, SDATA (ENCODE_FILE (dir)), MAX_PATH); - init_dir[MAX_PATH] = '\0'; - unixtodos_filename (init_dir); - - if (STRINGP (default_filename)) - { - char *file_name_only; - char *full_path_name = SDATA (ENCODE_FILE (default_filename)); - - unixtodos_filename (full_path_name); - - file_name_only = strrchr (full_path_name, '\\'); - if (!file_name_only) - file_name_only = full_path_name; - else - file_name_only++; - - strncpy (filename, file_name_only, MAX_PATH); - filename[MAX_PATH] = '\0'; - } - else - filename[0] = '\0'; - - /* The code in file_dialog_callback that attempts to set the text - of the file name edit window when handling the CDN_INITDONE - WM_NOTIFY message does not work. Setting filename to "Current - Directory" in the only_dir_p case here does work however. */ - if (filename[0] == 0 && ! NILP (only_dir_p)) - strcpy (filename, "Current Directory"); + GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, filename); { - NEWOPENFILENAME new_file_details; - BOOL file_opened = FALSE; - OPENFILENAME * file_details = &new_file_details.real_details; - - /* Prevent redisplay. */ - specbind (Qinhibit_redisplay, Qt); - block_input (); - + struct gcpro gcpro1, gcpro2; + GCPRO2 (orig_dir, orig_prompt); /* There is no GCPRON, N>6. */ + + /* Note: under NTGUI_UNICODE, we do _NOT_ use ENCODE_FILE: the + system file encoding expected by the platform APIs (e.g. Cygwin's + POSIX implementation) may not the same as the encoding expected + by the Windows API! */ + + CHECK_STRING (prompt); + CHECK_STRING (dir); + + dir = Fexpand_file_name (dir, Qnil); + + if (STRINGP (filename)) + filename = Ffile_name_nondirectory (filename); + else + filename = empty_unibyte_string; + +#ifdef CYGWIN + dir = Fcygwin_convert_path_to_windows (dir, Qt); + if (SCHARS (filename) > 0) + filename = Fcygwin_convert_path_to_windows (filename, Qnil); +#endif + + CHECK_STRING (dir); + CHECK_STRING (filename); + + /* The code in file_dialog_callback that attempts to set the text + of the file name edit window when handling the CDN_INITDONE + WM_NOTIFY message does not work. Setting filename to "Current + Directory" in the only_dir_p case here does work however. */ + if (SCHARS (filename) == 0 && ! NILP (only_dir_p)) + filename = build_string ("Current Directory"); + + /* Convert the values we've computed so far to system form. */ +#ifdef NTGUI_UNICODE + to_unicode (prompt, &prompt); + to_unicode (dir, &dir); + to_unicode (filename, &filename); +#else /* !NTGUI_UNICODE */ + prompt = ENCODE_FILE (prompt); + dir = ENCODE_FILE (dir); + filename = ENCODE_FILE (filename); + + /* We modify these in-place, so make copies for safety. */ + dir = Fcopy_sequence (dir); + unixtodos_filename (SDATA (dir)); + filename = Fcopy_sequence (filename); + unixtodos_filename (SDATA (filename)); +#endif /* NTGUI_UNICODE */ + + /* Fill in the structure for the call to GetOpenFileName below. For + NTGUI_UNICODE builds (which run only on NT), we just use the + actual size of the structure. For non-NTGUI_UNICODE builds, we + tell the OS we're using an old version of the structure if it's not + new enough to support the newer version. */ memset (&new_file_details, 0, sizeof (new_file_details)); - /* Apparently NT4 crashes if you give it an unexpected size. - I'm not sure about Windows 9x, so play it safe. */ + if (w32_major_version > 4 && w32_major_version < 95) - file_details->lStructSize = sizeof (NEWOPENFILENAME); + file_details->lStructSize = sizeof (new_file_details); else - file_details->lStructSize = sizeof (OPENFILENAME); + file_details->lStructSize = sizeof (*file_details); + + /* Set up the inout parameter for the selected file name. */ + if (SBYTES (filename) + 1 > sizeof (filename_buf)) + error ("filename too long"); + + memcpy (filename_buf, SDATA (filename), SBYTES (filename) + 1); + file_details->lpstrFile = filename_buf; + file_details->nMaxFile = sizeof (filename_buf) / sizeof (*filename_buf); file_details->hwndOwner = FRAME_W32_WINDOW (f); /* Undocumented Bug in Common File Dialog: If a filter is not specified, shell links are not resolved. */ - file_details->lpstrFilter = "All Files (*.*)\0*.*\0Directories\0*|*\0\0"; - file_details->lpstrFile = filename; - file_details->nMaxFile = sizeof (filename); - file_details->lpstrInitialDir = init_dir; - file_details->lpstrTitle = SDATA (prompt); - - if (! NILP (only_dir_p)) - default_filter_index = 2; - - file_details->nFilterIndex = default_filter_index; - + file_details->lpstrFilter = filter; + file_details->lpstrInitialDir = (guichar_t*) SDATA (dir); + file_details->lpstrTitle = (guichar_t*) SDATA (prompt); + file_details->nFilterIndex = NILP (only_dir_p) ? 1 : 2; file_details->Flags = (OFN_HIDEREADONLY | OFN_NOCHANGEDIR - | OFN_EXPLORER | OFN_ENABLEHOOK); + | OFN_EXPLORER | OFN_ENABLEHOOK); + if (!NILP (mustmatch)) { - /* Require that the path to the parent directory exists. */ - file_details->Flags |= OFN_PATHMUSTEXIST; - /* If we are looking for a file, require that it exists. */ - if (NILP (only_dir_p)) - file_details->Flags |= OFN_FILEMUSTEXIST; + /* Require that the path to the parent directory exists. */ + file_details->Flags |= OFN_PATHMUSTEXIST; + /* If we are looking for a file, require that it exists. */ + if (NILP (only_dir_p)) + file_details->Flags |= OFN_FILEMUSTEXIST; } - file_details->lpfnHook = (LPOFNHOOKPROC) file_dialog_callback; - - file_opened = GetOpenFileName (file_details); - - unblock_input (); + { + int count = SPECPDL_INDEX (); + specbind (Qinhibit_redisplay, Qt); + block_input (); + file_details->lpfnHook = file_dialog_callback; + +#ifdef NTGUI_UNICODE + file_opened = GetOpenFileNameW (file_details); +#else /* !NTGUI_UNICODE */ + file_opened = GetOpenFileNameA (file_details); +#endif /* NTGUI_UNICODE */ + unblock_input (); + unbind_to (count, Qnil); + } if (file_opened) { - dostounix_filename (filename); - - if (file_details->nFilterIndex == 2) - { - /* "Directories" selected - strip dummy file name. */ - char * last = strrchr (filename, '/'); - *last = '\0'; - } - - file = DECODE_FILE (build_string (filename)); + /* Get an Emacs string from the value Windows gave us. */ +#ifdef NTGUI_UNICODE + filename = from_unicode ( + make_unibyte_string ( + (char*) filename_buf, + /* we get one of the two final 0 bytes for free. */ + 1 + sizeof (wchar_t) * wcslen (filename_buf))); +#else /* !NTGUI_UNICODE */ + dostounix_filename (filename_buf); + filename = DECODE_FILE (build_string (filename_buf)); +#endif /* NTGUI_UNICODE */ + +#ifdef CYGWIN + filename = Fcygwin_convert_path_from_windows (filename, Qt); +#endif /* CYGWIN */ + + /* Strip the dummy filename off the end of the string if we + added it to select a directory. */ + if (file_details->nFilterIndex == 2) + { + filename = Ffile_name_directory (filename); + } } /* User canceled the dialog without making a selection. */ else if (!CommDlgExtendedError ()) - file = Qnil; + filename = Qnil; /* An error occurred, fallback on reading from the mini-buffer. */ else - file = Fcompleting_read (prompt, intern ("read-file-name-internal"), - dir, mustmatch, dir, Qfile_name_history, - default_filename, Qnil); + filename = Fcompleting_read ( + orig_prompt, + intern ("read-file-name-internal"), + orig_dir, + mustmatch, + orig_dir, + Qfile_name_history, + default_filename, + Qnil); - file = unbind_to (count, file); + UNGCPRO; } - UNGCPRO; - /* Make "Cancel" equivalent to C-g. */ - if (NILP (file)) + if (NILP (filename)) Fsignal (Qquit, Qnil); - return unbind_to (count, file); + RETURN_UNGCPRO (filename); } - + +#ifdef WINDOWSNT /* Moving files to the system recycle bin. Used by `move-file-to-trash' instead of the default moving to ~/.Trash */ DEFUN ("system-move-file-to-trash", Fsystem_move_file_to_trash, @@ -6127,6 +6333,8 @@ return Qnil; } +#endif /* WINDOWSNT */ + /*********************************************************************** w32 specialized functions @@ -6544,7 +6752,7 @@ else { char buffer[16]; - _snprintf (buffer, 16, "%d", system_status.BatteryLifePercent); + snprintf (buffer, 16, "%d", system_status.BatteryLifePercent); load_percentage = build_string (buffer); } @@ -6555,18 +6763,18 @@ long m; float h; char buffer[16]; - _snprintf (buffer, 16, "%ld", seconds_left); + snprintf (buffer, 16, "%ld", seconds_left); seconds = build_string (buffer); m = seconds_left / 60; - _snprintf (buffer, 16, "%ld", m); + snprintf (buffer, 16, "%ld", m); minutes = build_string (buffer); h = seconds_left / 3600.0; - _snprintf (buffer, 16, "%3.1f", h); + snprintf (buffer, 16, "%3.1f", h); hours = build_string (buffer); - _snprintf (buffer, 16, "%ld:%02ld", m / 60, m % 60); + snprintf (buffer, 16, "%ld:%02ld", m / 60, m % 60); remain = build_string (buffer); } @@ -6728,10 +6936,10 @@ { /* a remote printer */ if (*ppi2->pServerName == '\\') - _snprintf (pname_buf, sizeof (pname_buf), "%s\\%s", ppi2->pServerName, + snprintf (pname_buf, sizeof (pname_buf), "%s\\%s", ppi2->pServerName, ppi2->pShareName); else - _snprintf (pname_buf, sizeof (pname_buf), "\\\\%s\\%s", ppi2->pServerName, + snprintf (pname_buf, sizeof (pname_buf), "\\\\%s\\%s", ppi2->pServerName, ppi2->pShareName); pname_buf[sizeof (pname_buf) - 1] = '\0'; } @@ -6750,6 +6958,292 @@ return build_string (pname_buf); } + +/* Equivalent of strerror for W32 error codes. */ +char * +w32_strerror (int error_no) +{ + static char buf[500]; + DWORD ret; + + if (error_no == 0) + error_no = GetLastError (); + + ret = FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + error_no, + 0, /* choose most suitable language */ + buf, sizeof (buf), NULL); + + while (ret > 0 && (buf[ret - 1] == '\n' || + buf[ret - 1] == '\r' )) + --ret; + buf[ret] = '\0'; + if (!ret) + sprintf (buf, "w32 error %u", error_no); + + return buf; +} + +/* For convenience when debugging. */ +int +w32_last_error (void) +{ + return GetLastError (); +} + +/* Cache information describing the NT system for later use. */ +void +cache_system_info (void) +{ + union + { + struct info + { + char major; + char minor; + short platform; + } info; + DWORD data; + } version; + + /* Cache the version of the operating system. */ + version.data = GetVersion (); + w32_major_version = version.info.major; + w32_minor_version = version.info.minor; + + if (version.info.platform & 0x8000) + os_subtype = OS_9X; + else + os_subtype = OS_NT; + + /* Cache page size, allocation unit, processor type, etc. */ + GetSystemInfo (&sysinfo_cache); + syspage_mask = sysinfo_cache.dwPageSize - 1; + + /* Cache os info. */ + osinfo_cache.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); + GetVersionEx (&osinfo_cache); + + w32_build_number = osinfo_cache.dwBuildNumber; + if (os_subtype == OS_9X) + w32_build_number &= 0xffff; + + w32_num_mouse_buttons = GetSystemMetrics (SM_CMOUSEBUTTONS); +} + +#ifdef EMACSDEBUG +void +_DebPrint (const char *fmt, ...) +{ + char buf[1024]; + va_list args; + + va_start (args, fmt); + vsprintf (buf, fmt, args); + va_end (args); +#if CYGWIN + fprintf (stderr, "%s", buf); +#endif + OutputDebugString (buf); +} +#endif + +int +w32_console_toggle_lock_key (int vk_code, Lisp_Object new_state) +{ + int cur_state = (GetKeyState (vk_code) & 1); + + if (NILP (new_state) + || (NUMBERP (new_state) + && ((XUINT (new_state)) & 1) != cur_state)) + { +#ifdef WINDOWSNT + faked_key = vk_code; +#endif /* WINDOWSNT */ + + keybd_event ((BYTE) vk_code, + (BYTE) MapVirtualKey (vk_code, 0), + KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0); + keybd_event ((BYTE) vk_code, + (BYTE) MapVirtualKey (vk_code, 0), + KEYEVENTF_EXTENDEDKEY | 0, 0); + keybd_event ((BYTE) vk_code, + (BYTE) MapVirtualKey (vk_code, 0), + KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0); + cur_state = !cur_state; + } + + return cur_state; +} + +/* Translate console modifiers to emacs modifiers. + German keyboard support (Kai Morgan Zeise 2/18/95). */ +int +w32_kbd_mods_to_emacs (DWORD mods, WORD key) +{ + int retval = 0; + + /* If we recognize right-alt and left-ctrl as AltGr, and it has been + pressed, first remove those modifiers. */ + if (!NILP (Vw32_recognize_altgr) + && (mods & (RIGHT_ALT_PRESSED | LEFT_CTRL_PRESSED)) + == (RIGHT_ALT_PRESSED | LEFT_CTRL_PRESSED)) + mods &= ~ (RIGHT_ALT_PRESSED | LEFT_CTRL_PRESSED); + + if (mods & (RIGHT_ALT_PRESSED | LEFT_ALT_PRESSED)) + retval = ((NILP (Vw32_alt_is_meta)) ? alt_modifier : meta_modifier); + + if (mods & (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED)) + { + retval |= ctrl_modifier; + if ((mods & (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED)) + == (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED)) + retval |= meta_modifier; + } + + if (mods & LEFT_WIN_PRESSED) + retval |= w32_key_to_modifier (VK_LWIN); + if (mods & RIGHT_WIN_PRESSED) + retval |= w32_key_to_modifier (VK_RWIN); + if (mods & APPS_PRESSED) + retval |= w32_key_to_modifier (VK_APPS); + if (mods & SCROLLLOCK_ON) + retval |= w32_key_to_modifier (VK_SCROLL); + + /* Just in case someone wanted the original behavior, make it + optional by setting w32-capslock-is-shiftlock to t. */ + if (NILP (Vw32_capslock_is_shiftlock) + /* Keys that should _not_ be affected by CapsLock. */ + && ( (key == VK_BACK) + || (key == VK_TAB) + || (key == VK_CLEAR) + || (key == VK_RETURN) + || (key == VK_ESCAPE) + || ((key >= VK_SPACE) && (key <= VK_HELP)) + || ((key >= VK_NUMPAD0) && (key <= VK_F24)) + || ((key >= VK_NUMPAD_CLEAR) && (key <= VK_NUMPAD_DELETE)) + )) + { + /* Only consider shift state. */ + if ((mods & SHIFT_PRESSED) != 0) + retval |= shift_modifier; + } + else + { + /* Ignore CapsLock state if not enabled. */ + if (NILP (Vw32_enable_caps_lock)) + mods &= ~CAPSLOCK_ON; + if ((mods & (SHIFT_PRESSED | CAPSLOCK_ON)) != 0) + retval |= shift_modifier; + } + + return retval; +} + +/* The return code indicates key code size. cpID is the codepage to + use for translation to Unicode; -1 means use the current console + input codepage. */ +int +w32_kbd_patch_key (KEY_EVENT_RECORD *event, int cpId) +{ + unsigned int key_code = event->wVirtualKeyCode; + unsigned int mods = event->dwControlKeyState; + BYTE keystate[256]; + static BYTE ansi_code[4]; + static int isdead = 0; + + if (isdead == 2) + { + event->uChar.AsciiChar = ansi_code[2]; + isdead = 0; + return 1; + } + if (event->uChar.AsciiChar != 0) + return 1; + + memset (keystate, 0, sizeof (keystate)); + keystate[key_code] = 0x80; + if (mods & SHIFT_PRESSED) + keystate[VK_SHIFT] = 0x80; + if (mods & CAPSLOCK_ON) + keystate[VK_CAPITAL] = 1; + /* If we recognize right-alt and left-ctrl as AltGr, set the key + states accordingly before invoking ToAscii. */ + if (!NILP (Vw32_recognize_altgr) + && (mods & LEFT_CTRL_PRESSED) && (mods & RIGHT_ALT_PRESSED)) + { + keystate[VK_CONTROL] = 0x80; + keystate[VK_LCONTROL] = 0x80; + keystate[VK_MENU] = 0x80; + keystate[VK_RMENU] = 0x80; + } + +#if 0 + /* Because of an OS bug, ToAscii corrupts the stack when called to + convert a dead key in console mode on NT4. Unfortunately, trying + to check for dead keys using MapVirtualKey doesn't work either - + these functions apparently use internal information about keyboard + layout which doesn't get properly updated in console programs when + changing layout (though apparently it gets partly updated, + otherwise ToAscii wouldn't crash). */ + if (is_dead_key (event->wVirtualKeyCode)) + return 0; +#endif + + /* On NT, call ToUnicode instead and then convert to the current + console input codepage. */ + if (os_subtype == OS_NT) + { + WCHAR buf[128]; + + isdead = ToUnicode (event->wVirtualKeyCode, event->wVirtualScanCode, + keystate, buf, 128, 0); + if (isdead > 0) + { + /* When we are called from the GUI message processing code, + we are passed the current keyboard codepage, a positive + number, to use below. */ + if (cpId == -1) + cpId = GetConsoleCP (); + + event->uChar.UnicodeChar = buf[isdead - 1]; + isdead = WideCharToMultiByte (cpId, 0, buf, isdead, + ansi_code, 4, NULL, NULL); + } + else + isdead = 0; + } + else + { + isdead = ToAscii (event->wVirtualKeyCode, event->wVirtualScanCode, + keystate, (LPWORD) ansi_code, 0); + } + + if (isdead == 0) + return 0; + event->uChar.AsciiChar = ansi_code[0]; + return isdead; +} + + +void +w32_sys_ring_bell (struct frame *f) +{ + if (sound_type == 0xFFFFFFFF) + { + Beep (666, 100); + } + else if (sound_type == MB_EMACS_SILENT) + { + /* Do nothing. */ + } + else + MessageBeep (sound_type); +} + + /*********************************************************************** Initialization ***********************************************************************/ @@ -7116,6 +7610,7 @@ defsubr (&Sfile_system_info); defsubr (&Sdefault_printer_name); + defsubr (&Sset_message_beep); check_window_system_func = check_w32; @@ -7132,7 +7627,9 @@ staticpro (&last_show_tip_args); defsubr (&Sx_file_dialog); +#ifdef WINDOWSNT defsubr (&Ssystem_move_file_to_trash); +#endif } @@ -7214,9 +7711,3 @@ } } -/* For convenience when debugging. */ -int -w32_last_error (void) -{ - return GetLastError (); -} === modified file 'src/w32font.c' --- src/w32font.c 2012-09-15 08:03:11 +0000 +++ src/w32font.c 2012-09-17 12:07:36 +0000 @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -1434,6 +1435,9 @@ return 1; } +#ifndef WINDOWSNT +#define _strlwr strlwr +#endif /* !WINDOWSNT */ static int check_face_name (LOGFONT *font, char *full_name) === modified file 'src/w32heap.c' --- src/w32heap.c 2012-09-30 21:36:42 +0000 +++ src/w32heap.c 2012-10-08 08:18:01 +0000 @@ -32,10 +32,9 @@ SYSTEM_INFO sysinfo_cache; /* This gives us version, build, and platform identification. */ +extern unsigned long syspage_mask; OSVERSIONINFO osinfo_cache; -size_t syspage_mask = 0; - /* The major and minor versions of NT. */ int w32_major_version; int w32_minor_version; @@ -44,44 +43,6 @@ /* Distinguish between Windows NT and Windows 95. */ int os_subtype; -/* Cache information describing the NT system for later use. */ -void -cache_system_info (void) -{ - union - { - struct info - { - char major; - char minor; - short platform; - } info; - DWORD data; - } version; - - /* Cache the version of the operating system. */ - version.data = GetVersion (); - w32_major_version = version.info.major; - w32_minor_version = version.info.minor; - - if (version.info.platform & 0x8000) - os_subtype = OS_9X; - else - os_subtype = OS_NT; - - /* Cache page size, allocation unit, processor type, etc. */ - GetSystemInfo (&sysinfo_cache); - syspage_mask = sysinfo_cache.dwPageSize - 1; - - /* Cache os info. */ - osinfo_cache.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); - GetVersionEx (&osinfo_cache); - - w32_build_number = osinfo_cache.dwBuildNumber; - if (os_subtype == OS_9X) - w32_build_number &= 0xffff; -} - /* Emulate getpagesize. */ int getpagesize (void) === modified file 'src/w32inevt.c' --- src/w32inevt.c 2012-09-23 08:44:20 +0000 +++ src/w32inevt.c 2012-10-07 22:31:58 +0000 @@ -70,6 +70,9 @@ : ReadConsoleInputA (h, rec, recsize, waiting)); } +/* Set by w32_console_toggle_lock_key. */ +int faked_key; + static int fill_queue (BOOL block) { @@ -110,67 +113,7 @@ /* Translate console modifiers to emacs modifiers. German keyboard support (Kai Morgan Zeise 2/18/95). */ -int -w32_kbd_mods_to_emacs (DWORD mods, WORD key) -{ - int retval = 0; - - /* If we recognize right-alt and left-ctrl as AltGr, and it has been - pressed, first remove those modifiers. */ - if (!NILP (Vw32_recognize_altgr) - && (mods & (RIGHT_ALT_PRESSED | LEFT_CTRL_PRESSED)) - == (RIGHT_ALT_PRESSED | LEFT_CTRL_PRESSED)) - mods &= ~ (RIGHT_ALT_PRESSED | LEFT_CTRL_PRESSED); - - if (mods & (RIGHT_ALT_PRESSED | LEFT_ALT_PRESSED)) - retval = ((NILP (Vw32_alt_is_meta)) ? alt_modifier : meta_modifier); - - if (mods & (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED)) - { - retval |= ctrl_modifier; - if ((mods & (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED)) - == (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED)) - retval |= meta_modifier; - } - - if (mods & LEFT_WIN_PRESSED) - retval |= w32_key_to_modifier (VK_LWIN); - if (mods & RIGHT_WIN_PRESSED) - retval |= w32_key_to_modifier (VK_RWIN); - if (mods & APPS_PRESSED) - retval |= w32_key_to_modifier (VK_APPS); - if (mods & SCROLLLOCK_ON) - retval |= w32_key_to_modifier (VK_SCROLL); - - /* Just in case someone wanted the original behavior, make it - optional by setting w32-capslock-is-shiftlock to t. */ - if (NILP (Vw32_capslock_is_shiftlock) - /* Keys that should _not_ be affected by CapsLock. */ - && ( (key == VK_BACK) - || (key == VK_TAB) - || (key == VK_CLEAR) - || (key == VK_RETURN) - || (key == VK_ESCAPE) - || ((key >= VK_SPACE) && (key <= VK_HELP)) - || ((key >= VK_NUMPAD0) && (key <= VK_F24)) - || ((key >= VK_NUMPAD_CLEAR) && (key <= VK_NUMPAD_DELETE)) - )) - { - /* Only consider shift state. */ - if ((mods & SHIFT_PRESSED) != 0) - retval |= shift_modifier; - } - else - { - /* Ignore CapsLock state if not enabled. */ - if (NILP (Vw32_enable_caps_lock)) - mods &= ~CAPSLOCK_ON; - if ((mods & (SHIFT_PRESSED | CAPSLOCK_ON)) != 0) - retval |= shift_modifier; - } - - return retval; -} + #if 0 /* Return nonzero if the virtual key is a dead key. */ @@ -187,90 +130,7 @@ /* The return code indicates key code size. cpID is the codepage to use for translation to Unicode; -1 means use the current console input codepage. */ -int -w32_kbd_patch_key (KEY_EVENT_RECORD *event, int cpId) -{ - unsigned int key_code = event->wVirtualKeyCode; - unsigned int mods = event->dwControlKeyState; - BYTE keystate[256]; - static BYTE ansi_code[4]; - static int isdead = 0; - - if (isdead == 2) - { - event->uChar.AsciiChar = ansi_code[2]; - isdead = 0; - return 1; - } - if (event->uChar.AsciiChar != 0) - return 1; - - memset (keystate, 0, sizeof (keystate)); - keystate[key_code] = 0x80; - if (mods & SHIFT_PRESSED) - keystate[VK_SHIFT] = 0x80; - if (mods & CAPSLOCK_ON) - keystate[VK_CAPITAL] = 1; - /* If we recognize right-alt and left-ctrl as AltGr, set the key - states accordingly before invoking ToAscii. */ - if (!NILP (Vw32_recognize_altgr) - && (mods & LEFT_CTRL_PRESSED) && (mods & RIGHT_ALT_PRESSED)) - { - keystate[VK_CONTROL] = 0x80; - keystate[VK_LCONTROL] = 0x80; - keystate[VK_MENU] = 0x80; - keystate[VK_RMENU] = 0x80; - } - -#if 0 - /* Because of an OS bug, ToAscii corrupts the stack when called to - convert a dead key in console mode on NT4. Unfortunately, trying - to check for dead keys using MapVirtualKey doesn't work either - - these functions apparently use internal information about keyboard - layout which doesn't get properly updated in console programs when - changing layout (though apparently it gets partly updated, - otherwise ToAscii wouldn't crash). */ - if (is_dead_key (event->wVirtualKeyCode)) - return 0; -#endif - - /* On NT, call ToUnicode instead and then convert to the current - console input codepage. */ - if (os_subtype == OS_NT) - { - WCHAR buf[128]; - - isdead = ToUnicode (event->wVirtualKeyCode, event->wVirtualScanCode, - keystate, buf, 128, 0); - if (isdead > 0) - { - /* When we are called from the GUI message processing code, - we are passed the current keyboard codepage, a positive - number, to use below. */ - if (cpId == -1) - cpId = GetConsoleCP (); - - event->uChar.UnicodeChar = buf[isdead - 1]; - isdead = WideCharToMultiByte (cpId, 0, buf, isdead, - ansi_code, 4, NULL, NULL); - } - else - isdead = 0; - } - else - { - isdead = ToAscii (event->wVirtualKeyCode, event->wVirtualScanCode, - keystate, (LPWORD) ansi_code, 0); - } - - if (isdead == 0) - return 0; - event->uChar.AsciiChar = ansi_code[0]; - return isdead; -} - - -static int faked_key = 0; + /* return code -1 means that event_queue_ptr won't be incremented. In other word, this event makes two key codes. (by himi) */ @@ -531,32 +391,6 @@ return 1; } -int -w32_console_toggle_lock_key (int vk_code, Lisp_Object new_state) -{ - int cur_state = (GetKeyState (vk_code) & 1); - - if (NILP (new_state) - || (NUMBERP (new_state) - && ((XUINT (new_state)) & 1) != cur_state)) - { - faked_key = vk_code; - - keybd_event ((BYTE) vk_code, - (BYTE) MapVirtualKey (vk_code, 0), - KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0); - keybd_event ((BYTE) vk_code, - (BYTE) MapVirtualKey (vk_code, 0), - KEYEVENTF_EXTENDEDKEY | 0, 0); - keybd_event ((BYTE) vk_code, - (BYTE) MapVirtualKey (vk_code, 0), - KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0); - cur_state = !cur_state; - } - - return cur_state; -} - /* Mouse position hook. */ void w32_console_mouse_position (FRAME_PTR *f, === modified file 'src/w32menu.c' --- src/w32menu.c 2012-09-30 21:36:42 +0000 +++ src/w32menu.c 2012-10-07 22:31:58 +0000 @@ -21,7 +21,7 @@ #include #include -#include +#include #include "lisp.h" #include "keyboard.h" @@ -40,6 +40,14 @@ if this is not done before the other system files. */ #include "w32term.h" +/* Cygwin does not support the multibyte string functions declared in + * mbstring.h below --- but that's okay: because Cygwin is + * UNICODE-only, we don't need to use these functions anyway. */ + +#ifndef NTGUI_UNICODE +#include +#endif /* !NTGUI_UNICODE */ + /* Load sys/types.h if not already loaded. In some systems loading it twice is suicidal. */ #ifndef makedev @@ -78,10 +86,17 @@ IN WCHAR *caption, IN UINT type); +#ifdef NTGUI_UNICODE +#define get_menu_item_info GetMenuItemInfoA +#define set_menu_item_info SetMenuItemInfoA +#define unicode_append_menu AppendMenuW +#define unicode_message_box MessageBoxW +#else /* !NTGUI_UNICODE */ GetMenuItemInfoA_Proc get_menu_item_info = NULL; SetMenuItemInfoA_Proc set_menu_item_info = NULL; AppendMenuW_Proc unicode_append_menu = NULL; MessageBoxW_Proc unicode_message_box = NULL; +#endif /* NTGUI_UNICODE */ Lisp_Object Qdebug_on_next_call; @@ -98,6 +113,7 @@ static int fill_in_menu (HMENU, widget_value *); void w32_free_menu_strings (HWND); + /* This is set nonzero after the user activates the menu bar, and set @@ -1405,6 +1421,7 @@ nlen++; } } +#ifndef NTGUI_UNICODE else { /* If encoded with the system codepage, use multibyte string @@ -1415,6 +1432,7 @@ nlen++; } } +#endif /* !NTGUI_UNICODE */ if (nlen > orig_len) { @@ -1429,6 +1447,7 @@ *q++ = *p; *q++ = *p++; } +#ifndef NTGUI_UNICODE else { if (_mbsnextc (p) == '&') @@ -1440,6 +1459,7 @@ p = _mbsinc (p); q = _mbsinc (q); } +#endif /* !NTGUI_UNICODE */ } *q = '\0'; } @@ -1486,6 +1506,8 @@ item != NULL ? (UINT_PTR) item : (UINT_PTR) wv->call_data, utf16_string); + +#ifndef NTGUI_UNICODE /* Fallback does not apply when always UNICODE */ if (!return_value) { /* On W9x/ME, Unicode menus are not supported, though AppendMenuW @@ -1504,6 +1526,7 @@ if (osinfo_cache.dwPlatformId != VER_PLATFORM_WIN32_NT) unicode_append_menu = NULL; } +#endif /* NTGUI_UNICODE */ if (unicode_append_menu && (fuFlags & MF_OWNERDRAW)) local_free (out_string); @@ -1723,10 +1746,12 @@ void globals_of_w32menu (void) { +#ifndef NTGUI_UNICODE /* See if Get/SetMenuItemInfo functions are available. */ HMODULE user32 = GetModuleHandle ("user32.dll"); get_menu_item_info = (GetMenuItemInfoA_Proc) GetProcAddress (user32, "GetMenuItemInfoA"); set_menu_item_info = (SetMenuItemInfoA_Proc) GetProcAddress (user32, "SetMenuItemInfoA"); unicode_append_menu = (AppendMenuW_Proc) GetProcAddress (user32, "AppendMenuW"); unicode_message_box = (MessageBoxW_Proc) GetProcAddress (user32, "MessageBoxW"); +#endif /* !NTGUI_UNICODE */ } === modified file 'src/w32proc.c' --- src/w32proc.c 2012-10-05 11:19:58 +0000 +++ src/w32proc.c 2012-10-07 22:31:58 +0000 @@ -67,20 +67,6 @@ Lisp_Object Qhigh, Qlow; -#ifdef EMACSDEBUG -void -_DebPrint (const char *fmt, ...) -{ - char buf[1024]; - va_list args; - - va_start (args, fmt); - vsprintf (buf, fmt, args); - va_end (args); - OutputDebugString (buf); -} -#endif - typedef void (_CALLBACK_ *signal_handler) (int); /* Signal handlers...SIG_DFL == 0 so this is initialized correctly. */ === modified file 'src/w32select.c' --- src/w32select.c 2012-09-25 11:50:01 +0000 +++ src/w32select.c 2012-10-07 22:31:58 +0000 @@ -81,6 +81,11 @@ #include "coding.h" #include "composite.h" +#ifdef CYGWIN +#include +#include +#define _memccpy memccpy +#endif static HGLOBAL convert_to_handle_as_ascii (void); static HGLOBAL convert_to_handle_as_coded (Lisp_Object coding_system); === added file 'src/w32select.h' --- src/w32select.h 1970-01-01 00:00:00 +0000 +++ src/w32select.h 2012-09-17 11:57:03 +0000 @@ -0,0 +1,30 @@ +/* Selection processing for Emacs on the Microsoft W32 API. + +Copyright (C) 1993-1994, 2001-2011 Free Software Foundation, Inc. + +This file is part of GNU Emacs. + +GNU Emacs is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +GNU Emacs is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Emacs. If not, see . */ + +#ifndef W32SELECT_H +#define W32SELECT_H +#include + +#define HAVE_W32SELECT 1 + +extern void syms_of_w32select (void); +extern void globals_of_w32select (void); +extern void term_w32select (void); + +#endif === modified file 'src/w32term.c' --- src/w32term.c 2012-10-07 14:50:29 +0000 +++ src/w32term.c 2012-10-07 22:31:58 +0000 @@ -51,7 +51,14 @@ #include "atimer.h" #include "keymap.h" +#ifdef WINDOWSNT #include "w32heap.h" +#endif + +#ifndef WINDOWSNT +#include /* for get_osfhandle */ +#endif + #include #include "font.h" @@ -121,7 +128,7 @@ WCRANGE ranges[1]; } GLYPHSET; -#endif +#endif /* compiling for pre-Win2k */ /* Dynamic linking to SetLayeredWindowAttribute (only since 2000). */ BOOL (WINAPI *pfnSetLayeredWindowAttributes) (HWND, COLORREF, BYTE, DWORD); @@ -190,6 +197,13 @@ static int input_signal_count; #endif +#ifdef CYGWIN +int w32_message_fd = -1; +#endif /* CYGWIN */ + +/* Keyboard code page - may be changed by language-change events. */ +static int keyboard_codepage; + static void x_update_window_end (struct window *, int, int); static void w32_handle_tool_bar_click (struct frame *, struct input_event *); @@ -4163,18 +4177,26 @@ struct frame *f; struct w32_display_info *dpyinfo = &one_w32_display_info; Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; + static char buf[1]; block_input (); /* So people can tell when we have read the available input. */ input_signal_count++; + /* Process any incoming thread messages. */ + drain_message_queue (); + /* TODO: ghostscript integration. */ while (get_next_msg (&msg, FALSE)) { struct input_event inev; int do_help = 0; + /* DebPrint (("w32_read_socket: %s time:%u\n", */ + /* w32_name_of_message (msg.msg.message), */ + /* msg.msg.time)); */ + EVENT_INIT (inev); inev.kind = NO_EVENT; inev.arg = Qnil; @@ -6307,8 +6329,15 @@ w32_defined_color (0, "black", &color, 1); } - /* Add the default keyboard. */ +#ifdef WINDOWSNT + /* Add the default keyboard. When !WINDOWSNT, we're using the + standard Emacs console handling machinery and don't need an + explicit FD here. */ add_keyboard_wait_descriptor (0); +#elif CYGWIN + /* /dev/windows wakes us up when we have a thread message pending. */ + add_keyboard_wait_descriptor (w32_message_fd); +#endif /* Create Fringe Bitmaps and store them for later use. @@ -6319,15 +6348,6 @@ the bitmaps. */ w32_init_fringe (terminal->rif); -#ifdef F_SETOWN - fcntl (connection, F_SETOWN, getpid ()); -#endif /* ! defined (F_SETOWN) */ - -#ifdef SIGIO - if (interrupt_input) - init_sigio (connection); -#endif /* ! defined (SIGIO) */ - unblock_input (); return dpyinfo; @@ -6377,6 +6397,7 @@ w32_reset_fringes (); } + /* Set up use of W32. */ @@ -6414,6 +6435,11 @@ set_user_model (L"GNU.Emacs"); } +#ifdef CYGWIN + if ((w32_message_fd = open ("/dev/windows", O_RDWR | O_CLOEXEC)) == -1) + fatal ("opening /dev/windows: %s", strerror (errno)); +#endif /* CYGWIN */ + /* Initialize w32_use_visible_system_caret based on whether a screen reader is in use. */ if (!SystemParametersInfo (SPI_GETSCREENREADER, 0, @@ -6574,4 +6600,6 @@ staticpro (&last_mouse_motion_frame); last_mouse_motion_frame = Qnil; + + Fprovide (intern_c_string ("w32"), Qnil); } === modified file 'src/w32term.h' --- src/w32term.h 2012-09-30 21:52:49 +0000 +++ src/w32term.h 2012-10-07 22:31:58 +0000 @@ -19,6 +19,8 @@ /* Added by Kevin Gallo */ #include "w32gui.h" +#include "frame.h" +#include "atimer.h" #define BLACK_PIX_DEFAULT(f) PALETTERGB(0,0,0) @@ -195,11 +197,45 @@ Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); +extern void x_focus_on_frame (struct frame *f); + +/* also defined in xterm.h XXX: factor out to common header */ + extern struct w32_display_info *w32_term_init (Lisp_Object, char *, char *); - +extern void check_w32 (void); +extern int w32_defined_color (FRAME_PTR f, const char *color, + XColor *color_def, int alloc); +extern void x_set_window_size (struct frame *f, int change_grav, + int cols, int rows); extern int x_display_pixel_height (struct w32_display_info *); extern int x_display_pixel_width (struct w32_display_info *); +extern void x_sync (struct frame *); +extern Lisp_Object x_get_focus_frame (struct frame *); +extern void x_set_mouse_position (struct frame *f, int h, int v); +extern void x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y); +extern void x_make_frame_visible (struct frame *f); +extern void x_make_frame_invisible (struct frame *f); +extern void x_iconify_frame (struct frame *f); +extern int x_char_width (struct frame *f); +extern int x_char_height (struct frame *f); +extern int x_pixel_width (struct frame *f); +extern int x_pixel_height (struct frame *f); +extern void x_set_frame_alpha (struct frame *f); +extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object); +extern void x_set_tool_bar_lines (struct frame *f, + Lisp_Object value, + Lisp_Object oldval); +extern void x_activate_menubar (struct frame *); +extern int x_bitmap_icon (struct frame *, Lisp_Object); +extern void initialize_frame_menubar (struct frame *); +extern void x_free_frame_resources (struct frame *); +extern void x_real_positions (struct frame *, int *, int *); + +/* w32inevt.c */ +extern int w32_kbd_patch_key (KEY_EVENT_RECORD *event, int cpId); +extern int w32_kbd_mods_to_emacs (DWORD mods, WORD key); + extern Lisp_Object x_get_focus_frame (struct frame *); @@ -583,8 +619,9 @@ #define WM_EMACS_HIDE_CARET (WM_EMACS_START + 18) #define WM_EMACS_SETCURSOR (WM_EMACS_START + 19) #define WM_EMACS_PAINT (WM_EMACS_START + 20) -#define WM_EMACS_BRINGTOTOP (WM_EMACS_START + 21) -#define WM_EMACS_END (WM_EMACS_START + 22) +#define WM_EMACS_BRINGTOTOP (WM_EMACS_START + 22) +#define WM_EMACS_INPUT_READY (WM_EMACS_START + 23) +#define WM_EMACS_END (WM_EMACS_START + 24) #define WND_FONTWIDTH_INDEX (0) #define WND_LINEHEIGHT_INDEX (4) @@ -606,6 +643,8 @@ RECT rect; } W32Msg; +extern BOOL prepend_msg (W32Msg *lpmsg); + /* Structure for recording message when input thread must return a result that depends on lisp thread to compute. Lisp thread can complete deferred messages out of order. */ @@ -709,3 +748,19 @@ extern int w32_system_caret_height; extern int w32_system_caret_x; extern int w32_system_caret_y; + +#if EMACSDEBUG +extern const char* +w32_name_of_message (UINT msg); +#endif /* EMACSDEBUG */ + +extern void syms_of_w32term (void); +extern void syms_of_w32menu (void); +extern void syms_of_w32fns (void); + +extern void globals_of_w32menu (void); +extern void globals_of_w32fns (void); + +#ifdef CYGWIN +extern int w32_message_fd; +#endif /* CYGWIN */ === modified file 'src/w32xfns.c' --- src/w32xfns.c 2012-09-19 06:47:01 +0000 +++ src/w32xfns.c 2012-10-07 22:31:58 +0000 @@ -19,6 +19,7 @@ #include #include #include + #include "lisp.h" #include "keyboard.h" #include "frame.h" @@ -32,7 +33,11 @@ #define myfree(lp) GlobalFreePtr (lp) CRITICAL_SECTION critsect; + +#ifdef WINDOWSNT extern HANDLE keyboard_handle; +#endif /* WINDOWSNT */ + HANDLE input_available = NULL; HANDLE interrupt_handle = NULL; @@ -43,7 +48,11 @@ /* For safety, input_available should only be reset by get_next_msg when the input queue is empty, so make it a manual reset event. */ - keyboard_handle = input_available = CreateEvent (NULL, TRUE, FALSE, NULL); + input_available = CreateEvent (NULL, TRUE, FALSE, NULL); + +#ifdef WINDOWSNT + keyboard_handle = input_available; +#endif /* WINDOWSNT */ /* interrupt_handle is signaled when quit (C-g) is detected, so that blocking system calls can be interrupted. We make it a manual @@ -240,6 +249,22 @@ return (bRet); } +extern char * w32_strerror (int error_no); + +/* Tell the main thread that we have input available; if the main + thread is blocked in select(), we wake it up here. */ +static void +notify_msg_ready (void) +{ + SetEvent (input_available); + +#ifdef CYGWIN + /* Wakes up the main thread, which is blocked select()ing for /dev/windows, + among other files. */ + (void) PostThreadMessage (dwMainThreadId, WM_EMACS_INPUT_READY, 0, 0); +#endif /* CYGWIN */ +} + BOOL post_msg (W32Msg * lpmsg) { @@ -263,8 +288,7 @@ } lpTail = lpNew; - SetEvent (input_available); - + notify_msg_ready (); leave_crit (); return (TRUE); @@ -285,7 +309,7 @@ nQueue++; lpNew->lpNext = lpHead; lpHead = lpNew; - + notify_msg_ready (); leave_crit (); return (TRUE); === modified file 'src/window.c' --- src/window.c 2012-10-01 06:36:54 +0000 +++ src/window.c 2012-10-07 22:31:58 +0000 @@ -43,7 +43,7 @@ #ifdef HAVE_X_WINDOWS #include "xterm.h" #endif /* HAVE_X_WINDOWS */ -#ifdef WINDOWSNT +#ifdef HAVE_NTGUI #include "w32term.h" #endif #ifdef MSDOS === modified file 'src/xdisp.c' --- src/xdisp.c 2012-10-01 07:03:04 +0000 +++ src/xdisp.c 2012-10-07 22:31:58 +0000 @@ -302,7 +302,7 @@ #ifdef HAVE_X_WINDOWS #include "xterm.h" #endif -#ifdef WINDOWSNT +#ifdef HAVE_NTGUI #include "w32term.h" #endif #ifdef HAVE_NS === modified file 'src/xfaces.c' --- src/xfaces.c 2012-10-01 06:36:54 +0000 +++ src/xfaces.c 2012-10-07 22:31:58 +0000 @@ -227,13 +227,13 @@ #ifdef HAVE_WINDOW_SYSTEM #include TERM_HEADER #include "fontset.h" -#ifdef WINDOWSNT +#ifdef HAVE_NTGUI #undef FRAME_X_DISPLAY_INFO #define FRAME_X_DISPLAY_INFO FRAME_W32_DISPLAY_INFO #define x_display_info w32_display_info #define check_x check_w32 #define GCGraphicsExposures 0 -#endif /* WINDOWSNT */ +#endif /* HAVE_NTGUI */ #ifdef HAVE_NS #undef FRAME_X_DISPLAY_INFO @@ -625,7 +625,7 @@ #endif /* HAVE_X_WINDOWS */ -#ifdef WINDOWSNT +#ifdef HAVE_NTGUI /* W32 emulation of GCs */ static GC @@ -649,7 +649,7 @@ xfree (gc); } -#endif /* WINDOWSNT */ +#endif /* HAVE_NTGUI */ #ifdef HAVE_NS /* NS emulation of GCs */ @@ -719,7 +719,7 @@ #ifdef HAVE_X_WINDOWS if (!FRAME_X_P (f) || FRAME_X_WINDOW (f)) #endif -#ifdef WINDOWSNT +#ifdef HAVE_NTGUI if (!FRAME_WINDOW_P (f) || FRAME_W32_WINDOW (f)) #endif #ifdef HAVE_NS @@ -1098,7 +1098,7 @@ else if (FRAME_X_P (f)) return x_defined_color (f, color_name, color_def, alloc); #endif -#ifdef WINDOWSNT +#ifdef HAVE_NTGUI else if (FRAME_W32_P (f)) return w32_defined_color (f, color_name, color_def, alloc); #endif @@ -3245,7 +3245,7 @@ param = Qbackground_color; } #ifdef HAVE_WINDOW_SYSTEM -#ifndef WINDOWSNT +#ifndef HAVE_NTGUI else if (EQ (face, Qscroll_bar)) { /* Changing the colors of `scroll-bar' sets frame parameters @@ -3255,7 +3255,7 @@ else if (EQ (attr, QCbackground)) param = Qscroll_bar_background; } -#endif /* not WINDOWSNT */ +#endif /* not HAVE_NTGUI */ else if (EQ (face, Qborder)) { /* Changing background color of `border' sets frame parameter @@ -6362,7 +6362,7 @@ if (num >= 0 && name[num] == '\n') name[num] = 0; cmap = Fcons (Fcons (build_string (name), -#ifdef WINDOWSNT +#ifdef HAVE_NTGUI make_number (RGB (red, green, blue))), #else make_number ((red << 16) | (green << 8) | blue)), ------------------------------------------------------------ revno: 110443 fixes bug: http://debbugs.gnu.org/12599 committer: Glenn Morris branch nick: trunk timestamp: Mon 2012-10-08 00:47:23 -0700 message: Fix for url-https.el neing merged into url-http.el * lisp/url/url-methods.el (url-scheme-get-property): url-https.el was merged into url-http.el, so load the latter for https. diff: === modified file 'lisp/url/ChangeLog' --- lisp/url/ChangeLog 2012-10-02 03:48:01 +0000 +++ lisp/url/ChangeLog 2012-10-08 07:47:23 +0000 @@ -1,3 +1,8 @@ +2012-10-08 Glenn Morris + + * url-methods.el (url-scheme-get-property): url-https.el was + merged into url-http.el, so load the latter for https. (Bug#12599) + 2012-10-02 Stefan Monnier * url-http.el (url-http-user-agent-string): Leak less info. === modified file 'lisp/url/url-methods.el' --- lisp/url/url-methods.el 2012-09-17 05:41:04 +0000 +++ lisp/url/url-methods.el 2012-10-08 07:47:23 +0000 @@ -118,7 +118,9 @@ (let* ((stub (concat "url-" scheme)) (loader (intern stub))) (condition-case () - (require loader) + ;; url-https.el was merged into url-http because of 8+3 + ;; filename limitations, so we have to do this dance. + (require (if (equal "https" scheme) 'url-http loader)) (error nil)) (if (fboundp loader) (progn ------------------------------------------------------------ revno: 110442 committer: Glenn Morris branch nick: trunk timestamp: Mon 2012-10-08 00:23:49 -0700 message: Trivial NEWS copyedits diff: === modified file 'etc/NEWS' --- etc/NEWS 2012-10-08 07:18:02 +0000 +++ etc/NEWS 2012-10-08 07:23:49 +0000 @@ -708,7 +708,7 @@ *** `compile-internal' *** `mode-line-inverse-video' *** `cvs-commit-buffer-require-final-newline' -(use `'log-edit-require-final-newline'instead) +(use `log-edit-require-final-newline' instead) *** `cvs-changelog-full-paragraphs' (use `log-edit-changelog-full-paragraphs' instead) *** `cvs-diff-ignore-marks', `cvs-diff-buffer-name' @@ -837,7 +837,7 @@ result in a warning ("Eager macro-expansion skipped due to cycle") describing the cycle. -** Misc new functions: +** Miscellaneous new functions: *** `autoloadp' *** `autoload-do-load'. ------------------------------------------------------------ revno: 110441 committer: Glenn Morris branch nick: trunk timestamp: Mon 2012-10-08 00:18:02 -0700 message: * lisp/cus-start.el (message-log-max): Set :version. * etc/NEWS: No need to mention a simple customization option whose default has changed, since the :version tag does that. diff: === modified file 'etc/NEWS' --- etc/NEWS 2012-10-08 07:10:21 +0000 +++ etc/NEWS 2012-10-08 07:18:02 +0000 @@ -165,8 +165,6 @@ of the fatal signal, and a short backtrace on platforms like glibc that support backtraces. -** `message-log-max' now defaults to 1000, not 100. - --- ** If your Emacs was built from a bzr checkout, the new variable `emacs-bzr-version' contains information about the bzr revision used. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-10-08 07:05:21 +0000 +++ lisp/ChangeLog 2012-10-08 07:18:02 +0000 @@ -1,5 +1,7 @@ 2012-10-08 Glenn Morris + * cus-start.el (message-log-max): Set :version. + * calendar/calendar.el (calendar-intermonth-header): Doc fix. 2012-10-08 Martin Rudalics === modified file 'lisp/cus-start.el' --- lisp/cus-start.el 2012-09-25 04:13:02 +0000 +++ lisp/cus-start.el 2012-10-08 07:18:02 +0000 @@ -452,7 +452,8 @@ (message-log-max debug (choice (const :tag "Disable" nil) (integer :menu-tag "lines" :format "%v") - (other :tag "Unlimited" t))) + (other :tag "Unlimited" t)) + "24.3") (unibyte-display-via-language-environment mule boolean) (blink-cursor-alist cursor alist "22.1") (overline-margin display integer "22.1") ------------------------------------------------------------ revno: 110440 committer: Glenn Morris branch nick: trunk timestamp: Mon 2012-10-08 00:10:21 -0700 message: Trivial NEWS copyedits diff: === modified file 'etc/NEWS' --- etc/NEWS 2012-10-08 07:06:36 +0000 +++ etc/NEWS 2012-10-08 07:10:21 +0000 @@ -23,18 +23,36 @@ * Installation Changes in Emacs 24.3 +--- +** The default toolkit has been changed to Gtk+ version 3. +If you don't pass --with-x-toolkit to configure or if you pass +--with-x-toolkit=gtk or --with-x-toolkit=yes, configure will try to build +with Gtk+ version 3, and if that fails, try Gtk+ version 2. +You can explicitly require a specific version by passing +--with-x-toolkit=gtk2 or --with-x-toolkit=gtk3 to configure. + +--- ** New configure option '--without-all' to disable additional features. This disables most of the features that are normally enabled by default. +--- ** New configure option '--enable-link-time-optimization' to utilize an appropriate feature provided by GCC since version 4.5.0. +--- ** New configure option '--enable-gcc-warnings', intended for developers. If building with GCC, this enables compile-time checks that warn about possibly-questionable C code. On a recent GNU system there should be no warnings; on older and on non-GNU systems the generated warnings may be useful. +--- +** The configuration option '--enable-use-lisp-union-type' has been +renamed to '--enable-check-lisp-object-type', as the resulting +Lisp_Object type no longer uses a union to implement the compile time +check that this option enables. + +--- ** The configure option '--disable-maintainer-mode' has been removed, as it was confusingly-named and rarely useful. @@ -60,19 +78,6 @@ (from the bin and libexec directories, respectively). The former is no longer relevant, the latter is replaced by lisp (in vc-sccs.el). -** The configuration option '--enable-use-lisp-union-type' has been -renamed to '--enable-check-lisp-object-type', as the resulting -Lisp_Object type no longer uses a union to implement the compile time -check that this option enables. - ---- -** The default toolkit has been changed to Gtk+ version 3. -If you don't pass --with-x-toolkit to configure or if you pass ---with-x-toolkit=gtk or --with-x-toolkit=yes, configure will try to build -with Gtk+ version 3, and if that fails, try Gtk+ version 2. -You can explicitly require a specific version by passing ---with-x-toolkit=gtk2 or --with-x-toolkit=gtk3 to configure. - * Startup Changes in Emacs 24.3 ------------------------------------------------------------ revno: 110439 committer: Glenn Morris branch nick: trunk timestamp: Mon 2012-10-08 00:06:36 -0700 message: Document calendar-month-header * doc/emacs/cal-xtra.texi (Calendar Customizing): Mention calendar-month-header. * etc/NEWS: Related edit. diff: === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2012-10-08 07:00:24 +0000 +++ doc/emacs/ChangeLog 2012-10-08 07:06:36 +0000 @@ -1,5 +1,7 @@ 2012-10-08 Glenn Morris + * cal-xtra.texi (Calendar Customizing): Mention calendar-month-header. + * calendar.texi (Writing Calendar Files): Mention cal-html-holidays. 2012-10-06 Glenn Morris === modified file 'doc/emacs/cal-xtra.texi' --- doc/emacs/cal-xtra.texi 2012-09-27 06:51:35 +0000 +++ doc/emacs/cal-xtra.texi 2012-10-08 07:06:36 +0000 @@ -41,6 +41,11 @@ customize the variables @code{calendar-intermonth-header} and @code{calendar-intermonth-text} as described in their documentation. +@vindex calendar-month-header + The variable @code{calendar-month-header} controls the text that +appears above each month in the calendar. By default, it shows the +month and year. + @vindex calendar-holiday-marker @vindex diary-entry-marker @vindex calendar-today-marker === modified file 'etc/NEWS' --- etc/NEWS 2012-10-08 07:00:24 +0000 +++ etc/NEWS 2012-10-08 07:06:36 +0000 @@ -280,6 +280,7 @@ ** Calendar ++++ *** You can customize the header text that appears above each calendar month. See the variable `calendar-month-header'. ------------------------------------------------------------ revno: 110438 committer: Glenn Morris branch nick: trunk timestamp: Mon 2012-10-08 00:05:21 -0700 message: * lisp/calendar/calendar.el (calendar-intermonth-header): Doc fix. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-10-08 06:42:29 +0000 +++ lisp/ChangeLog 2012-10-08 07:05:21 +0000 @@ -1,3 +1,7 @@ +2012-10-08 Glenn Morris + + * calendar/calendar.el (calendar-intermonth-header): Doc fix. + 2012-10-08 Martin Rudalics * emacs-lisp/edebug.el (edebug-pop-to-buffer): Don't try to split === modified file 'lisp/calendar/calendar.el' --- lisp/calendar/calendar.el 2012-10-06 18:34:23 +0000 +++ lisp/calendar/calendar.el 2012-10-08 07:05:21 +0000 @@ -511,7 +511,7 @@ :version "23.1") (defcustom calendar-intermonth-header nil - "Header text display in the space to the left of each calendar month. + "Header text to display in the space to the left of each calendar month. See `calendar-intermonth-text'." :group 'calendar :initialize 'custom-initialize-default ------------------------------------------------------------ revno: 110437 committer: Glenn Morris branch nick: trunk timestamp: Mon 2012-10-08 00:00:24 -0700 message: Document cal-html-holidays * doc/emacs/calendar.texi (Writing Calendar Files): Mention cal-html-holidays. * etc/NEWS: Related edit. diff: === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2012-10-06 18:34:23 +0000 +++ doc/emacs/ChangeLog 2012-10-08 07:00:24 +0000 @@ -1,3 +1,7 @@ +2012-10-08 Glenn Morris + + * calendar.texi (Writing Calendar Files): Mention cal-html-holidays. + 2012-10-06 Glenn Morris * calendar.texi (Writing Calendar Files): Tweak week descriptions. === modified file 'doc/emacs/calendar.texi' --- doc/emacs/calendar.texi 2012-10-06 18:34:23 +0000 +++ doc/emacs/calendar.texi 2012-10-08 07:00:24 +0000 @@ -349,11 +349,12 @@ @cindex calendar and HTML The Calendar HTML commands produce files of HTML code that contain -calendar and diary entries. Each file applies to one month, and has a -name of the format @file{@var{yyyy}-@var{mm}.html}, where @var{yyyy} and -@var{mm} are the four-digit year and two-digit month, respectively. The -variable @code{cal-html-directory} specifies the default output -directory for the HTML files. +calendar, holiday, and diary entries. Each file applies to one month, +and has a name of the format @file{@var{yyyy}-@var{mm}.html}, where +@var{yyyy} and @var{mm} are the four-digit year and two-digit month, +respectively. The variable @code{cal-html-directory} specifies the +default output directory for the HTML files. To prevent holidays +from being shown, customize @code{cal-html-holidays}. @vindex cal-html-css-default Diary entries enclosed by @code{<} and @code{>} are interpreted as === modified file 'etc/NEWS' --- etc/NEWS 2012-10-07 10:07:23 +0000 +++ etc/NEWS 2012-10-08 07:00:24 +0000 @@ -286,8 +286,9 @@ +++ *** New LaTeX calendar style, produced by `cal-tex-cursor-week2-summary'. ++++ *** The calendars produced by cal-html include holidays. -Customize cal-html-holidays to change this. +Customize `cal-html-holidays' to change this. ** CL ------------------------------------------------------------ revno: 110436 committer: Glenn Morris branch nick: trunk timestamp: Sun 2012-10-07 23:58:36 -0700 message: Fix ChangeLog typo diff: === modified file 'lisp/cedet/ChangeLog' --- lisp/cedet/ChangeLog 2012-10-07 18:23:50 +0000 +++ lisp/cedet/ChangeLog 2012-10-08 06:58:36 +0000 @@ -3,15 +3,11 @@ * semantic/wisent/python.el (semantic-ctxt-current-function) (semantic-ctxt-current-assignment): New overrides, simply returning nil. The defaults do not work correctly and can send - the parser in an inifinite loop (bug#12458). - -2012-10-07 David Engster + the parser in an infinite loop (bug#12458). * semantic/ede-grammar.el (project-compile-target): Fix grammar compilation after introduction of %provide statement. -2012-10-07 David Engster - * semantic.el (semantic-new-buffer-setup-functions): Remove setup function for `f90-mode', since the parser only exists upstream. ------------------------------------------------------------ Use --include-merged or -n0 to see merged revisions.