emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master ff4de1b: Fix quoting style in Lisp comments


From: Eli Zaretskii
Subject: Re: master ff4de1b: Fix quoting style in Lisp comments
Date: Sat, 18 Sep 2021 09:19:40 +0300

> From: Stefan Kangas <stefan@marxist.se>
> Date: Fri, 17 Sep 2021 15:46:25 -0700
> Cc: emacs-devel@gnu.org, rudalics@gmx.at, gregory@heytings.org, 
>       monnier@iro.umontreal.ca, dgutov@yandex.ru, larsi@gnus.org, 
> juri@linkov.net
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > Patches welcome to make that happen.  One idea for implementation
> > would be to use the display-table feature.
> 
> I can't see any way to limit `buffer-display-table' to docstrings.

You can't.

> (define-minor-mode emacs-lisp-fancy-docstring-mode
>   "Minor mode for fancy display of Emacs Lisp `docstrings'."
>   :init-value nil
>   (if emacs-lisp-fancy-docstring-mode
>       (let ((table (or (copy-sequence standard-display-table)
>                        (make-display-table))))
>         (aset table ?` `[,(string-to-char (substitute-command-keys "`"))])
>         (aset table ?' `[,(string-to-char (substitute-command-keys "'"))])
>         (setq buffer-display-table table))
>     (setq buffer-display-table nil)))
> 
> It does the job in the sense that it correctly displays these quotes in
> docstrings, but it also does it in code, which makes things hard to
> read.

If it makes things harder to read, then my idea won't fly.  I thought
that since ‘ and ’ look so very similar to ` and ', the effect on
readability of code will be negligible.

If this idea is a non-starter, and we want to do this only in comments
and strings, I guess the only reasonable alternative is to do it as
part of font-lock?  Which means people who turn off font-lock will not
be able to have the feature.

Or maybe we could introduce a 'display-table' text property, which
would then make it possible to do this only for some parts of the
buffer text.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]