From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Esben Stien Newsgroups: gmane.emacs.help Subject: Select Text Inside Parentheses Date: Sat, 01 Sep 2012 14:11:27 +0200 Message-ID: <87zk5at028.fsf@quasar.esben-stien.name> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1346499292 26427 80.91.229.3 (1 Sep 2012 11:34:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 1 Sep 2012 11:34:52 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Sep 01 13:34:54 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1T7lyX-0007gD-QX for geh-help-gnu-emacs@m.gmane.org; Sat, 01 Sep 2012 13:34:53 +0200 Original-Received: from localhost ([::1]:60766 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7lyV-0007wW-9r for geh-help-gnu-emacs@m.gmane.org; Sat, 01 Sep 2012 07:34:51 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:45400) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7lyQ-0007wB-FB for help-gnu-emacs@gnu.org; Sat, 01 Sep 2012 07:34:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T7lyP-0001Iu-F6 for help-gnu-emacs@gnu.org; Sat, 01 Sep 2012 07:34:46 -0400 Original-Received: from mail42.e.nsc.no ([193.213.115.42]:43855) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7lyP-0001HX-44 for help-gnu-emacs@gnu.org; Sat, 01 Sep 2012 07:34:45 -0400 Original-Received: from quasar.esben-stien.name (52.168.102.62.customer.cdi.no [62.102.168.52]) by mail42.nsc.no (8.14.4/8.14.4) with ESMTP id q81BYfOx006681 for ; Sat, 1 Sep 2012 13:34:41 +0200 (MEST) X-Home-Page: http://www.esben-stien.name User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 193.213.115.42 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:86625 Archived-At: I'm trying to select text between parentheses. This text is not code. This is my block of text: ( foo bar baz ) Problem is that it selects the whole first line after the first parentheses, so I get a whole line of white space in front of the first character. I'd like the selection to start at the first character after the first parentheses and end at the last character before the last parentheses. I tried adding (delete-horizontal-space). Any pointers as to how I can do this?. (require 'simple) (defun set-selection-around-parens() (interactive) (let ( (right-paren (save-excursion ; using save-excursion because ; we don't want to move the ; point. (re-search-forward ")" nil t))) ; bound nil ; no-error t (left-paren (save-excursion (re-search-backward "(" nil t)))) (when (and right-paren left-paren) ;; this is actually a way to activate a mark ;; you have to move your point to one side (push-mark (- right-paren 1)) (goto-char (+ left-paren 1)) (delete-horizontal-space) (activate-mark) ))) -- Esben Stien is b0ef@e s a http://www. s t n m irc://irc. b - i . e/%23contact sip:b0ef@ e e jid:b0ef@ n n