From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: joaotavora@gmail.com (=?utf-8?B?Sm/Do28gVMOhdm9yYQ==?=) Newsgroups: gmane.emacs.devel Subject: Re: [mentoring-done] a darkroom/writeroom mode for Emacs Date: Mon, 15 Dec 2014 22:10:29 +0000 Message-ID: References: <20141203142859.24393.98673@vcs.savannah.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> <548EFE06.7010605@gmx.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1418681454 20599 80.91.229.3 (15 Dec 2014 22:10:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 15 Dec 2014 22:10:54 +0000 (UTC) Cc: Rasmus , emacs-devel@gnu.org To: martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 15 23:10:47 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 1Y0dqo-0005iB-Px for ged-emacs-devel@m.gmane.org; Mon, 15 Dec 2014 23:10:46 +0100 Original-Received: from localhost ([::1]:42094 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0dqo-0006rf-AP for ged-emacs-devel@m.gmane.org; Mon, 15 Dec 2014 17:10:46 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51407) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0dqg-0006rP-2K for emacs-devel@gnu.org; Mon, 15 Dec 2014 17:10:43 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y0dqa-000670-7g for emacs-devel@gnu.org; Mon, 15 Dec 2014 17:10:37 -0500 Original-Received: from mail-wi0-x236.google.com ([2a00:1450:400c:c05::236]:35899) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0dqZ-00066o-VK for emacs-devel@gnu.org; Mon, 15 Dec 2014 17:10:32 -0500 Original-Received: by mail-wi0-f182.google.com with SMTP id h11so10551388wiw.15 for ; Mon, 15 Dec 2014 14:10:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type:content-transfer-encoding; bh=0DNgTsFCAeSu26r9CsvtoB1LJvHkFIJKH4RapHmCCgs=; b=m/rqJWm7YJvwgvPvWB7uV+ynmWzFAgePeCM6er+KkF7WdiVaHUlXIMZ96vU9pZxNi4 GCk6kGGIY6BZgZkRaRY4sl4yvQ8Aya43AfpjE6qshQOzfuQiAWYa3VrpUWj7Fh1m1lyB LV36F6FBvBDi2t4YjocH9cYRHyU7+rLr2L7fPrFnmcDdbYX+US7cM9ThVrWO1vbO82uL rd2T9ziXypEm4z43vtB6gsXCbHZsYPxJoyIHJNpgya42SW2LAlOUw515Pm+BMt8PCyVd 56dOxr6aMP9GQIX4FparWfTR48bBr9krKe6TpQHtkQqzAfsDWG03Qe2rwdFTNlPIklyD /3fA== X-Received: by 10.180.105.168 with SMTP id gn8mr8638987wib.80.1418681431399; Mon, 15 Dec 2014 14:10:31 -0800 (PST) Original-Received: from holy.lan.yourcompany.com (31.57.37.188.rev.vodafone.pt. [188.37.57.31]) by mx.google.com with ESMTPSA id ex8sm14550584wjd.41.2014.12.15.14.10.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Dec 2014 14:10:30 -0800 (PST) In-Reply-To: <548EFE06.7010605@gmx.at> (martin rudalics's message of "Mon, 15 Dec 2014 16:28:06 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.92 (darwin) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::236 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:180184 Archived-At: martin rudalics writes: >> 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). That works too. I temporarily set margins to (0 . 0) then restore them. > >> But to do comparisons with column based variables like `fill-column', > > `fill-column' might be a problem, indeed. Do you really need it? Yes. Well, I guess. I estimate if "most" columns are filled to this column, and if so set the window margins according to this length. >> 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. I'm aware of that, the centering algorithm assumes fixed widths. >> 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. I agree. But the contract for the new/fixed function must state that the column value returned is only valid for one particular character width, presumably the "main" size. >> 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. Oh, that's interesting indeed (and not tremendously hard to do.) Jo=C3=A3o