From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Antipov Newsgroups: gmane.emacs.devel Subject: [PATCH] window-system-version function Date: Tue, 15 Nov 2011 20:29:00 +0400 Message-ID: <4EC2934C.1030206@yandex.ru> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------020406080806040200040202" X-Trace: dough.gmane.org 1321374540 3638 80.91.229.12 (15 Nov 2011 16:29:00 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 15 Nov 2011 16:29:00 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 15 17:28:56 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RQLsV-0001F1-Iu for ged-emacs-devel@m.gmane.org; Tue, 15 Nov 2011 17:28:55 +0100 Original-Received: from localhost ([::1]:40515 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RQLsU-0002rA-RJ for ged-emacs-devel@m.gmane.org; Tue, 15 Nov 2011 11:28:54 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:42562) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RQLsR-0002qu-J5 for emacs-devel@gnu.org; Tue, 15 Nov 2011 11:28:52 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RQLsP-0003dJ-Py for emacs-devel@gnu.org; Tue, 15 Nov 2011 11:28:51 -0500 Original-Received: from mail.dev.rtsoft.ru ([213.79.90.226]:45314) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1RQLsP-0003cd-6q for emacs-devel@gnu.org; Tue, 15 Nov 2011 11:28:49 -0500 Original-Received: (qmail 12580 invoked from network); 15 Nov 2011 16:28:46 -0000 Original-Received: from unknown (HELO ?192.168.5.146?) (192.168.1.70) by 0 with SMTP; 15 Nov 2011 16:28:46 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0) Gecko/20110927 Thunderbird/7.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 213.79.90.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:146042 Archived-At: This is a multi-part message in MIME format. --------------020406080806040200040202 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit This patch replaces global variable 'window-system-version' with the function which returns the window system version for the specified frame. I believe this is more reasonable, at least for the configuration which allows both TTY and X frames. Dmitry P.S. Are there the reasons to have both 'window-system' variable and function (except the possible backward compatibility with an old Lisp code)? --------------020406080806040200040202 Content-Type: text/plain; name="window_system_version.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="window_system_version.patch" PT09IG1vZGlmaWVkIGZpbGUgJ2xpc3AvaW50ZXJuYXRpb25hbC9tdWxlLWRpYWcuZWwnCi0t LSBsaXNwL2ludGVybmF0aW9uYWwvbXVsZS1kaWFnLmVsCTIwMTEtMTEtMTQgMDY6Mjc6MTIg KzAwMDAKKysrIGxpc3AvaW50ZXJuYXRpb25hbC9tdWxlLWRpYWcuZWwJMjAxMS0xMS0xNSAx NDo0NTowNiArMDAwMApAQCAtMTEwNSw3ICsxMTA1LDcgQEAKICAgICAgIChpbnNlcnQtc2Vj dGlvbiAyICJEaXNwbGF5IikKICAgICAgIChpZiB3aW5kb3ctc3lzdGVtCiAJICAoaW5zZXJ0 IChmb3JtYXQgIldpbmRvdy1zeXN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