From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sarir Khamsi Newsgroups: gmane.emacs.help Subject: Making code more Emacs Lisp-like Date: Mon, 02 Nov 2009 08:19:33 -0700 Organization: Raytheon Company Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1257176460 21797 80.91.229.12 (2 Nov 2009 15:41:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 2 Nov 2009 15:41:00 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Nov 02 16:40:53 2009 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 1N4z1V-0007rF-Qt for geh-help-gnu-emacs@m.gmane.org; Mon, 02 Nov 2009 16:40:50 +0100 Original-Received: from localhost ([127.0.0.1]:36756 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N4z1V-0006VV-8L for geh-help-gnu-emacs@m.gmane.org; Mon, 02 Nov 2009 10:40:49 -0500 Original-Path: news.stanford.edu!usenet.stanford.edu!bloom-beacon.mit.edu!4.24.21.218.MISMATCH!newsfeed2.dallas1.level3.net!news.level3.com!bos-service1.raytheon.com!bos-service2b.ext.ray.com.POSTED!53ab2750!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.101 (Gnus v5.10.10) Emacs/22.2 (windows-nt) Cancel-Lock: sha1:wy7BRjLBEp3Otp+FpPtYz+KA0/A= Original-Lines: 28 Original-NNTP-Posting-Host: 147.24.52.80 Original-X-Complaints-To: news@ext.ray.com Original-X-Trace: bos-service2b.ext.ray.com 1257175173 147.24.52.80 (Mon, 02 Nov 2009 15:19:33 UTC) Original-NNTP-Posting-Date: Mon, 02 Nov 2009 15:19:33 UTC Original-Xref: news.stanford.edu gnu.emacs.help:174322 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:69401 Archived-At: I wrote this function (defun sk-convert-to-ctor-init-list () "Convert a C++ member variable declaration to a ctor init list line. To use this, copy all member variable declarations into the constructor's member initialization list area and execute this command on each line. At the end of this command, it moves you to the next line setting it up for a key binding." (interactive) (save-excursion (end-of-line) (delete-horizontal-space) ; delete whitespace at end of line (backward-delete-char-untabify 1) ; delete the ";" (insert "(),") (search-backward-regexp "[\t *]") ; look for whitespace or "*" (set-mark (+ (point) 1)) ; save the current position (beginning-of-line) (kill-region (point) (mark)) (c-indent-command)) (next-line 1)) to take a region that containers C++ code for member variable declarations and convert it to a constructor's member init list. Is there a better (or a more ELisp) way than this approach? Thanks. Sarir -- Sarir Khamsi software guy sarir.khamsi@raytheon.com