unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Daniel Colascione <dancol@dancol.org>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH 3/4] Implement cygw32
Date: Thu, 29 Dec 2011 19:29:42 +0200	[thread overview]
Message-ID: <83oburuvzt.fsf@gnu.org> (raw)
In-Reply-To: <5624badc7ef2eea96f90da1a823144757a5f0290.1325166472.git.dancol@dancol.org>

> Date: Thu, 29 Dec 2011 06:03:20 -0800
> From: Daniel Colascione <dancol@dancol.org>
> 
> --- a/lisp/faces.el
> +++ b/lisp/faces.el
> @@ -89,7 +89,7 @@ ALTERNATIVE2 etc."
>  ;; 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")

Why not use window-system (the function) here?

> --- a/lisp/frame.el
> +++ b/lisp/frame.el
> @@ -522,7 +522,7 @@ The optional argument PARAMETERS specifies additional frame parameters."
>  	   (ns-initialize-window-system))
>  	 (make-frame `((window-system . ns)
>  		       (display . ,display) . ,parameters)))
> -	((eq system-type 'windows-nt)
> +	((eq window-system 'w32)
>  	 ;; On Windows, ignore DISPLAY.
>  	 (make-frame parameters))
>  	(t

Why not window-system the function?  You do want to continue
supporting multi-tty in this configuration, right?

> --- a/lisp/international/mule-cmds.el
> +++ b/lisp/international/mule-cmds.el
> @@ -2655,7 +2655,8 @@ See also `locale-charset-language-names', `locale-language-names',
>      ;; 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))))

Can you explain the need for this change?

> --- a/lisp/loadup.el
> +++ b/lisp/loadup.el
> @@ -207,15 +207,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 "w32-vars")
>        (load "term/common-win")
> +      (load "w32-vars")

Did you really need this order change?  If yes, why?  If not, I'd
prefer to leave the original order, as changing it could potentially
cause unintended consequences.

>        (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"))))

Likewise here: at the very least, keep the order in the group of
packages loaded for windows-nt.

> --- a/lisp/mouse.el
> +++ b/lisp/mouse.el
> @@ -1147,7 +1147,7 @@ regardless of where you click."
>    (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

You mean, the Cygwin build that uses w32 windowing will be unable to
support X selections?  That would be a pity.

> +(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)))

What is the default value of default-file-name-coding-system in the
Cygwin build?  There could be a conflict here between e.g. UTF-8 in
Cygwin and the Windows codepage.

Also, it would be good to have a doc string for this function.

> +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);
> +}

These two should probably be documented in the ELisp manual.

>  	  char buffer[16];
> -	  _snprintf (buffer, 16, "%d", system_status.BatteryLifePercent);
> +	  snprintf (buffer, 16, "%d", system_status.BatteryLifePercent);
>  	  load_percentage = build_string (buffer);

If you want to use snprintf without the leading underscore, please add
a suitable #define somewhere for the benefit of the MSVC compiler,
which doesn't have snprintf, only _snprintf.

Btw, will the above code be used by the Cygwin build?  Does that
include default-printer-name etc.?



  reply	other threads:[~2011-12-29 17:29 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-29 14:03 [PATCH 0/4] Support Win32 GUI in Cygwin Emacs Daniel Colascione
2011-12-29 14:03 ` [PATCH 3/4] Implement cygw32 Daniel Colascione
2011-12-29 17:29   ` Eli Zaretskii [this message]
2011-12-29 17:53     ` Daniel Colascione
2011-12-29 18:17       ` Eli Zaretskii
2011-12-29 21:50         ` Daniel Colascione
2011-12-30  0:56           ` Jason Rumney
2011-12-30  9:23           ` Eli Zaretskii
2011-12-30  9:36             ` Daniel Colascione
2011-12-30 11:16               ` Eli Zaretskii
2011-12-30  9:49   ` Andreas Schwab
2011-12-29 14:03 ` [PATCH 2/4] Refactor window-system configuration Daniel Colascione
2011-12-29 22:21   ` Dan Nicolaescu
2011-12-29 22:29     ` Daniel Colascione
2011-12-29 22:43       ` Dan Nicolaescu
2011-12-29 22:48         ` Daniel Colascione
2011-12-29 23:05           ` Dan Nicolaescu
2011-12-29 23:08             ` Daniel Colascione
2011-12-30  8:54             ` Eli Zaretskii
2011-12-30  9:07               ` Daniel Colascione
2011-12-30  9:44                 ` Eli Zaretskii
2011-12-30  0:53       ` Stefan Monnier
2011-12-30  8:21       ` Eli Zaretskii
2011-12-30  8:26         ` Daniel Colascione
2011-12-30  9:38           ` Eli Zaretskii
2011-12-30  9:45             ` Daniel Colascione
2011-12-30 11:15             ` Stefan Monnier
2011-12-30  8:19     ` Eli Zaretskii
2011-12-29 14:03 ` [PATCH 1/4] Compilation cleanups Daniel Colascione
2011-12-29 17:54   ` Paul Eggert
2011-12-31 14:50     ` Ken Brown
2011-12-31 20:29       ` Paul Eggert
2011-12-29 14:03 ` [PATCH 4/4] Fix emacsclient to work with cygw32 Daniel Colascione
2011-12-29 16:28   ` Juanma Barranquero
2011-12-29 16:36     ` Daniel Colascione
2011-12-29 16:43       ` Juanma Barranquero
2011-12-29 16:47         ` Daniel Colascione
2011-12-29 16:49           ` Juanma Barranquero
2011-12-29 17:39   ` Eli Zaretskii
2011-12-29 17:56     ` Daniel Colascione
2011-12-29 18:18       ` Eli Zaretskii
2011-12-29 18:53         ` Juanma Barranquero

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83oburuvzt.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=dancol@dancol.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).