From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Luca Ferrari Newsgroups: gmane.emacs.help Subject: Re: align-regexp problem when called from lisp code Date: Fri, 9 Aug 2013 10:45:58 +0200 Message-ID: References: <87wqnws9in.fsf@thinkpad.tsdh.org> <87wqnvl1sm.fsf@thinkpad.tsdh.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1376037972 10597 80.91.229.3 (9 Aug 2013 08:46:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 9 Aug 2013 08:46:12 +0000 (UTC) Cc: help-gnu-emacs To: Tassilo Horn Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 09 10:46:14 2013 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 1V7iKr-0006Qr-7G for geh-help-gnu-emacs@m.gmane.org; Fri, 09 Aug 2013 10:46:13 +0200 Original-Received: from localhost ([::1]:51414 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7iKq-0004rz-FS for geh-help-gnu-emacs@m.gmane.org; Fri, 09 Aug 2013 04:46:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60360) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7iKg-0004rm-0s for help-gnu-emacs@gnu.org; Fri, 09 Aug 2013 04:46:02 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V7iKf-00027d-4b for help-gnu-emacs@gnu.org; Fri, 09 Aug 2013 04:46:01 -0400 Original-Received: from mail-we0-x22a.google.com ([2a00:1450:400c:c03::22a]:47090) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7iKd-00026r-GI; Fri, 09 Aug 2013 04:45:59 -0400 Original-Received: by mail-we0-f170.google.com with SMTP id w60so3375872wes.1 for ; Fri, 09 Aug 2013 01:45:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=NX2SJrQBBvOJ93H1GRkdHmz4EUPQmJTnLu44Jw9/iE0=; b=rBlVM44AlDVQtM74/GCavOJOKQIvQ/DVu+x1kLNBLdKI2lDwlnr5vzHQ3KDv8YDIlJ FPjSee0So4Y+ga1aFnjbv5iLntbeR3c/xF7knj+dPpmt3ecveDUpsJPh3E6yylqFYoNr /Z3Lefxlgnbv85AbGhiAk9HjtUofDIQIu6MzhY+PRm0L8sUwnHpS777/YhyODayYLv/E 9YEizEabzW0QTrUtaGxWtnJQgUVF5HPpCgDXXswMH63s8TdocoHiVEiQ1SXKddttHEsU vSqvMyDe5/OBsPDcWjXSz+i+Z65F7HDEs7ujIa/RGp3dc7RnRJpkuElpZQKODfQAsIJx uSXg== X-Received: by 10.180.92.1 with SMTP id ci1mr1547757wib.14.1376037958671; Fri, 09 Aug 2013 01:45:58 -0700 (PDT) Original-Received: by 10.194.157.194 with HTTP; Fri, 9 Aug 2013 01:45:58 -0700 (PDT) In-Reply-To: <87wqnvl1sm.fsf@thinkpad.tsdh.org> X-Google-Sender-Auth: 3lNMphq0ik55BlcJNet4CJ_65-Q X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c03::22a 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:92788 Archived-At: On Fri, Aug 9, 2013 at 10:13 AM, Tassilo Horn wrote: > Luca Ferrari writes: > >>>> --8<---------------cut here---------------start------------->8--- >>>> (defun fluca1978/align-assignments (beg end) >>>> (interactive "r") >>>> (align-regexp beg end "\\(\\s-*\\)=")) >>>> --8<---------------cut here---------------end--------------->8--- >> >> Uhm...just for curiosity, what kind of regexp should I use if I want >> also to align all comment starting (/*) in every row? > > You mean C-style multi-line comments? This > > --8<---------------cut here---------------start------------->8--- > (defun fluca1978/align-comment (beg end) > (interactive "r") > (align-regexp beg end "\\(\\s-*\\)\\*" 1 0)) > --8<---------------cut here---------------end--------------->8--- > Uhm...no, I was wondering to obtaining some that aligns the assignments and potential one line comments, so something that from this: a = 10; /* 10 is the inital value */ veryLongVariableName = ( a + 2 ); /* should start two more from a */ into this: a = 10; /* 10 is the inital value */ veryLongVariableName = ( a + 2 ); /* should start two more from a */ So I was thinking about aligning the assignments first and then the comments (that could have been already aligned by moving the = signs). Suggestions? Thanks, Luca