unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Paul Eggert <eggert@cs.ucla.edu>, emacs-devel@gnu.org
Subject: Re: Escaping quotes in docstrings, Was: A simple solution to "Upcoming loss of usability ..."
Date: Sun, 2 Aug 2015 21:31:09 +0300	[thread overview]
Message-ID: <55BE61ED.9010307@yandex.ru> (raw)
In-Reply-To: <55BE33AF.6080402@cs.ucla.edu>

On 08/02/2015 06:13 PM, Paul Eggert wrote:

> Again, this problem is independent of quoting style, and has long
> existed in Emacs evem with the older quoting style.  For example:

We didn't have an escaping syntax for quotes before. You've increased 
the complexity of our handling of quoting. Might as well fix some 
pre-existing problems. Right?

Look at it from the user's point of view: quotes can be escaped, it's 
documented in the substitute-command-keys docstring. And yet, it doesn't 
help in this kind of situations, where it seemingly should.

> (defun foo (a b c)
>    "It's invoked by `\\[next-error]'."
>      (+ 1 2 3))

This works now, and would continue to work, as per my suggestion.

> Yes, and substituting \[...] has problems and solutions that are quite
> similar to substituting ` and '.  So even if it makes sense to tease
> this functionality apart in some cases, it also makes sense to have a
> single function that does both subsitutions for convenience, as
> typically programs will not want to do one without doing the other.

When both substitutions are required, calling the second function on the 
result of the first function will be just as easy. Splitting the logic 
between two functions will make sure the first one doesn't lose information.

> It's a simple-enough matter to add an argument to substitute-doc-string
> specifying which kinds of substitutions are wanted.  I can volunteer to
> do that if it would be helpful (though I confess I don't see the use
> case).

It's better to keep the quote translation logic in one place (in a 
different function).

> Or if you prefer you can rewrite substitute-doc-string in Lisp
> -- as long as it doesn't affect performance significantly that should be
> merely an implementation detail.

Rewriting it also requires some C chops, if only to read the original. I 
don't know whether it'll lose performance: it might, handing certain 
keymaps might be intensive.

Anyway, even if the resulting function is in Lisp, it won't help as long 
as it's just one function, and it still loses information about which 
characters were originally escaped.

> I mentioned the possibility because it's still not clear to me what a
> Lisp solution would be, if it's not something involving font-lock.  If
> the Lisp solution merely translates the existing C code to Lisp, then of
> course your point is correct.

The Lisp solution would replace actual characters with different 
characters. In the text, not apply the transformation via text 
properties (although that's also an option).



  reply	other threads:[~2015-08-02 18:31 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-25 14:59 A simple solution to "Upcoming loss of usability ..." Oleh Krehel
2015-06-25 15:37 ` Dmitry Gutov
2015-06-25 16:36 ` Paul Eggert
2015-06-25 17:00   ` Oleh Krehel
2015-06-25 20:48     ` Paul Eggert
2015-06-25 21:10       ` Dmitry Gutov
2015-06-25 22:15         ` Paul Eggert
2015-06-25 22:25           ` Dmitry Gutov
2015-06-25 22:41             ` Paul Eggert
2015-06-25 22:52               ` Dmitry Gutov
2015-06-27 15:00         ` raman
2015-06-25 18:32   ` Dmitry Gutov
2015-06-25 22:17     ` Paul Eggert
2015-06-25 22:38       ` Dmitry Gutov
2015-06-26  2:35         ` Paul Eggert
2015-06-26 12:06           ` Dmitry Gutov
2015-06-27 17:28             ` Paul Eggert
2015-06-27 17:53               ` Dmitry Gutov
2015-06-27 21:09                 ` Paul Eggert
2015-06-28  1:04                   ` Dmitry Gutov
2015-06-28 15:20                     ` Paul Eggert
2015-06-28 20:27                       ` Escaping quotes in docstrings, Was: " Dmitry Gutov
2015-06-28 23:29                         ` Dmitry Gutov
2015-07-01  2:56                           ` Paul Eggert
2015-07-02  0:09                             ` Dmitry Gutov
2015-07-02  6:57                               ` Paul Eggert
2015-07-02  9:46                                 ` Dmitry Gutov
2015-07-06  6:12                                 ` Paul Eggert
2015-07-06 12:07                                   ` Dmitry Gutov
2015-07-06 16:30                                     ` Paul Eggert
2015-07-06 22:10                                       ` Dmitry Gutov
2015-07-07  7:54                                         ` Paul Eggert
2015-07-07  8:39                                           ` Dmitry Gutov
2015-08-01  1:36                                             ` Paul Eggert
2015-08-01 21:05                                               ` Dmitry Gutov
2015-08-02  6:56                                                 ` Paul Eggert
2015-08-02 12:51                                                   ` Dmitry Gutov
2015-08-02 15:13                                                     ` Paul Eggert
2015-08-02 18:31                                                       ` Dmitry Gutov [this message]
2015-08-02  8:49                                                 ` Przemysław Wojnowski
2015-08-02 19:16                                                   ` Drew Adams
2015-06-27 17:57               ` Dmitry Gutov
2015-06-25 23:12       ` João Távora
2015-06-26  7:40       ` Oleh Krehel
2015-06-26 14:54         ` Paul Eggert
2015-06-26 15:03           ` Dmitry Gutov
2015-06-25 20:58   ` Alan Mackenzie
2015-06-25 22:34     ` Paul Eggert
2015-06-25 22:40       ` Dmitry Gutov
2015-06-25 22:45         ` Paul Eggert
2015-06-25 22:55           ` Dmitry Gutov

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=55BE61ED.9010307@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=eggert@cs.ucla.edu \
    --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).