all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: Re: replace-regexp, the byte-compiler, docstrings, and suggestions
Date: Sat, 18 Oct 2014 00:52:08 +0200	[thread overview]
Message-ID: <87vbnigvhj.fsf@debian.uxu> (raw)
In-Reply-To: mailman.11404.1413576982.1147.help-gnu-emacs@gnu.org

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> Yeah, probably. I tried in the Linux VT and in X
>> (with xterm), with and without tmux on both: in the
>> console C-4 just inserts a "4", in X C-4 is C-\. I
>> only have emacs-nox installed but I'm happy with
>> `C-u N' so this doesn't bother me.
>
> You can also use M-N, BTW, which should work also in
> text terminals.

True!

OK, so I won't suggest a "block cite" function as
there is one, perhaps two, already.

Still, any comments on:

- instead of offering Elisp in the help, give a
  function that does exactly that
  
- have the byte-compiler give this reference as well
  (optimally the same information as in the help, so
  no need to compile and then check out the help)

- could this be optimized transparently? (perhaps a
  bit risky? with a very small gain at that - no, I'm
  happy with what I originally proposed)

- even as it stands, the reason the "interactive"
  `replace-regexp' shouldn't be used is:

    This function is usually the wrong thing to use in a Lisp program.
    What you probably want is a loop like this:
      (while (re-search-forward REGEXP nil t)
        (replace-match TO-STRING nil nil))
    which will run faster and will not set the mark or print anything.

but the interface to `replace-regexp' is:
    
(replace-regexp REGEXP TO-STRING &optional DELIMITED
START END)

So we offer a function. When someone uses it the
compiler complains. Because the compiler doesn't say
much, the user has to check out the help where he is
given the code. But the code doesn't even cover the
interface of the "forbidden" `replace-regexp'. So he
has to figure out the missing parts. By this time
frustration will run high especially because
`replace-regexp' - the incorrect use - probably worked
just fine.

I'm telling you. It is not a big deal. It is a detail.
But it is the details that make the big picture.
    
-- 
underground experts united


      parent reply	other threads:[~2014-10-17 22:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-12 18:28 replace-regexp, the byte-compiler, docstrings, and suggestions Emanuel Berg
2014-10-12 20:32 ` John Mastro
2014-10-13  0:50 ` Robert Thorpe
     [not found] ` <mailman.11050.1413145964.1147.help-gnu-emacs@gnu.org>
2014-10-16 23:55   ` Emanuel Berg
2014-10-17  0:07     ` Drew Adams
     [not found]     ` <mailman.11343.1413504497.1147.help-gnu-emacs@gnu.org>
2014-10-17  1:09       ` Emanuel Berg
2014-10-17  2:22         ` Drew Adams
2014-10-18 17:57         ` Robert Thorpe
2014-10-17  2:26     ` John Mastro
2014-10-17  3:05       ` Stefan Monnier
     [not found]       ` <mailman.11351.1413515156.1147.help-gnu-emacs@gnu.org>
2014-10-17 23:21         ` Emanuel Berg
     [not found]     ` <mailman.11350.1413512841.1147.help-gnu-emacs@gnu.org>
2014-10-17 19:11       ` Emanuel Berg
2014-10-17 19:20         ` Stefan Monnier
     [not found]         ` <mailman.11400.1413573661.1147.help-gnu-emacs@gnu.org>
2014-10-17 19:38           ` Emanuel Berg
2014-10-17 20:15             ` Stefan Monnier
     [not found]             ` <mailman.11404.1413576982.1147.help-gnu-emacs@gnu.org>
2014-10-17 22:52               ` Emanuel Berg [this message]

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vbnigvhj.fsf@debian.uxu \
    --to=embe8573@student.uu.se \
    --cc=help-gnu-emacs@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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.