From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Ergus Newsgroups: gmane.emacs.devel Subject: Re: Fill column indicator functionality Date: Fri, 5 Apr 2019 20:11:33 +0200 Message-ID: <20190405181133.weuyq7yecuekolit@Ergus> References: <20190402174857.ydvsrgplftya4nti@Ergus> <83a7h8feho.fsf@gnu.org> <20190402212251.ee6jlzptyll24ebo@Ergus> <83sguzekc5.fsf@gnu.org> <20190403102234.gyk45tfk4uypilhn@Ergus> <83d0m3e43f.fsf@gnu.org> <20190405103614.oivi4mtlnklldli4@Ergus> <831s2gd2k6.fsf@gnu.org> <83pnq0bhef.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="73173"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: NeoMutt/20180716 Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Apr 05 20:12:51 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hCTKc-000Iri-4o for ged-emacs-devel@m.gmane.org; Fri, 05 Apr 2019 20:12:50 +0200 Original-Received: from localhost ([127.0.0.1]:45319 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hCTKb-0006kZ-4j for ged-emacs-devel@m.gmane.org; Fri, 05 Apr 2019 14:12:49 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:50741) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hCTKU-0006jQ-3D for emacs-devel@gnu.org; Fri, 05 Apr 2019 14:12:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hCTKR-0006IU-Ph for emacs-devel@gnu.org; Fri, 05 Apr 2019 14:12:41 -0400 Original-Received: from sonic308-18.consmr.mail.ir2.yahoo.com ([77.238.178.146]:40464) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hCTJU-0005Ud-Qh for emacs-devel@gnu.org; Fri, 05 Apr 2019 14:12:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1554487898; bh=ermGEq4kQsf65sTpoZ8IpipJkE6ws5GZuRxZ8wIWZgc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject; b=A4ogXCoCEi7MYF9hcxGKZUew7jYhKX5lGfMbIbol0YX2DGtEeiwYIGoVo6LGCUNZ5B1p+Xu3/sZ9dvP8fTW/bk6lp3KNfAWSzNomTPsRJN4xNVCb1nVpbb5UBsJEd9POsCqmj9E9BY8AC8EuaIp05SMSiB6yyCNOFRd89PeS2VeFqrCH6vUz/obKTeHgpff6aze3Qmfvdr3sT76NUsUcO/FCZiBGxhMegl6UOPMFIJfr9TMs4cJtDIalAnLDbQtIyrMzwX7L0+GwEARkxC01TOdAuEo3FEctsdq4RFm/0c5RW6K/g4QJ+y2I5wMJlHOfcrxmG4e6rRxqupLU3wDyGA== X-YMail-OSG: SRzU6uAVM1likpu0imhDsZUGqdWed85J2bKehgsmkFU6uUeAXg_ez8IjOxdrXJ8 ao.Sp85ppMPwihWCoB3ULwpTZ3zAr2c0Tq3BlPnoGp0204Gk41bW7s7Gb2Ia_f1CxuVsIfzw5eEO 0itGAdocAT3tIHvd8bhbIW9IO4BvjVZcy4n6gi8cix.w6FrvSjUf3RcExwYGpkqy1JXGN8YFbMa0 C9wPTQmmrE3V4S8_z80woLoav6YD1pdZVndHf0Z56p55NqvUpqnnkGAYaVJY_5P6Uwfye2WnN.ym DNx4XJVna57d_a7IA43BO1jIZyqQknfYYv6LRHJKsR72AZZII5Sa__H2YimR3akSX4dpu4PCsJNj A85eextWT6fa0M_CIZdXfFLdJSwepr1SnUJ2JsXHbtWW6nd0rMOLyTOktwBaSUqV4LoLmwi7GcbI kYPCQ4za7iLv8VA8RvpziqEbOG5IyQ99C3R2L0pYilkKv5VTmplYMb5As3nJA2hkU4bW9akQ8b6_ mSmeWlwNmSGR34mRAIbNzRKCWeo4tG0JFi_4sFyKB7jAkNhZubdgAtBp11jNi1GiHg6FDQlh6dSS 269D5a2LlcRGwkOaZ0Z.kQjKklm_ZyVop4IcXnsHYbKZNwI9fWBmzHkibuKQSyBfpWIQSzprmbFa sjEU1tLI852iUGvk0mtBex7BUvvYLYxUO3Q1i1WOCJO8XMpuDwD7kgfg51FI29gu0w_YBZZTzV6A YN23j.svEllLTMTJKmGAyeFODfwe98qqrcDvKGQivcj3RPTGKE7DDNQ62NqZSs6O6HRhAaVhiz5w P_rWme6T5PBLUz5AZmGCzltRQjrVjtKlB.f9Eu45RE Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic308.consmr.mail.ir2.yahoo.com with HTTP; Fri, 5 Apr 2019 18:11:38 +0000 Original-Received: from 84.88.50.33 (EHLO Ergus) ([84.88.50.33]) by smtp402.mail.ir2.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID ca9221f78b2a75993ca82d9c56972ba2; Fri, 05 Apr 2019 18:11:36 +0000 (UTC) Content-Disposition: inline In-Reply-To: <83pnq0bhef.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 77.238.178.146 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:234994 Archived-At: Hi Eli: On Fri, Apr 05, 2019 at 06:28:40PM +0300, Eli Zaretskii wrote: >> Date: Fri, 05 Apr 2019 16:06:17 +0300 >> From: Eli Zaretskii >> Cc: emacs-devel@gnu.org >> >> Once you can reproduce the problem, I suggest to use the macro >> FACE_FOR_CHAR to find the ID of a face suitable for displaying the >> indicator character, instead of using DEFAULT_FACE_ID. You can find >> examples of using this macro elsewhere in xdisp.c. > >On second thought, I think using FACE_FOR_CHAR would produce >unpleasant results. If the font required to display U+2502 is not the >default font, it could be higher than the default font, which will >cause the line height become larger on those screen lines where the >indicator is displayed. The result will cause complaints. > I have a version already implemented with this solution and I don't like it for the reasons you expose. >So I think we should insist on being able to display the indicator >character by the default face's font. Whether this is possible could >be tested by comparing the font returned by internal-char-font and the >default face's font returned by face-font. Like this: > > (if (eq (aref (car (internal-char-font nil ?│)) 0) > w(face-font 'default)) > ;; can use the default font for U+2502 > >(But we should use the actual value of >display-fill-column-indicator-char instead of the literal character.) > >WDYT? Actually this is what we have now: (define-minor-mode display-fill-column-indicator-mode "Toggle display fill column indicator. This uses `display-fill-column-indicator' internally. To change the position of the column displayed by default, customize `display-fill-column-indicator-column' you can change the character for the indicator setting `display-fill-column-indicator-character'." :lighter nil (if display-fill-column-indicator-mode (progn (setq display-fill-column-indicator t) (unless display-fill-column-indicator-character (if (char-displayable-p ?\u2502) (setq display-fill-column-indicator-character ?\u2502) (setq display-fill-column-indicator-character ?|)))) (setq display-fill-column-indicator nil))) I think we only need to extend the inner if with your condition, but I got an error because (internal-char-font nil ?│) always return nil in a terminal and aref has issues with that. Debugger entered--Lisp error: (wrong-type-argument arrayp nil) aref(nil 0) eval((aref (car (internal-char-font nil 9474)) 0) nil) elisp--eval-last-sexp(nil) #f(compiled-function (eval-last-sexp-arg-internal) "Evaluate sexp before point; print value in the echo area.\nInteractively, with a non `-' prefix argument, print output into\ncurrent buffer.\n\nNormally, this function truncates long output according to the\nvalue of the variables `eval-expression-print-length' and\n`eval-expression-print-level'. With a prefix argument of zero,\nhowever, there is no such truncation.\nInteger values are printed in several formats (decimal, octal,\nand hexadecimal). When the prefix argument is -1 or the value\ndoesn't exceed `eval-expression-print-maximum-character', an\ninteger value is also printed as a character of that codepoint.\n\nIf `eval-expression-debug-on-error' is non-nil, which is the default,\nthis command arranges for all errors to enter t he debugger." (interactive "P") #)(nil) apply(#f(compiled-function (eval-last-sexp-arg-internal) "Evaluate sexp before point; print value in the echo area.\nInteractively, with a non `-' prefix argument, print output into\ncurrent buffer.\n\nNormally, this function truncates long output according to the\nvalue of the variables `eval-expression-print-length' and\n`eval-expression-print-level'. With a prefix argument of zero,\nhowever, there is no such truncation.\nInteger values are printed in several formats (decimal, octal,\nand hexadecimal). When the prefix argument is -1 or the value\ndoesn't exceed `eval-expression-print-maximum-character', an\ninteger value is also printed as a character of that codepoint.\n\nIf `eval-expression-debug-on-error' is non-nil, which is the default,\nthis command arranges for all errors to e nter the debugger." (interactive "P") #) nil) eval-last-sexp(nil) funcall-interactively(eval-last-sexp nil) call-interactively(eval-last-sexp nil nil) command-execute(eval-last-sexp) In a gui I get this error: Debugger entered--Lisp error: (wrong-type-argument arrayp #) aref(# 0) eval((aref (car (internal-char-font nil 9474)) 0) nil) elisp--eval-last-sexp(nil) eval-last-sexp(nil) funcall-interactively(eval-last-sexp nil) call-interactively(eval-last-sexp nil nil) command-execute(eval-last-sexp) Could we use something else?