From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: GianUberto.Lauri@eng.it (Gian Uberto Lauri) Newsgroups: gmane.emacs.help Subject: A true challenge for Emac and Elisp hackers - at Least I think so Date: Wed, 12 Oct 2005 14:49:00 +0200 Message-ID: <17229.1596.164785.319166@paperoga.gianoziaorientale.it> References: <1129117705.959356.9950@g49g2000cwa.googlegroups.com> Reply-To: saint@eng.it NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1129122777 12321 80.91.229.2 (12 Oct 2005 13:12:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 12 Oct 2005 13:12:57 +0000 (UTC) Cc: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Oct 12 15:12:54 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EPgNQ-0003kf-MX for geh-help-gnu-emacs@m.gmane.org; Wed, 12 Oct 2005 15:10:37 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EPgNP-0000V9-UE for geh-help-gnu-emacs@m.gmane.org; Wed, 12 Oct 2005 09:10:35 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EPg2c-00030M-M6 for help-gnu-emacs@gnu.org; Wed, 12 Oct 2005 08:49:06 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EPg2a-0002zH-T2 for help-gnu-emacs@gnu.org; Wed, 12 Oct 2005 08:49:06 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EPg2a-0002yf-9v for help-gnu-emacs@gnu.org; Wed, 12 Oct 2005 08:49:04 -0400 Original-Received: from [62.101.90.2] (helo=mail.eng.it) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EPg2a-0004nI-B0 for help-gnu-emacs@gnu.org; Wed, 12 Oct 2005 08:49:04 -0400 Original-Received: from mail.eng.it (localhost [127.0.0.1]) by deliver.antivirus (Postfix) with SMTP id 74F6B18041; Wed, 12 Oct 2005 14:49:02 +0200 (CEST) Original-Received: from paperoga.gianoziaorientale.it (unknown [192.168.22.125]) by mail.eng.it (Postfix) with ESMTP id DD7DB18051; Wed, 12 Oct 2005 14:49:01 +0200 (CEST) Original-To: "Sune" Original-Newsgroups: comp.emacs,gnu.emacs.help In-Reply-To: <1129117705.959356.9950@g49g2000cwa.googlegroups.com> X-Mailer: VM 7.19 under Emacs 22.0.50.7 X-attribution: CC X-Zippy: I FORGOT to do the DISHES!! X-PMX-Version: 5.0.3.165339 X-PerlMx-Spam: Gauge=%%XGAUGE%%%%IGAUGE%%, Probability=%%PROB%%, Report='%%HITS%%' 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:30164 Archived-At: >>>>> "S" == Sune writes: S> * If I hit RET with any shift-key being pressed simultaneously, S> RET must behave as any normal RET would (basically a normal S> linefeed with possible auto-indentation). This may seem backward S> but I want almost every line in my sorce to be traceable. S> * If I hit RET only, and the following applies: S> - It is preceeded by a ';' (semicolon) AND the word 'return' S> is not part of the current line or: S> - It is preceeded by a '{' (curly bracket) S> RET adds DBG after the ';' or the '{' with a space in between S> like so: S> ; DBG { DBG S> respectively. After that (the same key stroke) , RET behaves S> like a normal RET would (basically a normal linefeed with possible S> auto-indentation). S> I have to admit that this is so far out there (at least for me) S> that I would need more or less a ready-to-go implementation just to S> paste into .emacs. Does this help ? (defun unusual-return () (interactive) (save-excursion) (let ((here (point)) (previous-char (char-before))) (beginning-of-line) (cond ((string-match "DGB[ \\t]*$" (buffer-substring (point) here)) (goto-char here) (newline-and-indent)) ((or (char-equal previous-char ?{) (char-equal previous-char ?\;)) (goto-char here) (insert " DBG")) (t (goto-char here) (newline-and-indent))))) You then add an hook to c-mode a little function that does the following: tests that the buffer name does end by .c locally sets RET to the function above (or a better one, this is a 5 minutes game result) locally sets S-RET, C-RET and M-RET to newline-and-indent -- /\ ___ /___/\__|_|\_|__|___Gian Uberto Lauri_____________________ //--\ | | \| | Integralista GNUslamico \/ e allevatore di bug da competizione