[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: shell-CLI for Emacs
From: |
Emanuel Berg |
Subject: |
Re: shell-CLI for Emacs |
Date: |
Sat, 24 Aug 2013 00:42:50 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) |
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