all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Pascal Bourguignon <spam@mouse-potato.com>
Subject: Re: Edit region in different mode
Date: 22 Dec 2004 20:51:07 +0100	[thread overview]
Message-ID: <87d5x2az84.fsf@thalassa.informatimago.com> (raw)
In-Reply-To: vw88y7qp8ld.fsf@berry.phys.ntnu.no

Albert Reiner <areiner@tph.tuwien.ac.at> writes:

> ["V. L. Simpson" <vls@freeshell.org>, 22 Dec 2004 10:25:42 -0600]:
> > >>>>> "Albert" == Albert Reiner <areiner@tph.tuwien.ac.at> 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

  reply	other threads:[~2004-12-22 19:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-22 16:19 Edit region in different mode Albert Reiner
2004-12-22 16:25 ` V. L. Simpson
2004-12-22 17:05   ` Albert Reiner
2004-12-22 19:51     ` Pascal Bourguignon [this message]
2004-12-22 23:14       ` Kevin Rodgers
2004-12-23  1:03         ` Pascal Bourguignon
2004-12-23 17:42       ` Albert Reiner
2004-12-23 12:17 ` Mathias Dahl
2004-12-23 12:52 ` Oliver Scholz
2004-12-23 17:01   ` Kevin Rodgers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d5x2az84.fsf@thalassa.informatimago.com \
    --to=spam@mouse-potato.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.