From: Chong Yidong <cyd@stupidchicken.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: tabulated-list-init-header and glyphless-char-display
Date: Sat, 09 Apr 2011 15:26:03 -0400 [thread overview]
Message-ID: <8762qnxm44.fsf@stupidchicken.com> (raw)
In-Reply-To: <83k4f4twam.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 08 Apr 2011 21:47:29 +0300")
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Chong Yidong <cyd@stupidchicken.com>
>> Cc: emacs-devel@gnu.org
>> Date: Fri, 08 Apr 2011 14:27:37 -0400
>>
>> 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 ----
/* Symbol for the purpose of Vglyphless_char_display. */
Lisp_Object Qglyphless_char_display;
+ Lisp_Object Qglyphless_char_display_default;
/* 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 = Qnil;
! if (CHAR_TABLE_P (Vglyphless_char_display)
&& CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (Vglyphless_char_display)) >= 1)
glyphless_method = (c >= 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
! = (c < 0)
! ? get_it_property (it, Qglyphless_char_display_default)
! : Qnil;
! if (NILP (glyphless_method)
! && CHAR_TABLE_P (Vglyphless_char_display)
&& CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (Vglyphless_char_display)) >= 1)
glyphless_method = (c >= 0
? CHAR_TABLE_REF (Vglyphless_char_display, c)
***************
*** 26974,26979 ****
--- 26979,26986 ----
Qchar_table_extra_slots = intern_c_string ("char-table-extra-slots");
Fput (Qglyphless_char_display, Qchar_table_extra_slots, make_number (1));
+ DEFSYM (Qglyphless_char_display_default, "glyphless-char-display-default");
+
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.")
+ (defvar tabulated-list-up-arrow
+ (propertize "▲" 'glyphless-char-display-default 'thin-space))
+
+ (defvar tabulated-list-down-arrow
+ (propertize "▼" 'glyphless-char-display-default 'thin-space))
+
(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)
! " ▲")
! (t " ▼")))
'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))
next prev parent reply other threads:[~2011-04-09 19:26 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-08 17:17 tabulated-list-init-header and glyphless-char-display Eli Zaretskii
2011-04-08 18:27 ` Chong Yidong
2011-04-08 18:47 ` Eli Zaretskii
2011-04-08 18:59 ` Eli Zaretskii
2011-04-09 19:26 ` Chong Yidong [this message]
2011-04-10 3:59 ` Stefan Monnier
2011-04-10 5:24 ` Eli Zaretskii
2011-04-10 15:47 ` Chong Yidong
2011-04-10 16:53 ` Eli Zaretskii
2011-04-10 18:11 ` Chong Yidong
2011-04-11 17:03 ` Eli Zaretskii
2011-04-11 17:31 ` Chong Yidong
2011-04-11 18:04 ` Eli Zaretskii
2011-04-11 18:39 ` Chong Yidong
2011-04-11 19:27 ` Eli Zaretskii
2011-04-11 22:31 ` Chong Yidong
2011-04-12 3:57 ` Stefan Monnier
2011-04-12 4:51 ` Eli Zaretskii
2011-04-12 5:42 ` Kevin Rodgers
2011-04-12 5:58 ` Eli Zaretskii
2011-04-12 16:12 ` Chong Yidong
2011-04-12 16:45 ` Eli Zaretskii
-- strict thread matches above, loose matches on Subject: below --
2011-04-08 17:26 Eli Zaretskii
2011-04-09 10:26 ` Štěpán Němec
2011-04-09 12:12 ` Eli Zaretskii
2011-04-09 13:56 ` Stefan Monnier
2011-04-09 15:37 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8762qnxm44.fsf@stupidchicken.com \
--to=cyd@stupidchicken.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).