From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Oliver Scholz Newsgroups: gmane.emacs.help Subject: Re: Edit region in different mode Date: Thu, 23 Dec 2004 13:52:42 +0100 Message-ID: <87fz1x6usl.fsf@ID-87814.user.uni-berlin.de> References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1103806890 11609 80.91.229.6 (23 Dec 2004 13:01:30 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 23 Dec 2004 13:01:30 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 23 14:01:24 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 1ChSaq-0006ii-00 for ; Thu, 23 Dec 2004 14:01:24 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1ChSlQ-0008E7-V9 for geh-help-gnu-emacs@m.gmane.org; Thu, 23 Dec 2004 08:12:21 -0500 Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3.50 (gnu/linux) X-Attribution: os X-Face: "HgH2sgK|bfH$; PiOJI6|qUCf.ve<51_Od(%ynHr?=>znn#~#oS>",F%B8&\vus),2AsPYb -n>PgddtGEn}s7kH?7kH{P_~vu?]OvVN^qD(L)>G^gDCl(U9n{:d>'DkilN!_K"eNzjrtI4Ya6; Td% IZGMbJ{lawG+'J>QXPZD&TwWU@^~A}f^zAb[Ru;CT(UA]c& Cancel-Lock: sha1:EypI7OWwqI/gghJ068qFQ64P3rI= Original-NNTP-Posting-Host: 84.57.9.4 Original-X-Trace: 23 Dec 2004 13:54:50 +0100, 84.57.9.4 Original-Lines: 39 Original-X-Complaints-To: abuse@arcor-ip.de Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsmi-us.news.garr.it!newsmi-eu.news.garr.it!NewsITBone-GARR!irazu.switch.ch!switch.ch!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.arcor-ip.de!news.arcor-ip.de!84.57.9.4 Original-Xref: shelby.stanford.edu gnu.emacs.help:127492 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: main.gmane.org gmane.emacs.help:22949 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:22949 Albert Reiner writes: > Hi, > > is there a way of editing the current region in a different mode? OK, > this is emacs so there certainly is a way, but is there a simple way? > > More specifically, I would like to get a new buffer with everything > between point and mark (or maybe some other positions found by > searching), set a different editing mode in that new buffer, and have > the editing take effect in the original buffer when I am done. I > suspect this should be possible by some combination of > clone-indirect-buffer and narrowing but I don't quite know how to go > about this. I use the following to write Emacs Lisp in my usenet postings: (defun egoge-write-elisp () (interactive) (if (not (eq major-mode 'message-mode)) (message "Not a message buffer.") (switch-to-buffer (make-indirect-buffer (current-buffer) "*emacs-lisp-message*")) (emacs-lisp-mode))) I guess, this could serve as a starter for you. However, I do believe that mmm-mode would provide a more elegant solution. I never really used it, but the last time I checked I was not forced at all to use some tags, but IIRC I just issued a command on a region and then for text in that region Emacs behaved as if a different major mode were active, an effect that was lost once I revisited the file. Oliver -- 3 Nivôse an 213 de la Révolution Liberté, Egalité, Fraternité!