[Top][All Lists]

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

Re: [Emacs-diffs] master 9ffb6ce 5/5: Quoting fixes in lisp/internationa

From: Oleh Krehel
Subject: Re: [Emacs-diffs] master 9ffb6ce 5/5: Quoting fixes in lisp/international and lisp/leim
Date: Thu, 03 Sep 2015 12:16:49 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Dmitry Gutov <address@hidden> writes:

> On 09/01/2015 03:06 PM, David Kastrup wrote:
>>> We have \\= escaping syntax, see `substitute-command-keys'.
>> Spells more or less death for cut&paste from some help buffer into the
>> _source_ of a DOC string, doesn't it?  Sure, backslashes already have
>> that effect, but at least this is due to string syntax rather than some
>> obscure markup processor.
> Like you said, any escaping syntax spells death for cut&paste.

Cut and paste can still work: just add a `quote-last-yank' command and/or
`quote-region' command. I've been using similar commands for posting
copy-pasted code to Stack websites. Here's a snippet I use for quoting
pasted code in Markdown:

    (defun ora-markdown-stack-block (beg end)
      (interactive "r")
      (let ((str (buffer-substring-no-properties beg end)))
        (delete-region beg end)
         "<!-- language: lang-cl -->\n\n    "
          (split-string str "\n" t)
          "\n    "))))

An issue that I have with \\= escaping syntax is that it's ugly.  One
reason for success of Markdown (also Org-mode) is that it looks good
enough even in source form, i.e. not exported or rendered. Therefore, I
propose we move from this:

    (defcustom auto-insert 'not-modified
    This variable is used when the function `auto-insert' is called, e.g.
    when you do (add-hook \\='find-file-hook \\='auto-insert).

to this:

    This variable is used when the function `auto-insert' is called, e.g.
    when you do ``(add-hook 'find-file-hook 'auto-insert)''.

Note how ``(add-hook 'find-file-hook 'auto-insert)'' looks good enough
even in plain text form, with no extra highlighting. Much better than
(add-hook \\='find-file-hook \\='auto-insert). And it's easy to copy
paste and quote with a simple command that just adds 4 chars around a

Also, it would be very easy to modify font-lock to add extra
highlighting for ``...'' blocks, since they're so easy to parse.

In the unlikely case when someone wants a code block with two
consecutive apostrophes, the old \\=' approach can be used. The quoting
function could even do this automatically, i.e. quote any apostrophes in
the region appropriately.

For code blocks, we could use an empty line followed by 4 spaces indent.

I think there's value in having asymmetric delimiters, since that eases
the job of font-lock by a lot. The current `markdown-mode' breaks
highlighting very often because of symmetric delimiters.


reply via email to

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