From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Pascal Bourguignon Newsgroups: gmane.emacs.help Subject: Re: Edit region in different mode Date: 22 Dec 2004 20:51:07 +0100 Organization: [posted via Easynet Spain] Message-ID: <87d5x2az84.fsf@thalassa.informatimago.com> References: <87y8fqgv09.fsf@ghidra.localhost> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1103745279 18480 80.91.229.6 (22 Dec 2004 19:54:39 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 22 Dec 2004 19:54:39 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Dec 22 20:54:30 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1ChCZ3-0006aM-00 for ; Wed, 22 Dec 2004 20:54:29 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1ChCjc-0003Fm-FZ for geh-help-gnu-emacs@m.gmane.org; Wed, 22 Dec 2004 15:05:24 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsmi-us.news.garr.it!newsmi-eu.news.garr.it!NewsITBone-GARR!feed.news.tiscali.de!easynet-monga!easynet.net!easynet-post2!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Original-Lines: 63 Original-NNTP-Posting-Host: 62.93.174.79 Original-X-Trace: DXC=IblfX=i8kD?IV[@?KSHgV3EY<>`XO4V7=>Uh 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: main.gmane.org gmane.emacs.help:22934 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:22934 Albert Reiner writes: > ["V. L. Simpson" , 22 Dec 2004 10:25:42 -0600]: > > >>>>> "Albert" == Albert Reiner writes: > > > > > Hi, is there a way of editing the current region in a > > > different mode? OK, > > > > Try http://mmm-mode.sourceforge.net/ > > Thanks, but I am well aware of mmm mode, and it does not seem to be a > solution to my problem: although the documentation seems hard to find, > I believe that mmm mode still requires me to put tags into the file > that indicate where to switch between modes. This is not what I want; > in fact, it is what I already have but is giving me trouble in some > cases. I really only want to edit in a different mode for a short > period of time, without leaving any mode-related traces in the file. I'd do narrow-to-region and xyz-mode then widden and original-mode > Maybe I should explain in more detail: I am using noweb mode with > noweb-code-mode set to lisp-mode (which is in fact slime mode). > Unfortunately the lisp-mode indentation and filling functions do not > work very well in lisp doc strings, and all the more so when the > quotes are not part of the same code chunk. Part of the problem is > that noweb-mode overrides any M-x outline-mode RET in what it knows is > a code chunk. Yes, I have the same problem. Here's what I have in my ~/.emacs: (global-set-key [f5] 'set-justification-left) (global-set-key [3 f5] (lambda (start end) (interactive "r") (let ((mode major-mode)) (text-mode) (set-justification-left start end) (funcall mode)))) So F5 does the justification of the region in the current mode, which is wrong in lisp mode. C-c F5 does the justification in the text mode and then reverts to the saved major-mode. > So whenever I write a long documentation string I copy the old text > to *scratch*, change to outline-mode, write / edit there, copy the > edited text back. Or sometimes I remove the chunk-starting line, > edit (effectively in LaTeX mode, which may be sufficient), and add > back the chunk-starting line. I have also tried M-: (setq > noweb-code-mode 'outline-mode) RET and M-x normal-mode RET later, > but none of these are very convenient. I guess it should be possible to write commands to _push_ and _pop_ modes... -- __Pascal Bourguignon__ http://www.informatimago.com/ There is no worse tyranny than to force a man to pay for what he does not want merely because you think it would be good for him. -- Robert Heinlein