From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Matthieu Moy Newsgroups: gmane.emacs.help Subject: Re: A true challenge for Emac and Elisp hackers - at Least I think so Date: Wed, 12 Oct 2005 15:29:54 +0200 Organization: IMAG Message-ID: References: <1129117705.959356.9950@g49g2000cwa.googlegroups.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1129123917 16487 80.91.229.2 (12 Oct 2005 13:31:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 12 Oct 2005 13:31:57 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Oct 12 15:31:57 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EPghl-00025r-87 for geh-help-gnu-emacs@m.gmane.org; Wed, 12 Oct 2005 15:31:37 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EPghk-0000X8-Ie for geh-help-gnu-emacs@m.gmane.org; Wed, 12 Oct 2005 09:31:36 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsfeed.berkeley.edu!ucberkeley!oleane.net!oleane!in2p3.fr!univ-lyon1.fr!news.ujf-grenoble.fr!news.imag.fr!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 31 Original-NNTP-Posting-Host: ecrins.imag.fr Original-X-Trace: trompette.imag.fr 1129124697 28972 129.88.43.124 (12 Oct 2005 13:44:57 GMT) Original-X-Complaints-To: abuse@imag.fr Original-NNTP-Posting-Date: Wed, 12 Oct 2005 13:44:57 +0000 (UTC) User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:Kr3RxUX9huNGGJCleRPff6o84Yk= Original-Xref: shelby.stanford.edu gnu.emacs.help:134585 Original-To: help-gnu-emacs@gnu.org 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:30166 Archived-At: Slawomir Nowaczyk writes: > 2) Write a function which does what you want and bind it to RET key > *) the function should check if buffer name ends with *.c Better: bind this function only in c-mode and c++-mode. No test needed in the command itself. C-h v c++-mode-map RET C-h v c-mode-map RET > *) the function should get current line contents (think of > functions buffer-substring, point, beginning-of-line, etc.) and C-h f looking-at RET. You don't even need to get it in a string. (if (save-excursion (beginning-of-line) (looking-at ".*return;")) ; adapt ... ... ...) > *) compare it with what do you want (string-match maybe?) > *) either insert "\n" or "; DBG\n" > > And also, try "C-h i C-s elisp RET" :) C-h i m eli TAB RET ;-). -- Matthieu