From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: tabulated-list-init-header and glyphless-char-display Date: Sat, 09 Apr 2011 15:26:03 -0400 Message-ID: <8762qnxm44.fsf@stupidchicken.com> References: <83mxk0u0g7.fsf@gnu.org> <874o68zjhi.fsf@stupidchicken.com> <83k4f4twam.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1302377183 32551 80.91.229.12 (9 Apr 2011 19:26:23 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 9 Apr 2011 19:26:23 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Apr 09 21:26:20 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q8dnU-0008Al-4f for ged-emacs-devel@m.gmane.org; Sat, 09 Apr 2011 21:26:16 +0200 Original-Received: from localhost ([127.0.0.1]:40854 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q8dnT-00038Q-JD for ged-emacs-devel@m.gmane.org; Sat, 09 Apr 2011 15:26:15 -0400 Original-Received: from [140.186.70.92] (port=51908 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q8dnK-00038I-JB for emacs-devel@gnu.org; Sat, 09 Apr 2011 15:26:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q8dnJ-00048a-8S for emacs-devel@gnu.org; Sat, 09 Apr 2011 15:26:06 -0400 Original-Received: from vm-emlprdomr-05.its.yale.edu ([130.132.50.146]:51627) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q8dnJ-000489-4E; Sat, 09 Apr 2011 15:26:05 -0400 Original-Received: from furball ([64.134.240.70]) (authenticated bits=0) by vm-emlprdomr-05.its.yale.edu (8.14.4/8.14.4) with ESMTP id p39JQ3I3016082 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sat, 9 Apr 2011 15:26:03 -0400 Original-Received: by furball (Postfix, from userid 1000) id A68BB1602E5; Sat, 9 Apr 2011 15:26:03 -0400 (EDT) In-Reply-To: <83k4f4twam.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 08 Apr 2011 21:47:29 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-Scanned-By: MIMEDefang 2.71 on 130.132.50.146 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 130.132.50.146 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:138334 Archived-At: Eli Zaretskii writes: >> From: Chong Yidong >> Cc: emacs-devel@gnu.org >> Date: Fri, 08 Apr 2011 14:27:37 -0400 >>=20 >> We can probably use "^" and "v" when the unicode glyphs cannot be >> displayed, but it sure would be nice to the glyphs whereever possible. >> Any idea how to go about checking this? > > I think you will find glyphless-char-display (which is a char-table) > useful. Thanks. This doesn't quite do what I want, because (i) it applies to the entire buffer, when I only want it to apply to one particular glyph, and (ii) the char table's "fallback display" slot applies to all glyphs with no fonts, when I only want to handle two particular glyphs. I propose introducing a `glyphless-char-display-default' text-property, which, if non-nil, overrides glyphless-char-display's "fallback display" slot locally. See attached patch, which seems to do the right thing. Thoughts? *** src/xdisp.c 2011-04-09 16:35:19 +0000 --- src/xdisp.c 2011-04-09 19:18:08 +0000 *************** *** 736,741 **** --- 736,742 ---- =20=20 /* Symbol for the purpose of Vglyphless_char_display. */ Lisp_Object Qglyphless_char_display; + Lisp_Object Qglyphless_char_display_default; =20=20 /* Method symbols for Vglyphless_char_display. */ static Lisp_Object Qhex_code, Qempty_box, Qthin_space, Qzero_width; *************** *** 5579,5587 **** Lisp_Object lookup_glyphless_char_display (int c, struct it *it) { ! Lisp_Object glyphless_method =3D Qnil; =20=20 ! if (CHAR_TABLE_P (Vglyphless_char_display) && CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (Vglyphless_char_display)) >= =3D 1) glyphless_method =3D (c >=3D 0 ? CHAR_TABLE_REF (Vglyphless_char_display, c) --- 5580,5592 ---- Lisp_Object lookup_glyphless_char_display (int c, struct it *it) { ! Lisp_Object glyphless_method ! =3D (c < 0) ! ? get_it_property (it, Qglyphless_char_display_default) ! : Qnil; =20=20 ! if (NILP (glyphless_method) ! && CHAR_TABLE_P (Vglyphless_char_display) && CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (Vglyphless_char_display)) >= =3D 1) glyphless_method =3D (c >=3D 0 ? CHAR_TABLE_REF (Vglyphless_char_display, c) *************** *** 26974,26979 **** --- 26979,26986 ---- Qchar_table_extra_slots =3D intern_c_string ("char-table-extra-slots"); Fput (Qglyphless_char_display, Qchar_table_extra_slots, make_number (1)= ); =20=20 + DEFSYM (Qglyphless_char_display_default, "glyphless-char-display-defaul= t"); +=20 DEFVAR_LISP ("glyphless-char-display", Vglyphless_char_display, doc: /* Char-table to control displaying of glyphless characters. Each element, if non-nil, is an ASCII acronym string (displayed in a box) *** lisp/emacs-lisp/tabulated-list.el 2011-04-06 21:55:08 +0000 --- lisp/emacs-lisp/tabulated-list.el 2011-04-09 19:23:20 +0000 *************** *** 143,148 **** --- 143,154 ---- map) "Local keymap for `tabulated-list-mode' sort buttons.") =20=20 + (defvar tabulated-list-up-arrow + (propertize "=E2=96=B2" 'glyphless-char-display-default 'thin-space)) +=20 + (defvar tabulated-list-down-arrow + (propertize "=E2=96=BC" 'glyphless-char-display-default 'thin-space)) +=20 (defun tabulated-list-init-header () "Set up header line for the Tabulated List buffer." (let ((x tabulated-list-padding) *************** *** 167,179 **** ;; The selected sort column ((equal (car col) (car tabulated-list-sort-key)) (apply 'propertize ! (concat label ! (cond ! ((> (+ 2 (length label)) width) ! "") ! ((cdr tabulated-list-sort-key) ! " =E2=96=B2") ! (t " =E2=96=BC"))) 'face 'bold 'tabulated-list-column-name (car col) button-props)) --- 173,185 ---- ;; The selected sort column ((equal (car col) (car tabulated-list-sort-key)) (apply 'propertize ! (cond ! ((> (+ 2 (length label)) width) ! label) ! ((cdr tabulated-list-sort-key) ! (concat label " " tabulated-list-up-arrow)) ! (t ! (concat label " " tabulated-list-down-arrow))) 'face 'bold 'tabulated-list-column-name (car col) button-props))