unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: Re: shell-CLI for Emacs
Date: Sat, 24 Aug 2013 00:42:50 +0200	[thread overview]
Message-ID: <87zjs8kozg.fsf@nl106-137-194.student.uu.se> (raw)
In-Reply-To: mailman.664.1377295372.10748.help-gnu-emacs@gnu.org

Barry OReilly <gundaetiapo@gmail.com> writes:

> Clearer than (eval `(,(read cmd) ,@args) ) is (apply (read cmd)
> args)

Absolutely! I didn't know of apply.

I realized a major problem with the interface is that a lot of
commands act differently depending on if there is a region or
not. An example is replace-string. With the function in the OP,
the region is ignored! Very confusing, as intuitively, once set,
you expect it to delimit the search-and-replace.

I worked around that with an, eh, interface to replace-string.

But that's getting tedious if it has to be done for a lot of
functions...

(defun rs (from to)
  (interactive)
  (let*((scope (if mark-active
                   (list (region-beginning) (region-end))
                   (list (point-min) (point-max)) ))
        (start (car   scope))
        (end   (nth 1 scope)) )
  (save-excursion
    (replace-string from to t start end) )))

-- 
Emanuel Berg - programmer (hire me! CV below)
computer projects: http://user.it.uu.se/~embe8573
internet activity: http://home.student.uu.se/embe8573


       reply	other threads:[~2013-08-23 22:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.664.1377295372.10748.help-gnu-emacs@gnu.org>
2013-08-23 22:42 ` Emanuel Berg [this message]
2013-08-24  0:37   ` shell-CLI for Emacs Thien-Thi Nguyen
     [not found]   ` <mailman.670.1377304488.10748.help-gnu-emacs@gnu.org>
2013-08-24  3:30     ` Emanuel Berg
2013-08-26  0:56     ` Emanuel Berg
2013-08-26  4:03       ` Yuri Khan
2013-08-26  5:38       ` Thien-Thi Nguyen
2013-08-23 22:02 Barry OReilly
  -- strict thread matches above, loose matches on Subject: below --
2013-08-23 20:46 Emanuel Berg

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=87zjs8kozg.fsf@nl106-137-194.student.uu.se \
    --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.
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).