From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Lee Newsgroups: gmane.emacs.help Subject: Re: Emacs standards with regions Date: Wed, 26 Nov 2008 06:45:46 -0800 (PST) Organization: http://groups.google.com Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1227715737 12680 80.91.229.12 (26 Nov 2008 16:08:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 26 Nov 2008 16:08:57 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Nov 26 17:09:59 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1L5MxY-0005TC-15 for geh-help-gnu-emacs@m.gmane.org; Wed, 26 Nov 2008 17:09:48 +0100 Original-Received: from localhost ([127.0.0.1]:45804 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L5MwO-00064p-8c for geh-help-gnu-emacs@m.gmane.org; Wed, 26 Nov 2008 11:08:36 -0500 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!k36g2000pri.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 61 Original-NNTP-Posting-Host: 24.6.185.159 Original-X-Trace: posting.google.com 1227710746 18242 127.0.0.1 (26 Nov 2008 14:45:46 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Wed, 26 Nov 2008 14:45:46 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: k36g2000pri.googlegroups.com; posting-host=24.6.185.159; posting-account=bRPKjQoAAACxZsR8_VPXCX27T2YcsyMA User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; en) AppleWebKit/525.26.2 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:164805 X-Mailman-Approved-At: Wed, 26 Nov 2008 11:06:49 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:60137 Archived-At: On Nov 26, 12:19 am, Andreas R=C3=B6hler wrote: > Richard Riley wrote: > > Is there some reason that most emacs commands do not consider active > > region when invoked? One of the biggest UI improvements (for me) would > > be for interactive commands to default to the marked region. > > > e.g C-s for isearch-forward > > > Hilite "word" and "word" is the default search term. Ditto for % (searc= h > > and replace). I just modified my py-execute-buffer for example to call > > py-execute-region with the marked region rather than the entire buffer > > if the region was active. Why have a seperate "execute-region" command? > > > The ignoring of the region in so many key commands makes we wonder if I > > am missnig a default setting or if there was a decision not to use the > > region. > > > e.g this Google search function I use defaults > > > ,---- > > | (defun rgr/google-search-prompt() > > | (interactive) > > | (let* ((default (region-or-word-at-point)) > > | (term (read-string (format "Google the web for the following phrase= (%s): " > > | default)))) > > | (message "term is %s. Length is %d" term (length term)) > > | (rgr/google (if (zerop(length term)) default term)) > > | )) > > `---- > > > Can anyone add to this? > > AFAIS we have to consider too different cases: > > 1) where the region is something like the thing searched for > 2) the region marks the boundary wherein some action should take place. > > You mentioned the first case. Relating to the second, > default values are not to define in general. Boundaries > may be every position, even if beginning- or > end-of-line or paragraph may occur quite often. hum? i don't quite understand what you were saying. I don't see what is the difference of your (1) and (2). I don't quiet see what's (1). generally, a function need input. If the input is a text, sometimes that can be just the current word, line, file path, or other semantic unit, but sometimes it is useful to let the user feed it to the function. Checking active region (aka text selection) is a good way to do that. Xah =E2=88=91 http://xahlee.org/ =E2=98=84