help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Edit region in different mode


From: Oliver Scholz
Subject: Re: Edit region in different mode
Date: Thu, 23 Dec 2004 13:52:42 +0100
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3.50 (gnu/linux)

Albert Reiner <address@hidden> 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é!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]