From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: [mentoring-done] a darkroom/writeroom mode for Emacs Date: Mon, 15 Dec 2014 16:28:06 +0100 Message-ID: <548EFE06.7010605@gmx.at> References: <20141203142859.24393.98673@vcs.savannah.gnu.org> <83y4qm2uz9.fsf@gnu.org> <83vblq2los.fsf@gnu.org> <87vblpjq24.fsf@uwakimon.sk.tsukuba.ac.jp> <83mw7119yz.fsf@gnu.org> <87sigqiaaz.fsf@gmx.us> <878uihhv5q.fsf@gmx.us> <87bnnczcjg.fsf@gmx.us> <87bnna11ez.fsf@pank.eu> <87wq5xxe6g.fsf@gmx.us> <548EDFC5.7070209@gmx.at> <548EECF9.5000302@gmx.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1418657322 11207 80.91.229.3 (15 Dec 2014 15:28:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 15 Dec 2014 15:28:42 +0000 (UTC) Cc: Rasmus , emacs-devel@gnu.org To: =?ISO-8859-15?Q?Jo=E3o_T=E1vora?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 15 16:28:34 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Y0XZZ-0004Vs-K6 for ged-emacs-devel@m.gmane.org; Mon, 15 Dec 2014 16:28:33 +0100 Original-Received: from localhost ([::1]:40281 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0XZZ-0001rU-4H for ged-emacs-devel@m.gmane.org; Mon, 15 Dec 2014 10:28:33 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43320) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0XZN-0001kR-OI for emacs-devel@gnu.org; Mon, 15 Dec 2014 10:28:29 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y0XZD-0000ie-Vz for emacs-devel@gnu.org; Mon, 15 Dec 2014 10:28:21 -0500 Original-Received: from mout.gmx.net ([212.227.15.15]:58447) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0XZD-0000iU-KT for emacs-devel@gnu.org; Mon, 15 Dec 2014 10:28:11 -0500 Original-Received: from [88.117.118.79] ([88.117.118.79]) by mail.gmx.com (mrgmx003) with ESMTPSA (Nemesis) id 0M7YF5-1XljqQ0KZD-00xKPH; Mon, 15 Dec 2014 16:28:09 +0100 In-Reply-To: X-Provags-ID: V03:K0:PjVOHBdMko8dyfADBfBeSsMgGmaOaMgVlFPpqMN2D+7eBw4s//9 K9dRW4Ga8mMmNaKERHR565FZ2FmaF2rwuyea1hF8kwnP8EKejGMi93R4TapS2Lb4sbTd2Mt rv7jNFLdZXL0Ob1Hye5kF17XAvcrYMtDhkkV2cO04Z8crLom9wyXUpoy39RG9vleubILFqV f39QCBKpPGZzNrtpfi38w== X-UI-Out-Filterresults: notjunk:1; X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 212.227.15.15 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:180155 Archived-At: > Yes I got it: I can collect pixelwise statistics about the line > lengths and then use window width. (with one problem I can circumvent: > window-width does not count *existing* margins). You can always get the margins of a window via (window-margins). Multiply the result with (frame-char-width) and you get the pixels (beware of a nil return value). > But to do comparisons with column based variables like `fill-column', `fill-column' might be a problem, indeed. Do you really need it? > I > still need the character (assumed fixed) pixel width, which I need to > extract like this. > > (window-text-pixel-size (selected-window) > (point-min) (1+ (point-min))) This will fail miserably with variable character widths. > This fails for empty buffers, but that case is negligible anyway. > > The code is much cleaner now, so thanks. > > Anyway, its a bit confusing that `window-width' can't take the font size > in consideration, while `window-text-pixel-size' can. It can't. Nobody can, so far ... Eli might fix this eventually. > Though it probably > makes sense since a window can display chars of many widths. But then > using it without PIXELWISE should be deprecated. For a human being it's easier to think in terms of columns rather than in pixels. > It might *become* its intent, if you wish to explain what you had in > mind. I only thought that if you add/remove characters to/from the longest line you might also consider recentering the entire text on the fly. martin